Monday, May 22, 2017

How to configure scheduled task as a cron style entry in WSO2 ESB.

This article explains, how to add a CRON job to run a scheduled task for once a week. This particular example demonstrates a scheduled task to run on every Tuesday at 10:27 AM.

Please find below the CRON style to run the scheduled task every Tuesday at 10:27 AM:
0 27 10 ? * TUE *

Please find below the Task configuration which uses the above CRON style:

<task name="sampleTask"
         class="org.apache.synapse.startup.tasks.MessageInjector"
         group="synapse.simple.quartz">
      <trigger cron="0 27 10 ? * TUE *"/>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
         <test xmlns="">heloooooooo</test>
      </property>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="proxyName"
                value="testProxy"/>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="soapAction"
                value="soap11"/>
</task>

We received below logs for above task configuration:

[2017-05-23 10:27:00,004]  INFO - LogMediator To: , WSAction: soap11, SOAPAction: soap11, MessageID: urn:uuid:9689e4b5-5b8c-47bb-9cf8-c953fd5130cc, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><test>heloooooooo</test></soapenv:Body></soapenv:Envelope>


Please refer this link which is a CRON maker, for creating more CRON job expressions.


No comments:

Post a Comment