A task in WSO2 ESB allows you to run a piece of code triggered by a timer. WSO2 ESB provides a default task implementation, which you can use to inject a message to the ESB at a scheduled interval (5000 ms). To activate the built-in task, you add it to the "Tasks" list.
You can also write your own task by creating a custom Java class that implements the
org.apache.synapse.startup.Task interface. This interface defines a single method named
execute(). For example, you could create a task that will read a text file at a specified location and place orders for stocks that are given in the text file. For more information, see Writing Tasks.
You can schedule tasks to execute periodically. After deploying a task implementation to the ESB runtime, you can use the ESB management console to schedule various instances of the task by specifying the number of times the task needs to run along with the frequency, or you can use the cron syntax. You can also use the management console to edit and delete tasks.