I keep one of my flow say 'flow A' in "stopped" as a initial state. Then in another flow say 'flow B', using groovy script or MEL expression; I am starting the same 'flow A'. At the end of the 'flow A', I am programmatically stopping the flow.
Now, If I again start the 'flow A' through 'flow B' it fails saying 'flow A' is already started; can not be restarted.
Any solution for this.
I want to start my flow any time I want, keeping initial state as stopped & again at the end stopping the flow using script.
Here is the code:
<flow name="FlowB">
<poll doc:name="Poll">
<logger level="INFO" doc:name="Logger"/>
</poll>
<logger level="INFO" doc:name="Logger" message="triggered"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[muleContext.registry.lookupFlowConstruct('FlowB').start()]]></scripting:script>
</scripting:component>
<logger level="INFO" doc:name="Logger"/>
<expression-component doc:name="Expression"><![CDATA[app.registry.FlowA.stop();]]></expression-component>
</flow>
<flow name="FlowA" initialState="stopped">
<sqs:receive-messages config-ref="Amazon_SQS__Configuration" doc:name="Amazon SQS (Streaming)"/>
<logger level="INFO" doc:name="Logger"/>
</flow>
I am using poller to start the flow A. So, if I again run the flow B to start the flow A; Its throwing an exception.