如何在Spring Integration中的READ ONLY模式中读取队列

时间:2014-03-27 10:09:44

标签: jms spring-integration spring-jms

当Spring集成中的消息Listener启动时,它正在拉取消息并从源队列中删除,如何停止从源队列中删除消息?

1 个答案:

答案 0 :(得分:0)

当队列中的消息出现在你手中时,让你的监听器transactional和回滚事务:

<int-jms:message-driven-channel-adapter channel="input"
        connection-factory="connectionFactory"
        transaction-manager="transactionManager"
        destination-name="MY-QUEUE"/>

<int:publish-subscribe-channel id="input" />

<int:service-activator input-channel="input" order="1" ref="service" output-channel="output"/>

<int:outbound-channel-adapter channel="input" order="1"   
        expression="T(org.springframework.transaction.interceptor.TransactionAspectSupport)
             .currentTransactionStatus().setRollbackOnly()"/>

但是这里需要了解你将如何处理队列中剩余的消息:在下一次民意调查中它可用于Listener ......

相关问题