WSO2 Micro Integrator can be configured to execute tasks periodically. According to the default task scheduling implementation in WSO2 Micro Integrator, a task can be configured to inject messages, either to a defined endpoint, to a proxy service, or a specific sequence. If required, you can use a custom task scheduling implementation.
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 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.
See the topics given below for the list of properties that can be configured when you create a Scheduled Task.
The following properties are required when creating a scheduled task.
|Task Name||Name of a scheduled task.|
|Task Implementation||The default task implementation class (
If you are want to use a custom task implementation, see the instructions on writing tasks .
The trigger type determines the task execution schedule.
The list of Micro Integrator server nodes that will run the task. You can specify the IP addresses of the required nodes.Note:
This setting can be used if you want the task to run on a selected set of nodes in a product cluster. Note that the task will only run on one of the nodes at a time. It will fail over to another node, only if the first node fails. Pinned servers will override the default task handling behavior defined at server-level (for this particular task). However, if rule-based task handling is specified at server-level, you need to ensure that the same server nodes you specify as pinned servers for the task are also specified for the task handling rule at server-level.
Task Implementation Properties¶
Listed below are the optional task implementation properties you can use when creating a scheduled task.
Specify the body of the request that should be sent when the task is executed.Note:
It is mandatory to provide a value for the message property. Therefore, even If you do not want to send a message body, you have to provide an empty payload as the value to avoid an exception being thrown.
|soapAction||This is the SOAP action to use when sending the message to the endpoint.|
If the task should send the message directly to the endpoint through the main sequence, the endpoint address should be specified. For example, if the address of the endpoint is http://localhost:9000/services/SimpleStockQuoteService , the Synapse configuration of the scheduled task will be as follows:
|injectTo||If the task is not sending the message directly to the endpoint (through the main sequence), it should be injected to proxy service or a sequence. Specify sequence , or proxy .|
If the task should inject the message to a sequence ( injectTo parameter is sequence ), enter the name of the sequence. For example, if the name of the sequence is 'SampleSequence', the synapse configuration of the scheduled task will be as follows:
If the task should inject the message to a proxy service ( injectTo parameter is proxy ), enter the name of the proxy service. For example, if the name of the proxy service is 'SampleProxy', the synapse configuration of the scheduled task will be as follows: