Starting a mule flow programmatically using groovy

groovy, mule

Solution

This should do it:

<scripting:component>
    <scripting:script engine="groovy">
        muleContext.registry.lookupFlowConstruct('targetFlow').start()
    </scripting:script>
</scripting:component>

Problem

I need to control the execution of a flow manually through a HTTP call. I have been told I can disable the flow from executing during startup using the `initialState="stopped"` attribute on the flow. (How to stop a mule flow from running after startup) I need to know how to start the flow back using a groovy script. Using mule 3.2.2.

Original source