【问题标题】:Spring Integration outbound gateway with poller带有轮询器的 Spring 集成出站网关
【发布时间】:2016-05-31 17:25:40
【问题描述】:

以下是配置了标头的出站 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" />

【问题讨论】:

    标签: spring spring-integration


    【解决方案1】:

    fixed-delay 是一个选项,用于确定上一个任务完成之后的时间。在您的情况下,poll

    既然你确认了它

    触发一次并停止。

    看起来您没有以某种方式在 dealinfo.channel 上完成您的工作,并且没有将控件返回给 TaskScheduler,因此,不要为其他事情释放线程。

    &lt;chain&gt;dealinfo.channel 上的订阅者之后,我们真的应该看到并理解你的逻辑。

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

    【讨论】:

    • 是的,同意你的看法。当 REST 服务失败并出现 401 Http Status Error 时,它会重新正确触发,但当它成功并出现 200 Http Status 错误时,它不会重新触发。我在这个要点上复制了类似的例子,它也有同样的问题gist.github.com/krishnaaravacadreon/…
    • M-m-m。另一方面,测试用例在收到第一个结果后才退出。因此,在测试期间您可能只有一次民意调查,这完全是事实。
    猜你喜欢
    • 2017-06-08
    • 2014-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    相关资源
    最近更新 更多