如何在mule中聚合入站JMS消息
我从activeMQ接收到两条JMS消息如何在mule中聚合入站JMS消息,jms,mule,activemq,Jms,Mule,Activemq,我从activeMQ接收到两条JMS消息 <flow name="clientoneFlow1" doc:name="clientoneFlow1"> <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="client1" doc:name="HTTP"/> <component class="SalesOrder" doc:name=
<flow name="clientoneFlow1" doc:name="clientoneFlow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="client1" doc:name="HTTP"/>
<component class="SalesOrder" doc:name="Java"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<jms:outbound-endpoint queue="ReadOrder1" connector-ref="Active_MQ" doc:name="JMS">
<jms:object-to-jmsmessage-transformer doc:name="Object to JMSMessage"/>
</jms:outbound-endpoint>
</flow>
<flow name="clienttwoFlow1" doc:name="clienttwoFlow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="client2" doc:name="HTTP"/>
<component class="SalesOrder2" doc:name="Java"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<jms:outbound-endpoint queue="ReadOrder1" connector-ref="Active_MQ" doc:name="JMS">
<jms:object-to-jmsmessage-transformer doc:name="Object to JMSMessage"/>
</jms:outbound-endpoint>
</flow>
<flow name="integration-flow" doc:name="integration-Flow1" processingStrategy="synchronous">
<jms:inbound-endpoint queue="ReadOrder1" connector-ref="Active_MQ" doc:name="JMS"/>
<vm:outbound-endpoint exchange-pattern="request-response" path="vm" doc:name="VM"/>
<logger message="ending paylaod = #[payload]" level="INFO" doc:name="Logger"/>
</flow>
<flow name="integration-flow2" doc:name="integration-Flow2">
<vm:inbound-endpoint exchange-pattern="request-response" path="vm" doc:name="VM"/>
<collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/>
</flow>
如何聚合传入的消息?我正在使用一个收集聚合器,我一直在收到消息=
未设置相关性组大小,但正在使用相关性聚合器。消息正在按原样转发
消息是一个JSON[{“salesOrderId”:“00001-2-3”,“saleName”:“汽车销售”,“状态”:“处理”}]我看到了流程中的一些问题。。在流clientoneFlow1和clienttwoFlow1中,您使用http入站端点并分别点击url来启动流,将消息分派到queue=“ReadOrder1” 但是在这里,只要消息由一个流传递到queue=“ReadOrder1”,集成流就会开始,消息将再次发送到integration-flow2,在那里它被收集聚合器接收,它不会等待其他流获取消息(因为您需要点击其他流的url才能启动它) 因此..在这里,您可以使流clientoneFlow1和clienttwoFlow1几乎并行执行,并几乎同时将消息发送到集合聚合器 因此,有一种方法可以通过使用“分散”和“聚集”组件来实现,而无需使用收集聚合器 来自所有流的所有消息将在流结束时自动聚合 例如,您可以在此处执行以下操作:-
<flow name="fork" doc:name="fork">
<http:inbound-endpoint host="localhost" port="8090" path="scattergather" exchange-pattern="request-response" doc:name="HTTP"/>
<scatter-gather timeout="6000">
<!-- Calling clientoneFlow1-->
<flow-ref name="clientoneFlow1" doc:name="Flow Reference"/>
<!-- Calling clienttwoFlow1-->
<flow-ref name="clienttwoFlow1" doc:name="Flow Reference"/>
</scatter-gather>
<logger level="INFO" message="Combined Payload: #[message.payload]" doc:name="Logger"/>
<logger level="INFO" message="Payload1 of clientoneFlow1 : #[message.payload[0]] and clienttwoFlow1: #[message.payload[1]] " doc:name="Logger"/>
</flow>
<flow name="clientoneFlow1" doc:name="clientoneFlow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="client1" doc:name="HTTP"/>
<component class="SalesOrder" doc:name="Java"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
<flow name="clienttwoFlow1" doc:name="clienttwoFlow1">
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" path="client2" doc:name="HTTP"/>
<component class="SalesOrder2" doc:name="Java"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
现在,这是从两个流实现组合有效负载的最简单方法,而不会使其变得如此复杂。我只能在流中看到一个“jms:inbound endpoint”.第二个jms在哪里?您好,谢谢您的回复,我已经添加了jms Outbound,但您说需要聚合2条jms消息。.在这里,我只能看到来自的1条jms消息queue=“ReadOrder1”啊,对不起,我明白你的意思了,我已经更新了流程