You can't directly read variables from the deployment.toml OOB. But here is how you can do the same with a properties file.
- Create a file named
file.properties
in MI_HOME/conf
directory and add the following content
TASK_FREQUENCY=* * * * *
- Now in your task you should be able to read this property like below.
<trigger cron="$FILE:TASK_FREQUENCY"/>
<?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="$FILE: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>
Documentation here.