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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With