Start/Stop Flow/Endpoint in Mule 3.3.0

前端 未结 2 1888
灰色年华
灰色年华 2021-01-15 23:26

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


          


        
相关标签:
2条回答
  • 2021-01-15 23:56

    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.

    0 讨论(0)
  • 2021-01-15 23:57

    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.

    0 讨论(0)
提交回复
热议问题