聚合来自两个不同使用者的两条JMS消息

聚合来自两个不同使用者的两条JMS消息,jms,mule,aggregate,Jms,Mule,Aggregate,我有两个jms使用者,每个使用者位于不同的流中。我想使用另一个流来聚合这两条消息的消息。还需要保留相关ID,因为我需要分割负载并发回消息 <flow name="integration-consumer-client1" doc:name="integration-consumer-client1"> <jms:inbound-endpoint doc:name="JMS" connector-ref="Active_MQ" queue="client1.pub

我有两个jms使用者,每个使用者位于不同的流中。我想使用另一个流来聚合这两条消息的消息。还需要保留相关ID,因为我需要分割负载并发回消息

    <flow name="integration-consumer-client1" doc:name="integration-consumer-client1">
    <jms:inbound-endpoint doc:name="JMS" connector-ref="Active_MQ" queue="client1.publish"/>
    <logger message="Consumes Client One = #[payload]" level="INFO" doc:name="Logger"/>
    <logger message="Client One Correlation = #[message.correlationId]" level="INFO" doc:name="Logger"/>
    <vm:outbound-endpoint exchange-pattern="one-way" path="client1" doc:name="VM"/>
</flow>
<flow name="integration-consumer-client2" doc:name="integration-consumer-client2">
    <jms:inbound-endpoint doc:name="JMS" connector-ref="Active_MQ" queue="client2.publish"/>
    <logger message="Consumes Client Two = #[payload]" level="INFO" doc:name="Logger"/>
    <logger message="Client Two Correlation = #[message.correlationId]" level="INFO" doc:name="Logger"/>
    <vm:outbound-endpoint exchange-pattern="one-way" path="client2" doc:name="VM"/>
</flow>
<flow name="integration-internetsolutionsFlow1" doc:name="integration-internetsolutionsFlow1">
    <scatter-gather doc:name="Scatter-Gather">
        <vm:inbound-endpoint exchange-pattern="one-way" path="client1" doc:name="VM"/>
        <vm:inbound-endpoint exchange-pattern="one-way" path="client2" doc:name="VM"/>
    </scatter-gather>
</flow>

我尝试对两个入站VM使用“分散聚集”,但出现以下错误:

原因:org.xml.sax.SAXParseException:cvc复杂类型。2.4.a:发现以元素“vm:入站端点”开头的无效内容。应为“{”“:批注“:自定义聚合策略“”:线程配置文件“”:抽象消息处理器“”:抽象出站端点““:抽象混合内容消息处理器}”之一。
在org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(未知源)

上,错误原因是integration-internetsolutionsFlow1没有任何入站端点

您可以执行以下操作:-

使用vm:outbound endpoint从两个流到同一路径 integration-consumer-client1integration-consumer-client2

然后在集成-互联网解决方案流程1中

     <flow name="integration-internetsolutionsFlow1" doc:name="integration-internetsolutionsFlow1">
      <vm:inbound-endpoint exchange-pattern="request-response" path="Your Path" doc:name="VM" connector-ref="vmConnector" />
    <logger level="INFO" message="#[message.payload]" doc:name="Logger"/>
<!-- you don't require a setter-getter here -->
    </flow>

来自流integration-consumer-client1integration-consumer-client2的出站VM路径应该相同


你不需要在这里散聚。。因为这两个流都将有效负载分配到相同的VM路径。。它将由VM入站端点接收

感谢您的回复,我已经尝试过这种方法。问题是这两条消息需要聚合。在聚合之后,我通过jms将组合消息发送到另一个流。然后,该流编辑数据并将其发送回integration-InternetSolutionsFlow1使用MEL创建空的全局数组列表,并在VM入站端点之后将#[message.payload]添加到该列表中…然后将列表值添加到任何流中。。。检查此链接:-