1

I'm working with WSO2 and I have a task that needs to be triggered based on a system variable. I want to dynamically set the trigger interval for the task using the value of a system variable in cron expresssion. i use wso2 micro integrator

so far , i tried these variants to accomplish it

<trigger cron="${TASK_FREQUENCY}"/>
<trigger cron="{get-property('taskFrequency')}" />
<trigger cron="$system:TASK_FREQUENCY" />
<trigger cron="0 */$system:TASK_FREQUENCY * * * ?" />

second one will not work because Tasks does not support dynamic properties

i want my task automaticaly take system variable TASK_FREQUENCY , which contains cron expression and based on that expression it will sets interval how often will be task triggered

1 Answer 1

0

Try the following.

<trigger cron="$SYSTEM:TASK_FREQUENCY"/>

Complete task.

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="TestTask" xmlns="http://ws.apache.org/ns/synapse">
    <trigger cron="$SYSTEM:TASK_FREQUENCY"/>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="injectTo" value="sequence"/>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
             <m0:getQuote xmlns:m0="http://services.samples">
                <m0:request>
                   <m0:symbol>IBM</m0:symbol>
                </m0:request>
             </m0:getQuote>
          </property>
    <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="sequenceName" value="SeqMy"/>
</task>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.