Schedule a BPEL process using Database job

To create a oracle database job, which will execute one procedure at a regular interval ,eventually inserting data in a database table.

There is a BPEL process polling this table at a regular polling interval. Whenever it finds data inserted into the table it deletes it from that table and creates an instance of the BPEL process & executes as expected.

Database Section:

Table Creation:

CREATE TABLE TIMER_TABLE1 (

IDX NUMBER(10),T_CODE NUMBER(5),

XDATE DATE,

RFLAG NUMBER(1) DEFAULT 1,

CHECK (IDX IS NOT NULL) VALIDATE,

PRIMARY KEY (IDX) VALIDATE );

Sequence Creation:

CREATE SEQUENCE customers_seq

START WITH 1000

INCREMENT BY 1

NOCACHE

NOCYCLE;

Package Creation:

CREATE OR REPLACE PACKAGE TIMER_PCK1 AS

PROCEDURE TIMER_PROC1;

END;

CREATE OR REPLACE PACKAGE BODY TIMER_PCK1 AS

PROCEDURE TIMER_PROC1 IS

BEGIN

insert into timer_table1(IDX,T_CODE,XDATE) values(customers_seq.nextval,123,sysdate);

end;

END;

Create Database Job:

BEGIN

DBMS_SCHEDULER.CREATE_JOB (

job_name => ‘MY_JOB_3’,

job_type => ‘STORED_PROCEDURE’,

job_action => ‘TIMER_PCK1.TIMER_PROC1’,

start_date => SYSTIMESTAMP,

repeat_interval => ‘FREQ=MINUTELY;INTERVAL=1’,

end_date => NULL,

job_class => ‘DEFAULT_JOB_CLASS’,

enabled => TRUE,

comments => ‘My new job’);

END;

Drop Database Job: (If required)

BEGIN

DBMS_SCHEDULER.DROP_JOB (

job_name => ‘MY_JOB_3’);

END;

BPEL Section:

There are two BPEL Process:

1) BPELInvokeProcess : Synchronous process to be invoked

2) BPELSchedule : This process will listen poll database table.Once it finds data in table an instance of this process will be created which in turn will invoke BPELInvokeProcess.

Configure Db Polling in BPEL:

Below given are the steps to configure db adapter in BEPL for polling purpose.

dbpoll1.jpg

dbpool2.jpg

dbpool3

dbpool4

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s