我有一个接收收据的流程配置,并将收据邮寄给邮件列表中的多个收件人。收到的所有收据都保存到数据库中。此外,发送给收件人的所有邮件都会保存到数据库以生成报告。收到消息后,它们会被转换器转换,而收件人列表路由器会将消息发送到收据和邮件队列的相应JMS队列。目标是让它们同时并相互独立地进行处理。但是,在使用浏览器进行测试时,消息并不总是由向队列注册的相应处理程序处理。这种行为是不可预测的。这是我的配置:
<!--Queues and ConnectionFactory Configurations -->
<import resource="queue.definitions.xml" />
<int:channel id="requestChannel">
</int:channel>
<int:channel id="queue1" />
<int:channel id="queue2" />
<int-http:inbound-channel-adapter id="inboundRequests"
supported-methods="PUT,POST" status-code-expression=
"T(org.springframework.http.HttpStatus).ACCEPTED"
path="/receipts" channel="requestChannel">
</int-http:inbound-channel-adapter>
<int:chain input-channel="requestChannel">
<int:transformer ref="receiptTransformer" />
<int:recipient-list-router>
<int:recipient channel="queue2" />
<int:recipient channel="queue1" />
</int:recipient-list-router>
</int:chain>
<int-jms:outbound-channel-adapter id="receipt.outbound.channel"
channel="queue1" destination="receiptsQueue" />
<int-jms:outbound-channel-adapter id="mail.outbound.channel"
channel="queue2" destination="mailingQueue" />
class="org.springframework.jms.listener.
adapter.MessageListenerAdapter">
<constructor-arg>
<bean
class="com.express.ccs.MailProcessingDelegate" />
<bean id="mailingQueueListener"
</constructor-arg>
<property name="defaultListenerMethod" value="receiveMessage" />
<property name="messageConverter">
<null />
</property>
</bean>
<bean id="receiptsProcessingListener"
class="org.springframework.jms.listener.adapter
.MessageListenerAdapter">
<constructor-arg>
<bean class="com.express.ccs.ReceiptsProcessingDelegate" />
</constructor-arg>
<property name="defaultListenerMethod" value="receiveMessage" />
<property name="messageConverter">
<null />
</property>
</bean>
<bean id="mailingQueueContainer"
class="org.springframework.jms.listener.
DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="mailingQueue" />
<property name="concurrentConsumers" value="1" />
<property name="messageListener" ref="mailingQueueListener" />
</bean>
<bean id="receiptJmsContainer"
class="org.springframework.jms.listener.
DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="receiptsQueue" />
<property name="concurrentConsumers" value="1" />
<property name="messageListener"
ref="receiptsProcessingListener" />
</bean>
</beans>
ReceiptsProcessingDelegates有时会从浏览器休息客户端收到帖子,而不会在其他时间收到。 MailProcessingDelegate也是如此。因此,邮件和收据信息并不总是发送到数据库。我的配置有什么问题?我非常感谢帮助修复此配置。