问题
How do you change the 'Initial State' of a flow's configuration from 'stopped' to 'started'? I have a flow that I want to turn on only when a certain condition is met at startup.
回答1:
There is 2 ways to do in runtime:- 1) Use Groovy component to start a flow :-
<scripting:component>
<scripting:script engine="groovy">
muleContext.registry.lookupFlowConstruct('targetFlow').start()
</scripting:script>
</scripting:component>
where targetFlow is the name of the flow you need to start
or Second way is :- Use a expression component to start a flow ... here flow1 is the name of the flow to start :-
<expression-component>
app.registry.flow1.start();
</expression-component>
来源:https://stackoverflow.com/questions/23024276/changing-the-initial-state-of-a-flows-configuration-from-stopped-to-starte