ule子3:控制是否允许执行流程 [英] Mule 3: Controlling whether a flow is allowed to be executed

查看:104
本文介绍了ule子3:控制是否允许执行流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前的情况:

我目前有一个具有三个流的Mule ESB应用程序,该流处理来自两个不同来源的消息,这三个流使用VM队列捆绑在一起.

I currently have a Mule ESB application with three flows which process messages originating from two different sources, these three flows are tied together using a VM queue.

流#1:

入站(端点1)->(执行消息处理和转换)->出站(端点3)

Inbound (Endpoint #1) -> (Perform message processing and transformations) -> Outbound (Endpoint #3)

流#2:

入站(端点2)->(执行消息处理和转换)->出站(端点3)

Inbound (Endpoint #2) -> (Perform message processing and transformations) -> Outbound (Endpoint #3)

流#3

入站(端点3)->(执行消息处理和转换,执行操作)->出站

Inbound (Endpoint #3) -> (Perform message processing and transformations, do stuff) -> Outbound

问题/问题:

现在我想做的是引入第四个流程Flow#4,该流程从入站端点获取状态信息,并基于此信息能够阻止Flow#3被执行/阻止其处理其入站信息消息.

Now what I want to do is introduce a fourth flow, Flow #4, that gets state information from an inbound endpoint and based off this information be able to prevent Flow #3 from ever being executed/ prevent it from processing its inbound messages.

换句话说,我理想的情况是让Flow#4在ESB应用程序启动时运行(就像所有流似乎都自动执行一样),并根据其从入站消息中获得的状态信息,阻止/允许或启用/禁用流#3永远处理来自端点#3的消息.

In other words, what I'd ideally like is to have Flow #4 run at the startup of the ESB application (like all flows seem to automatically do), and based on the state information it gets from its inbound message, prevent/ allow or enable/ disable Flow #3 from ever processing messages from Endpoint #3.

以下是我理想的要求:

要求:

  1. 必须完全能够通过m子流XML来完成,而不能额外使用POJO/自定义Java对象.
  2. 流#4必须在ESB应用程序启动时执行,并且只需要处理第一个入站消息.
  3. 理想情况下,我不希望Flow#3具有复合入站源,也不必评估每个入站消息的某些全局变量的状态.

完成我想做的最好的方法是什么?

What's the best way to accomplish what I want to do?

如果没有真正好的解决方案,那么如果我必须省略#3要求,那么实现这样的全局变量的最佳方法是什么,该全局变量在两个独立的流之间共享,而这些独立流没有被某些出站绑定在一起->入站XML配置中的终结点?我尝试使用会话属性,但是它们要求流作为子流或由端点绑定在一起.

If there is no real good solution, then if I must omit #3 requirement, then what's the best way to accomplish such a global variable that is shared between two independent flows that aren't tied together by some outbound -> inbound endpoint in the XML config? I've tried using session properties, but they require that the flows be tied together as either subflows or by an endpoint.

谢谢.

推荐答案

使用全局属性和一些MEL表达式来实现此目的:

Use a global property and a few MEL expressions to make this happen:

<global-property name="gate_open" value="true" />

<flow name="gated-flow">
    <vm:inbound-endpoint path="gated.in" />
    <expression-filter expression="#[app.registry.gate_open]" />
    ...
</flow>


<flow name="gate-controller">
    <vm:inbound-endpoint path="gate.in"  />
    <expression-component>
      app.registry.gate_open = false
    </expression-component>
</flow>

将任何消息发送到vm://gate.in将关闭门,并且gated-flow将停止处理收到的消息.

Sending any message to vm://gate.in will close the gate and gated-flow will stop processing the messages it receives.

您可以使用所需的任何协议来代替VM.

You can use any protocol you want instead of VM.

这篇关于ule子3:控制是否允许执行流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆