1. Using Open source Quartz scheduler.
2. Scheduling your process from Database using dbms_scheduler apis.
In Oracle BPEL open source job scheduler, Quartz is implemented as part of java class called DefaultSchedulerCalloutImpl. Incase your BPEL process is triggered by a file/ftp adapter you can modify the bpel.xml file to make use of the quartz scheduler.
<activationAgents> <activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="ReadFile" heartBeatInterval="10"> <property name="portType">Read_ptt</property> <property name="schedulerCallout">DefaultSchedulerCalloutImpl</property> <property name="endpointScheduleOn">0 0 8 * * ?</property> <property name="endpointScheduleOff">0 0 10 * * ?</property> </activationAgent> </activationAgents>
The above piece of code is direction to the activation agent to activate the BPEL process between 8 and 10 am everyday and heartbeat interval of 10 seconds indicates how frequently the process is active for polling.
The 2nd approach is a simple solution based on Oracle dbms_scheduler api. Basically you need to have your BPEL process read from a DB table which gets populated by the DBMS job at a particular frequency. I am sharing some sample code below which can be reused after making modifications.
Create table bpelschedulertable (process_name varchar2(20));
Script to create the scheduler job.
/* Drop Jobs if they exist */ BEGIN DBMS_SCHEDULER.DROP_JOB(JOB_NAME => 'BpelScheduledJob'); END; / /* Create Scheduled Job */ BEGIN DBMS_SCHEDULER.CREATE_JOB( JOB_NAME => 'BpelScheduledJob', JOB_TYPE => 'PLSQL_BLOCK', JOB_ACTION => 'BEGIN INSERT INTO bpelschedulertable (PROCESS_NAME) VALUES (''samplebpel'');COMMIT;END;', START_DATE => TO_DATE('2010-08-18 12:00:00','YYYY-MM-DD HH24:MI:SS'), REPEAT_INTERVAL => 'FREQ=MINUTELY;INTERVAL=15', COMMENTS => 'Scheduled for every 15 minutes'); DBMS_SCHEDULER.ENABLE(NAME => 'BpelScheduledJob'); END; /
That's it ! Your BPEL process(samplebpel) should trigger every 15 minutues now.
Scripts to monitor/manage the scheduled job.
select * from dba_scheduler_jobs ; /*Command to enable job*/ Begin dbms_scheduler.enable('BpelScheduledJob'); end; /*Command to disable job*/ Begin Dbms_scheduler.Disable('BpelScheduledJob'); end; /*Command to change the repeat interval of the job*/ Begin Dbms_scheduler.set_attribute(name=>'BpelScheduledJob',attribute=> 'REPEAT_INTERVAL', value=> 'FREQ=HOURLY;INTERVAL=1'); end;
nice post..
ReplyDeleteReally very nice post.
ReplyDeleteHow to use same Quartz scheduling in SOA 11g[11.1.1.x]? In BPEL 11g there is no bpel.xml...
Thanks,
Avi
@Avi
ReplyDeleteI haven't used Quartz scheduler in SOA 11g, so not sure about supportability of the activation agent parameters in composite.xml.
However you can check below blog entries for more info./alternatives of using Quartz scheduling mechanism in SOA 11g.
http://blogs.oracle.com/sdhurjati/2011/01/ready_to_use_quartz_scheduler.html
http://blogs.oracle.com/sdhurjati/2011/01/enahced_ready_to_use_quartz_sc.html
hi
ReplyDeletecan you please elaborate in a step by step manner with logical explanation in regards with using dbms_scheduler,couldn't get how will the database invoke the process and how will it recognise the bpel process.can u please throw some more light on it
All that the dbms_Scheduler api is doing is running some PLSQL code to insert some data into a table, next the BPEL process is configured (Receive activity is a DB adapter) to poll this table. So as and when the scheduler will run and insert a record into the table, an instance of BPEL process is triggered
DeleteRubicon Red has a Scheduler designed specifically for the Oracle SOA Suite. We have just announced the beta release of version 2.0.
ReplyDeleteDesigned specifically as an extension to Oracle SOA Suite, the Rubicon Red Scheduler provides the ability schedule the execution of Web Services, BPEL Processes and the publication of EDN Events.
If you are interested in signing up for the Beta please see the following link.
http://www.rubiconred.com/news/rubicon-red-announces-beta-release-of-scheduler-2-0/
Thanks Matt will definitely check it out
Delete