首页 文章

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

提问于
浏览
0

我有两个jms消费者,每个消费者都有不同的流程 . 我想使用另一个流来聚合这两条消息的消息 . 并且还需要保持相关性Ids,因为我需要拆分有效载荷并发回消息 .

<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-complex-type.2.4.a:找到以元素'vm:inbound-endpoint'开头的无效内容 . 其中一个'{“http://www.mulesoft.org/schema/mule/core ":annotations, " ":custom-aggregation-strategy, " http://www.mulesoft.org/schema/mule/core ":threading-profile, " http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-outbound-endpoint, " http://www.mulesoft.org/schema/mule/core”:abstract-mixed-content-message-processor}'是预期的 . at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

1 回答

  • 1

    错误的原因是 integration-internetsolutionsFlow1 没有任何入站 endpoints ..

    你可以做的是: -

    从流 integration-consumer-client1integration-consumer-client2 使用vm:outbound-endpoint到 same path

    然后在 integration-internetsolutionsFlow1

    <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入站 endpoints 接收

相关问题