Mule processing strategies - call async private flow from synchronous flow

a 夏天 提交于 2019-12-23 12:27:33

问题


I am trying to call an async private flow from a main synchronous flow like so:

<flow name="main" doc:name="main" processingStrategy="synchronous">
    <poll frequency="10000">
        <set-payload value="main"></set-payload>
    </poll>

    <flow-ref name="async-private" />
    <flow-ref name="private" />

</flow>
<flow name="private" processingStrategy="synchronous">
    <logger level="ERROR" message="sync" />
</flow>

<flow name="async-private" processingStrategy="asynchronous">
    <logger level="ERROR" message="async" />
</flow>

But it does not work and results in the following exception:

Unable to process a synchronous event asynchronously. Message payload is of type: String (org.mule.api.MessagingException)

What is going on here?

UPDATE

It works if I wrap the async flow-ref in <async> tags. But why do I need to do this? Is it a bug?


回答1:


This is a feature.

You are in an explicit synchronous flow and try to call an explicit asynchronous one. The response from the asynchronous flow will never make it back to the caller flow. Thus there is a potential for losing messages. Thus Mule forces you to be explicit and wrap with <async> tags.



来源:https://stackoverflow.com/questions/21998604/mule-processing-strategies-call-async-private-flow-from-synchronous-flow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!