Spring integration 在Spring集成中继续发送消息

Spring integration 在Spring集成中继续发送消息,spring-integration,poller,Spring Integration,Poller,一个模块每N秒向消息代理发送消息。另一个模块接收来自代理的消息。消息构建在服务激活器的sendMessage方法中。计划是使用入站通道适配器(如回答中所示),但由于某些原因,此解决方案不起作用,我一直收到“在轮询期间未收到任何消息,返回‘false’”。这种配置有什么问题 <int-jms:inbound-channel-adapter id="keepAlivePoller" channel="keepAliveChannel" destination="keepAlive" conne

一个模块每N秒向消息代理发送消息。另一个模块接收来自代理的消息。消息构建在服务激活器的sendMessage方法中。计划是使用入站通道适配器(如回答中所示),但由于某些原因,此解决方案不起作用,我一直收到“在轮询期间未收到任何消息,返回‘false’”。这种配置有什么问题

<int-jms:inbound-channel-adapter id="keepAlivePoller" channel="keepAliveChannel" destination="keepAlive" connection-factory="connectionFactory"> 
        <si:poller id="sendPoller"  fixed-rate="${keepalive.sendinterval}" max-messages-per-poll="1"></si:poller>
    </int-jms:inbound-channel-adapter>

    <si:service-activator input-channel="keepAliveChannel" method="sendMessage" ref="keepAliveSender"/>
    <bean class="com.foo.KeepAliveSender"/>

    <si:channel id="keepAliveChannel"/>

仅当“keepAlive”队列中有消息时才会发送消息

你可以简单地使用

<int:inbound-channel-adapter id="keepAlivePoller" channel="keepAliveChannel"
        expression="'foo'"> 
    <si:poller id="sendPoller"  fixed-rate="${keepalive.sendinterval}" />
</int:inbound-channel-adapter>


。。。而且根本不使用JMS。

你能说明这些“此解决方案不起作用的某些原因”吗?当然:)我一直得到[PollingConsumer][AbstractTransactionSynchronizingPollingEndpoint.java][DEBUG][task scheduler-1]在轮询期间没有收到任何消息,每隔N秒返回一次“false”[PollingConsumer]。此解决方案实际上是有效的。我需要使用JMS,因为一个单独的模块将消息发送到ActiveMQ代理,另一个模块接收消息。是的,但只有当
keepAlive
队列中确实有消息时,它才会“工作”。你会一直收到
没有收到任何消息…
,直到有一条消息存在。我会用Spring scheduler进行排序。谢谢你的反馈。