Thursday, December 16, 2010

CommonJ timer with OSB, SOA Suite, SOA Scheduler

an excellent document on SOA Scheduler here:

http://www.oracle.com/technetwork/middleware/soasuite/learnmore/soascheduler-186798.pdf


I have tested it and it works beautifully! You can specify the cron parameters in a single place. Of course it can be improved but it's a good starting point.
Here the code (I hope Robert Baumgartner doesn't mind).
I feel it would be better to have the Scheduler post an EDN event using
oracle.integration.platform.blocks.event.SendEvent and wake up a Mediator instance,
rather than synchronously invoke the WS to trigger the BPEL process.

This SendEvent class is in C:\Oracle1\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar
Unfortunately it looks like the only way to use it is by invoking its main(...) procedure after having set the System properties with: dbconn,dbuser, dbpass, eventName, eventBody,event parameters. Internally it uses a SAQRemoteBusinessEventConnectionFactory and a BusinessEventBuilder. All this make it a bit complicated to generate events programmatically.


here is CommonJ doc:

http://download.oracle.com/docs/cd/E12840_01/wls/docs103/commonj/commonj.html with coverage of "cluster-wide" timers.


Here the excellent tutorial by James Bayer:
http://blogs.oracle.com/jamesbayer/2007/11/weblogic_scheduling_a_polling.html

and more here:
http://blogs.oracle.com/jamesbayer/2009/04/a_simple_job_scheduler_example.html


and a very nice tutorial on CommonJ TimerManager here
http://middlewaremagic.com/weblogic/?p=987

here the code


Other alternatives:

EJB 3.0 Timer:
http://www.javabeat.net/articles/3-ejb-30-timer-services-an-overview-1.html

more specifically in a cluster:
http://shaoxiongyang.blogspot.com/2010/10/how-to-use-ejb-3-timer-in-weblogic-10.html


I really feel a pain comparing the SOA Suite support for scheduling with the one offered by Apache Camel:
http://camel.apache.org/quartz.html



(17-Jan-2011) I discover there is a PICK activity in BPEL allowing you to schedule a BPEL process at given interval. This is most likely the simplest solution:

http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/events.htm#CHDECBGD


1 comment:

Matt said...

Rubicon Red provide an out of the box scheduler for the Oracle SOA Suite, enabling you to schedule:

- Execution of a synchronous web service
- Execution of one way or two way asynchronous web service
- Publication of an EDN event to the SOA Suite Event Delivery Network

See http://www.rubiconred.com/scheduler for further details