有没有办法MULE_CORRELATION_ID
在通过不同 JMS 队列的消息中传播。我试过了OUTBOUND
,元素中的SESSION
范围<message-properties-transformer>
但不起作用。其他自定义属性也是如此。
作为一种解决方法,我不得不在中间流中添加消息属性。
看起来出站属性最终在接收端点的入站范围内。我们可以配置此行为吗
样品骡流:
<flow name="proxyService">
<http:inbound-endpoint address="${xxx.service.address}"
exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:xxx.wsdl"
namespace="http://xxxx.com/services/abc" service="ABCService" />
</http:inbound-endpoint>
<component class="com.xxxx.services.xxx.ABCServiceProxy" />
<choice>
<when evaluator="xpath" expression="fn:local-name(/*/*[1])='blah'">
<choice>
<when evaluator="xpath"
expression="//acord:TXLifeRequest/acord:TransType/@tc='121'">
<!-- this is asynchronous communication using correlation id -->
<message-properties-transformer scope="outbound">
<add-message-property key="MULE_CORRELATION_ID"
value="#[xpath://abc:XYZRequest/some ID]" />
</message-properties-transformer>
<request-reply >
<jms:outbound-endpoint queue="order.queue">
<message-properties-transformer scope="outbound"> <delete-message-property key="MULE_REPLYTO" />
</message-properties-transformer>
</jms:outbound-endpoint>
<jms:inbound-endpoint queue="status.queue" />
</request-reply>
</when>
<when evaluator="xpath"
<!-- other cases -->
</when>
<otherwise>
<!-- create failure response -->
<jms:outbound-endpoint queue="mviq.error.queue" />
</otherwise>
</choice>
</when>
<otherwise>
<!-- log -->
</otherwise>
</choice>
</flow>
<flow name="ProcessOrder">
<jms:inbound-endpoint queue="order.queue"
exchange-pattern="one-way" />
<!-- Storing the payload in another variable because xslt transformer will overwrite it -->
<set-variable variableName="xxxPayload" value="#[message.payload]" />
<xm:xslt-transformer xsl-file="xsl/something.xslt" />
<choice>
<when expression="'some string'">
<!-- Overwriting the current payload to original payload --> <set-payload value="#[xxxPayload]" />
<logger level="INFO"
message="payload before pushing to EMSI queue: #[payload]" />
<jms:outbound-endpoint queue="order.special.queue" />
</when>
<when expression="string 2">
<!-- other case -->
</when>
<when expression="'blah">
</when>
<otherwise>
<jms:outbound-endpoint queue="error.queue" />
</otherwise>
</choice>
</flow>
<flow name="ProcessingSpecialQueue">
<jms:inbound-endpoint queue="order.special.queue" />
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="MULE_CORRELATION_ID" value="#some value" />
</message-properties-transformer>
.... more logic
</flow>
MULE_CORRELATION_ID
在将消息发送到 之前设置order.queue
。现在我再次需要将其设置为order.special.queue
. 现在,如果我需要将消息推送到第三个 jms 队列中,则需要再次设置它。
有没有一种方法可以只设置一次相关 id 并期望它不会在后续队列中丢失。
我正在使用骡 3.3.0