嗨,我是第一次骡子和开发骡子项目的新手,请帮助我。在我的主要流程中,我已经设置了可变性,我已经捕获了原始有效负载,顺便说一下我必须调用一个服务,如果服务已关闭或者必须重试3次(直到成功使用)。当它耗尽时,它必须通过第二流。无论什么可能是失败,它应该仅将原始有效载荷记录到第二流中的队列中。所以我试图在setpayload处理器中访问flowVars。但是我得到的错误就像 - [错误:无法访问:originalPayload;在类中:org.mule.el.context.MessagePropertyMapContext] [近:{... flowVars.originalPayload ....}]。请找我的xml配置
<spring:beans>
<spring:bean id="objectStore" class="org.mule.util.store.SimpleMemoryObjectStore"></spring:bean>
</spring:beans>
<vm:endpoint exchange-pattern="one-way" path="path" name="VM" doc:name="VM"></vm:endpoint>
<flow name="Flow1" doc:name="Flow1">
<file:inbound-endpoint path="C:\Users\Star Jothi\Desktop\Mule\FilePath1" responseTimeout="10000" doc:name="File"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"></byte-array-to-string-transformer>
<set-variable variableName="originalPayload" value="#[payload]" doc:name="Variable"/>
<set-payload value="#['hi']" doc:name="Set Payload"/>
<flow-ref name="Flow2" doc:name="Flow Reference"/>
</flow>
<flow name="Flow2" doc:name="Flow2">
<cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
<until-successful objectStore-ref="objectStore" maxRetries="2" secondsBetweenRetries="2" deadLetterQueue-ref="VM" doc:name="Until Successful">
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" method="POST" doc:name="HTTP"/>
</until-successful>
</flow>
<flow name="Flow3" doc:name="Flow3">
<vm:inbound-endpoint exchange-pattern="one-way" path="path" doc:name="VM"></vm:inbound-endpoint> -->
<set-payload value="#[flowVars.originalPayload]" doc:name="Set Payload"></set-payload>
<logger message="****#[payload]******" level="INFO" doc:name="Logger"></logger>
</flow>
请建议我如何在使用成功处理器之前访问flowVars并获取原始有效负载。
答案 0 :(得分:2)
第一点:
flowVars are accessd in the flow by using #[flowVars['originalPayload']]
第二点:
flowVars are lost from the Mule Message when the message crosses an endpoint.
第三点:
Until Successful is Asynchronous. So irrespective of the success of Until-Successful and HTTP outbound in First flow the Flow2 is going to get executed.
在您的方案中,您可以在First Successful路由器中使用HTTP出站和Flow2组合。
注意:First Successful不会重试。
希望这有帮助。