设置:
我正在使用Spring Integration从消息队列中抓取消息。消息以XML格式出现,我的服务激活器调用一个名为parseCustPaymentXML的方法,处理该XML消息,并将其存储在Java对象中。然后,从parseCustPaymentXML调用另一个名为processCustPayment的方法,该方法获取Java对象并将它们插入到数据库中。下面是我如何设置我的入站JMS和服务激活器...
<int:channel id="jmsInChannel" />
<int-jms:message-driven-channel-adapter
destination="custPaymentRequestDestination"
connection-factory="jmsConnectionFactory"
channel="jmsInChannel"
concurrent-consumers="1" />
<int:service-activator id="parseCustPaymentServiceActivator"
ref="custPaymentService"
input-channel="jmsInChannel"
method="parseCustPaymentXML"
requires-reply="true" />
问题是:
该进程不会花费很长时间来运行,但如果在parseCustPaymentXML或processCustPayment仍在运行时收到一条消息,则会拉出该消息,并与第一个消息进程并发地踢开parseCustPaymentXML。这不是我喜欢的行为。我希望第一条消息在下一条消息开始(非并发)之前完全完成。
如果需要更多的帮助信息,请告诉我。
发布于 2015-06-04 15:39:43
当并发消费者=“1”时,一次只处理一条消息;请确保您没有两次声明入站适配器?这是一个常见的错误--尤其是在web应用程序中。
打开调试日志,一切都会变得清晰
https://stackoverflow.com/questions/30645483
复制