Starting a BPEL process instance according to a timed schedule in Oracle BPEL PM


Process instances in the Oracle BPEL PM can be initiated in a number of ways. Some are passive – the BPEL engine receives a call and as a result starts a new instance of the referenced process – while others are more active – the BPEL engine looks for events that it knows should trigger a new process instance. I am wondering if there is sort of an intermediate option, where the BPEL PM will start process instances according to a specific schedule, like every week on Sunday evening or every 5 minutes or so. In this article I will briefly go over the different ways to get a process instance started and some approaches todo it in a scheduled way. However, I am still looking for perhaps a built-in scheduler.....

Actively invoking a BPEL Process according to a schedule 

A BPEL process is published by the Oracle BPEL PM as a WebService. Anyone who can a webservice therefore can start a BPEL Process instance. Invoking WebServices can be done from many programming languages and run-time environments, including Java and PL/SQL. Both Java and PL/SQL have various options of scheduling jobs, for example using Java Timers or the Quartz framework, possibly in combination with Spring, or the DBMS_JOB or DBMS_SCHEDULER functionality in the Oracle database. The scheduled Java or PL/SQL program can make the call to the WebService end-point for the BPEL Process. In the resources you will find articles that describe how to set up ‘timed triggers’ in both Java containers and the Oracle database.

Oracle BPEL PM also provides an EJB style interfaces for many operations, including the call to a BPEL process. So instead of calling the BPEL process as WebService, we could invoke it as a Java method on a Session Bean. See for example: Calling into the Oracle BPEL Engine from Java.

Indirectly activating a BPEL Process from events – that occur according to a schedule

Oracle BPEL PM is more than a passive consumer of requests for process instantiation. It also can go out and actively look for reasons for creating a new process instance. The events that can cause a process instance to be instantiated by Oracle BPEL PM include:

  • reception of an Email
  • arrival of a file – on a file system or an FTP server
  • creation of a new or update of an existing database record

Each of these channels can be polled by the Oracle BPEL PM for specific occurrences. Using the respective adapter wizards in the BPEL Designer in JDeveloper, we can specify the polling interval as well as the configuration details (which emailserver and email-account, which directory, which table etc.). Thus we can for example have a BPEL process that is instantiated whenever a database record is found in certain table satisfying a certain query-condition.

It is very simple for a PL/SQL developer to create a job that is to run say every 5 minutes (or every other week on Saturday morning or whatever simple or complex scheduling logic you desire) that creates (or updates) a record in a table. If we then configure the BPEL process to poll every 5 minutes (or 5 seconds or 7 days) looking in that particular table for that record, we have scheduled our BPEL process by using a database job schedule without going to the trouble of calling the BPEL PM from the database.

Come to think of it: if we configure the BPEL process to poll for a record in DUAL, we probably do not need the database job at all!

Along the same lines, we can create external scheduling logic that provides events to trigger a BPEL Process instance by sending emails or creating files.

Note that the BPEL Process we set up to poll for database records, emails or files could in fact be a dispatcher that inspects the contents of the database record, email or file and the decides to invoke a specific BPEL Process. Of course it is tricky to pass meaningful input into these processes as the events that trigger them are generic and only different in terms of the time they get started.

Using a long-running BPEL Process with WAIT step to trigger other BPEL processes according to a schedule

One other approach, following from the last train of thought of having a Dispatcher type of BPEL process is the following – also described by Clemens Utschig I just found out -: create a BPEL Process with no other purpose than to start instances of one (or more) other BPEL Processes. This BPEL Process has no input parameters, no output and but a single instance. It has a single WHILE loop that has two steps:

  • wait – for as long as the interval between two scheduled process instances
  • invoke – the BPEL process you want to have instantiated

We  can probably make this a more advanced scheduling implementation by having a way to dynamically derive the wait time – using embedded or external logic – or adding conditions for invoking the BPEL process.


As a database programmer at heart, I think the quickest way to get a BPEL process started according to a potentially complex schedule with minimum coding effort would be using a database job (Schedule) that updates a database record in conjunction with a BPEL process that polls the database. The big disadvantage, apart from the slight overhead of regularly polling the database by the BPEL PM, is the split of process logic between the database and the BPEL PM. For simple schedules, I would probably use the option of creating a BPEL Process Dispatcher process with the WHILE-WAIT-INVOKE logic.


Job Scheduling in Java by Dejan Bosanac

Scheduling and Thread Pooling using Spring  (the Spring Framework documentation)

How-To: Use a container-managed Timer service in EJB – an Oracle OC4J 10.1.3 How To

Using Timers in J2EE Applications by Debu Panda

Running BPEL service as a scheduled process… OTN Discussion Forum thread

BPEL: Scheduling reoccuring processes from Clement Utschig’s blog – (found round the time I had completed my own article)

Job Scheduling from Oracle 10g with DBMS_SCHEDULER –

Oracle 10gR2 Database Administrator’s Guide – Moving from DBMS_JOB to DBMS_SCHEDULER



About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.


  1. wouldnt it be a disadvantage to use a while loop versus using external scheduler like quartz, because a while loop needs to be completely persisted in the db…so even if the scheduling is ‘simple’ it would have a huge overhead over time, and keep filling the orabpel tables?

  2. Peter Lorenzen on

    Thanks Eric. Yes you need a receive or pick to create the instance. I was hoping for a hack or tip to get around this. :-)

    Regards Pete

  3. Peter,

    I think you still need some initial activity to start the proces with (either a receive or pick), after this your bpel-process can be something which runs for ages. But i guess you always need some initial activity to do the first kick-off

  4. Peter Lorenzen on

    Hi Lucas,

    I would love to create a BPEL Process Dispatcher process with WHILE-WAIT-INVOKE logic. When I try I get this error: “Initial activity is invalid. An initial activity must be of a receive or pick activity”. How do I get around this?

    Regards Pete