2012-10-19 50 views
1

我需要以编程方式启动或停止来自另一个流量的流量或终点。这可以做到吗?有消息丢失的风险吗?Mule启动/停止流量/终点3.3.0

<flow name="control> 
    <vm:inbound-endpoint path="in"> 
    <script:component> 
    <!-- start/stop --> 
    </script:component> 
</flow> 

<flow name="startable-stoppable> 
    <any-transport:inbound-endpoint/> 
    <component/> 
</flow> 

回答

3

经过一番研究,我发现在我的情况下,最好的选择是启动/停止与我想控制的端点相关的连接器。

<script:component> 
    <script:script engine="groovy"> 
    muleContext.getRegistry().lookupConnector('connectorName').start() // or stop() 
    </script:script> 
</script:component> 

这种方法的缺点是与连接器相关联的所有端点都将受到影响。如果这是一个问题,每个端点都应该有自己的连接器。

0

您可以控制骡子移动使用JMX部件的生命周期:使用JConsole中找出的MBean,你需要从你的脚本组件来访问。

+0

不知道这是否是我需要的,看起来像您的解决方案过滤消息,以防止它的处理。在我的情况下,入站端点根本不应该使用消息。 – Daniel

+0

你说得对,我改变了我的回应。 –