The ESB profile of WSO2 EI can be configured to execute tasks periodically. You can schedule a task to run after a time interval of 't' for an 'n' number of times, or you can schedule the task to run once when the ESB server starts. Alternatively, you can use cron expressions to have more control over how the task should be scheduled; for example, you can use a Cron expression to schedule the task to run at 10 pm on the 20th day of every month.
You can schedule a Task in the ESB profile via the following methods:
In a clustered environment, tasks are distributed among server nodes according to the round-robin method, by default. If required, you can change this default task handling behaviour so that tasks are distributed randomly, or according to a specific rule. This is a server-level setting that is configured in the
- See Configuring the Task Scheduling Component for instructions on configuring the task handling behaviour at server-level.
- You can also configure the task handling behaviour at task-level, by specifying the Pinned Servers for a task. Note that this setting overrides the server-level configuration. Also note the pinned server parameter is applicable only for tasks with co-ordination disabled.
A scheduled task will only run on one of the nodes (at a given time) in a clustered environment. The task will fail over to another node, only if the first node fails.