Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+

FAQ: Batch Job Execution Order

To account for situations in which different batch jobs may be competing for resources, you can adjust the configuration of the Batch’s Scheduling Strategy.

For example, if one batch job instance is dependent upon another’s completion, you can set the scheduling strategy to sequentially process the batch job instances according to the order in which they were created.
Non-sequential processing of dependent batch jobs could cause problems in data consistency. Be sure to set the scheduling strategy to process them sequentially.

The following sections describe how the configuration of this attribute instructs the runtime how to submit batch job instances to a resource:

Ordered Sequential Attribute

The runtime executes batch job instances sequentially, according to the order in which the runtime created them.

If the runtime creates a job instance at 12:00:00 and then creates another at 12:00:01, the runtime does not execute the second instance until the first one leaves the executable state.
This is the default value and the XML configuration does not explicitly display this schedulingStrategy’s attribute.

<batch:job jobName="testBatch">

This configuration means that the schedulingStrategy attribute is set to ORDERED_SEQUENTIAL.

Round Robin Attribute

The runtime executes batch job instance according to a random, round robin pattern.

<batch:job jobName="testBatch" schedulingStrategy="ROUND_ROBIN">
If your application uses more than one batch job, you must individually define the scheduling strategy of each batch job.
The runtime configures scheduling strategy at the batch job level, meaning that a ROUND_ROBIN or ORDERED_SEQUENTIAL configuration only applies to instances of the same batch job.
Setting all your application’s batch jobs’ scheduling strategies to ORDERED_SEQUENTIAL does not ensure that job instances created in one batch job respect the order in which job instances were created in a separate batch job. Setting the scheduling strategy only enforces the order in which the runtime processes instances of the same job.

In this topic: