本文介绍了ule子处理策略-从同步流中调用异步私有流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从主同步流中调用异步私有流,如下所示:

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:

无法异步处理同步事件.消息有效负载的类型为:字符串(org.mule.api.MessagingException)

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

这是怎么回事?

更新

如果我将异步流引用包装在<async>标签中,则可以使用.但是,为什么我需要这样做?是虫子吗?

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

推荐答案

这是一个功能.

您处于显式同步流中,请尝试调用显式异步流.异步流的响应将永远不会返回到调用者流.因此,有丢失消息的可能性.因此,Mule迫使您保持露骨,并使用<async>标签进行包装.

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.

这篇关于ule子处理策略-从同步流中调用异步私有流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 05:43