
Hi,
What is the best solution to execute mule jobs in a synchrone mode from an external job scheduler(or using command line).
thanks in advance,
Pascal.
Flow which you want to execute from external Job Scheduler,
1. Make the initial state of your flow as "stopped", this will be started from external rest or http hit.
2. We can create another flow which will listen to http call with specifice uri param which you will using to start the flow specified in step 1
3. Use the mule registry to check the state of the flow specified in step 1
if (# [message.inboundProperties.'http.query.params'.yourURIParam] == "start" && muleContext.registry.lookupFlowConstruct('yourFlow').isStopped())
{
muleContext.registry.lookupFlowConstruct('yourFlow').start();
}
5. Start the flow using mule registry
6. Stop the flow using mule registry once your task is done.
You can write a shell script which can trigger your flow passing the required param, as were are using Dollar Universe of Scheduling.
I do not remember from where I got this originally from, modified after playing around to meet my requirement.