2016-05-31 179 views
1

下面是出站http网关配置了标题,但在添加轮询器时没有连续触发。它只会触发一次并停止。带有轮询器的弹簧集成出站网关

<int:inbound-channel-adapter channel="fooinfotrigger.channel" expression="''"> 
    <int:poller fixed-delay="5000"></int:poller> 
</int:inbound-channel-adapter> 

<int:channel id="fooinfo.channel"> 
    <int:queue capacity="10"/> 
</int:channel> 

<int:channel id="fooinfotrigger.channel"></int:channel> 

<int:chain input-channel="fooinfotrigger.channel" output-channel="fooinfo.channel">  

    <int:header-enricher> 
     <int:header name="Authorization" value="...." /> 
     <int:header name="Content-Type" value="...." /> 
    </int:header-enricher> 

    <int-http:outbound-gateway id="fooHttpGateway" 
     url="https://foo.com/v1/services/foo?status=active" 
     http-method="GET" 
     expected-response-type="java.lang.String" 
     charset="UTF-8" 
     reply-timeout="5000"> 
    </int-http:outbound-gateway> 

    <int:transformer method="transform" ref="fooResourcesTransformer"/> 

</int:chain> 

<bean id="fooResourcesTransformer" class="com.foo.FooTransformer" /> 

回答

0

fixed-delay是确定前一个任务的完成后的时间的选项。在你的情况下poll

既然你申明,

被触发后停止。

貌似你不以某种方式完成对dealinfo.channel您的工作和不返回控制到TaskScheduler,因此,不释放线程别的东西。

我们确实应该在<chain>之后看到并理解你的逻辑,并且在dealinfo.channel上有一个订阅者。

或者......也许您的REST服务根本没有返回响应。独立于那个reply-timeout="5000"

+0

是的同意你。当REST服务失败并出现401 Http状态错误时,它会正确重新触发,但当它以200 Http状态成功时,它不会重新触发。我在这个要点复制了类似的例子,它也有相同的问题https://gist.github.com/krishnaaravacadreon/3b22ff9a33c3fada2500d76789cee817 – user1044173

+0

M-m-m。另一方面,该测试用例在第一个结果接收后才退出。所以,这是完全的事实,你可能只有一次民意测验。 –

相关问题