Hi Rajith,

'Task' is one of the artifact types in ESB. So similar to other artifact
types like proxy services, sequences, etc. task has it's own synapse
configuration.

Even you write a custom task and deploy the jar into libs directory, you
need to create a task configuration to trigger it.
Following is a sample task configuration.

<task xmlns="http://ws.apache.org/ns/synapse";
      name="inQ.taskTrigger"
      class="org.wso2.sample.SampleTask1"
      group="synapse.simple.quartz">
   <trigger interval="10"/>
   <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks";
             name="Property1"
             value="value1"/>
</task>

You can pass parameters for your custom task as a property.

I don't have a clear idea of what you are implementing, but I feel like you
can implement this scenario using the existing functionality of ESB without
writing a custom task.


Thanks.


On Wed, Apr 2, 2014 at 9:23 PM, Rajith Vitharana <[email protected]> wrote:

> Hi Gayan,
>
> Thanks for the reply. As you said its better to use cron tasks for my
> requirement. Are there any way to load those tasks to ESB configuration
> other than configuring it one by one?(for example like write a synapse
> configuration and load it) and I would like those classes to have separate
> configuration file for them. for example I need to load a Rest API url to
> those classes from a configuration file. what would be the best way to do
> this?
>
> Thanks
>
>
> On Wed, Apr 2, 2014 at 6:31 PM, Gayan Yalpathwala <[email protected]> wrote:
>
>> Hi Rajith,
>>
>> Cron style in trigger would be appropriate for your case and you can
>> still try time interval option as well. Since you are going to have a
>> number of publisher classes, you shall have different scheduled tasks
>> respectively. [1] would give you an idea about this and please refer [2]
>> for more details.
>>
>> [1]
>> <task xmlns="http://ws.apache.org/ns/synapse"; name="publisherTask1"
>> class="org.wso2.example.PublisherClass1">
>>     <trigger interval="1500"/>
>> </task>
>>
>> <task xmlns="http://ws.apache.org/ns/synapse"; name="publisherTask2"
>> class="org.wso2.example.PublisherClass2">
>>     <trigger cron="0 0 12 * * ?"/>
>> </task>
>>
>> [2]
>> http://itsmeisuru.wordpress.com/2013/11/12/wso2-esb-scheduled-task-example/
>>
>> Thanks,
>>
>>
>> On Wed, Apr 2, 2014 at 3:34 PM, Rajith Vitharana <[email protected]>wrote:
>>
>>> Hi all,
>>>
>>> I have implemented a publisher class which will pull data from some Rest
>>> API and publish those data to a BAM instance. There are more than one Rest
>>> API and I hope to develop separate publisher classes for each Rest API
>>> since I need to schedule them in different time intervals. For the time
>>> being I have developed this as a full standalone applications with using
>>> "quartz" to schedule the tasks. But I need to move this in to a server
>>> instead of being standalone application. I found [1] in google which
>>> describes how to schedule tasks in WSO2 ESB. would this be the correct
>>> approach for this? appreciate any guidance.
>>>
>>> [1] -
>>> https://docs.wso2.org/display/ESB470/Adding+and+Scheduling+Tasks#AddingandSchedulingTasks-cronstyle
>>>
>>> Thanks,
>>>
>>> --
>>> Rajith Vitharana
>>>
>>> Software Engineer,
>>> WSO2 Inc. : wso2.com
>>> Mobile : +94715883223
>>> Blog : http://lankavitharana.blogspot.com/
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Gayan Kaushalya Yalpathwala*
>>  Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 71 8682704 <http://asia14.wso2con.com/>
>>
>>  <http://asia14.wso2con.com/>
>>
>
>
>
> --
> Rajith Vitharana
>
> Software Engineer,
> WSO2 Inc. : wso2.com
> Mobile : +94715883223
> Blog : http://lankavitharana.blogspot.com/
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Isuru Udana*
Senior
* Software Engineer*
WSO2 Inc.; http://wso2.com
email: [email protected] cell: +94 77 3791887
blog: http://mytecheye.blogspot.com/
twitter: http://twitter.com/isudana
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to