Start/Stop Flow/Endpoint in Mule 3.3.0

南笙酒味 提交于 2019-12-19 11:24:43

问题


I need to programmatically start or stop a flow or endpoint from another flow. Can this be done? Is there risk of message loss?

<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>

回答1:


After some research I've found that the best option in my case is to start/stop the connectors associated with the endpoints I want to control.

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

A disadvantage of this approach is that all the endpoints associated with the connector will be affected. If this is a problem, every endpoint should have its own connector.




回答2:


You can control the lifecycle of Mule moving parts with JMX: use JConsole to find out what MBean you need to access from your scripted component.



来源:https://stackoverflow.com/questions/12966261/start-stop-flow-endpoint-in-mule-3-3-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!