>From what I've seen, everyone uses their own job implementation. Ex: BAM uses AnalyzerJob.class
The pain points maybe coming from re-using scheduled tasks. It does not seem to work in an OSGI environment, without having Synapse. Because we do not directly use synapse tasks, we re-use scheduled-tasks. I feel defining the carbon-tasks feature alone, will fix the problem. According to your explanation, Carbon tasks may have a dependency to synapse-core, so that it can use SimpleQuartzJob. On Sat, Oct 1, 2011 at 11:41 PM, Hiranya Jayathilaka <[email protected]>wrote: > I just tried to develop a little Java program using the Synapse tasks > module (just a learning exercise to see where the pain points are). However > I was able to do it without much of a hassle and without adding any Synapse > libraries except for the synapse-tasks.jar. Here's my code in the main > method: > > TaskScheduler scheduler = new TaskScheduler("scheduler1"); > scheduler.init(new Properties()); > scheduler.start(); > TaskDescription desc = new TaskDescription(); > desc.setName("task1"); > desc.setInterval(2000); > scheduler.scheduleTask(desc, new HashMap<String,Object>(), *TestJob.class*, > *new MyTask()*); > > Here TestJob is an implementation of the Quartz Job interface. MyTask is an > implementation of the Task interface from Synapse. All other Task* classes > are from Synapse tasks module. Libraries in my classpath are: > > - synapse-tasks > - quartz > - commons-logging > - geronimo-jta (Quartz dependency) > - commons-collections (Quartz dependency) > > So it's not that bad after all. I think the trick here is I'm using my own > Job implementation. The default implementation that comes with Synapse > (SimpleQuartzJob) is in the synapse-core module and if you try to use that > you will have to add a whole bunch of other Synapse related stuff. I don't > think anything other than Synapse are supposed to use it since it clearly > has some Synapse specific stuff in there. We use that as the bridge between > Synapse and Quartz. > > I think any component trying to use the Synapse tasks component should > simply write their own Job implementation and use the framework provided by > Synapse tasks component to run it. You can put any component specific logic > in the Job impl. Here's my Job implementation BTW (used in above example): > > public void execute(JobExecutionContext ctx) throws JobExecutionException { > Task task = (Task) > ctx.getMergedJobDataMap().get(TaskDescription.INSTANCE); > task.execute(); > } > > What are the other issues faced while trying to use the Synapse tasks > component? > > Thanks, > Hiranya > > On Sat, Oct 1, 2011 at 10:47 PM, Tharindu Mathew <[email protected]>wrote: > >> >> >> On Sat, Oct 1, 2011 at 10:17 PM, Hiranya Jayathilaka <[email protected]>wrote: >> >>> >>> >>> On Sat, Oct 1, 2011 at 7:38 PM, Anjana Fernando <[email protected]> wrote: >>> >>>> Hiranya agreed to refactor the Synapse tasks component to have a simpler >>>> API, which will make it more easier to use. >>> >>> >>> Yes will get started on this asap. >>> >>> Great! >> >>> Thanks, >>> Hiranya >>> >>> >>>> I'm also looking into creating a "coordination" component, by using >>>> Apache ZooKeeper, to do the coordination scenarios in a cluster, which are >>>> required in situations like scheduling a task. >>>> >>>> These efforts can be parellel, i.e. making it self contained will >> actually help after the task tracker component as well, otherwise you will >> have to inclue all of synapse as well, just to get task dependencies. >> >>> Cheers, >>>> Anjana. >>>> >>>> >>>> On Sat, Oct 1, 2011 at 1:27 PM, Tharindu Mathew <[email protected]>wrote: >>>> >>>>> >>>>> >>>>> On Sat, Oct 1, 2011 at 1:18 PM, Samisa Abeysinghe <[email protected]>wrote: >>>>> >>>>>> >>>>>> >>>>>> On Sat, Oct 1, 2011 at 1:03 PM, Tharindu Mathew <[email protected]>wrote: >>>>>> >>>>>>> Hi ESB folks, >>>>>>> >>>>>>> Right now, if we just import the carbon.task.server feature, the >>>>>>> tasks do not start up during run time due to unsatisfied dependencies. >>>>>>> >>>>>>> So, we have to import whole of synapse as well just to make tasks >>>>>>> work. So, can we do $subject urgently? >>>>>>> >>>>>> >>>>>> This I thought was done by the new Carbon task component in the >>>>>> making. What is the ETA for that? >>>>>> >>>>>> AFAIU, the new tasks component, still would have the same problem >>>>> since it will use synapse tasks. If we can make synapse tasks and >>>>> scheduled-tasks (carbon tasks) self contained, the problem would be >>>>> solved. >>>>> >>>>> IIRC, the ETA for the new component is the next major release. >>>>> >>>>>> Thanks, >>>>>> Samisa... >>>>>> >>>>>> Samisa Abeysinghe >>>>>> VP Engineering >>>>>> WSO2 Inc. >>>>>> http://wso2.com >>>>>> http://wso2.org >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Carbon-dev mailing list >>>>>> [email protected] >>>>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Regards, >>>>> >>>>> Tharindu >>>>> >>>>> blog: http://mackiemathew.com/ >>>>> >>>>> >>>> >>>> >>>> -- >>>> *Anjana Fernando* >>>> Senior Software Engineer >>>> WSO2 Inc. | http://wso2.com >>>> lean . enterprise . middleware >>>> >>>> _______________________________________________ >>>> Carbon-dev mailing list >>>> [email protected] >>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >>>> >>>> >>> >>> >>> -- >>> Hiranya Jayathilaka >>> Associate Technical Lead; >>> WSO2 Inc.; http://wso2.org >>> E-mail: [email protected]; Mobile: +94 77 633 3491 >>> Blog: http://techfeast-hiranya.blogspot.com >>> >> >> >> >> -- >> Regards, >> >> Tharindu >> >> blog: http://mackiemathew.com/ >> >> > > > -- > Hiranya Jayathilaka > Associate Technical Lead; > WSO2 Inc.; http://wso2.org > E-mail: [email protected]; Mobile: +94 77 633 3491 > Blog: http://techfeast-hiranya.blogspot.com > -- Regards, Tharindu blog: http://mackiemathew.com/
_______________________________________________ Carbon-dev mailing list [email protected] http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
