如何在Mule的私有流中获取呼叫者流名称 [英] How to get caller flow name in private flow in Mule
本文介绍了如何在Mule的私有流中获取呼叫者流名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个私人流程,使用flow-ref
由许多公共流程共享.我正在寻找使用Mule 3.3.0使用MEL
在私有流中获取呼叫者流名称的方法.有可能吗?
I've a private flow which is shared by lot of public flows using flow-ref
. I'm looking to get the caller flow name in private flow, using MEL
, using Mule 3.3.0. Is that possible?
推荐答案
当通过flow-ref
调用私有流时,M子不会向事件添加任何属性,因此您的选择是:
Mule doesn't add any property to an event when it invokes a private flow via flow-ref
so your options are:
- 在调用私有流之前,使用
<set-variable>
使用流名称设置变量,并使用#[flowVars.yourVariableName]
读取该变量. - 使用呼叫流的入站端点作为告诉谁的方法.您可以使用
#[message.inboundProperties.MULE_ENDPOINT]
获取入站端点URL,或者使用#[message.inboundProperties.MULE_ORIGINATING_ENDPOINT]
获取其名称. - 创建自定义MessageProcessor "rel =" noreferrer> FlowConstructAware :这样,您将获得流名称,并能够将其自动设置为
MuleEvent
消息上的调用变量.在所有父流程中,在flow-ref
之前,将此元素与custom-processor
元素一起使用.
- Use
<set-variable>
to set a variable with the flow name before calling the private flow and read this variable with#[flowVars.yourVariableName]
. - Use the inbound endpoint of the calling flow as the way to tell who's calling. You can get either the inbound endpoint URL with
#[message.inboundProperties.MULE_ENDPOINT]
or its name with#[message.inboundProperties.MULE_ORIGINATING_ENDPOINT]
. - Create a custom MessageProcessor that implements FlowConstructAware: that way you'll get the flow name and will be able to automatically set it as an invocation variable on the
MuleEvent
's message. Use this with acustom-processor
element in all your parent flows, before theflow-ref
.
这篇关于如何在Mule的私有流中获取呼叫者流名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文