A common requirement is to schedule a process or service to run at regular intervals, for example, we have an account billing composite that is required to be run once every night.
The Oracle SOA Suite doesn't provide a native scheduling component, so a common approach is to implement a BPEL process that continuously loops, with the sole purpose of launching another scheduled BPEL process.
However, as the process never dies, this will result in an ever-increasing audit trail, causing the objects persisted in the database, as well as the in-memory size of the process to grow over time, which eventually will have a negative impact on the performance of the engine.
A better approach is to use a Web Service Scheduler deployed to the Oracle SOA Suite.
You will need to download the Scheduler from the Rubicon Red website, which can be found at http://www.rubiconred.com/scheduler.
Once downloaded, follow the instructions to install the Scheduler on the WebLogic server running SOA Suite.
We are going to schedule the StockService process to run every hour, on the hour. This is a process that checks the stock levels for fast-selling titles and raises alerts if they are falling too low.
For the purpose of this demo, we have included a light-weight application, called StockApp
, within the Getting ready samples for this recipe. You will need to open it in JDeveloper and deploy to the Oracle SOA Suite to follow along with this recipe.
Highlight the WSDL URL and copy it, as we will need this in a moment.
http://<hostname>:7001/SchedulerUi/SchedulerUIExt.html
.This will take you to the Scheduler dashboard. Click on the Add Job icon; this will open the Edit Job page. Enter the following information:
Field |
Value |
---|---|
Job Name |
|
Job Group |
|
Schedule Type |
|
Active |
Ensure this is checked, otherwise the job won't be triggered. |
From |
Don't specify a value |
Until |
Don't specify a value |
Cron Expression |
|
Main
, as shown in the following screenshot:Once complete, click on Save. This will save the details of the job and return you to the dashboard.
The job will now be active.
We have defined the job Stock Check
in the Stock
group with a cron schedule of 0 * * * * ?
.
This will create a Quartz job, under the covers, that fires every minute on the minute. When it triggers, it will cause the Scheduler to submit a web service request to the specified endpoint containing the payload that we defined.
The Scheduler can be used to schedule synchronous and asynchronous web services deployed to the Oracle SOA Suite or Oracle Service. In addition, it can be used to schedule the publication of EDN events to the SOA Suite.
While cron expressions are powerful, they can be confusing. So, the Scheduler also supports the creation of Simple Schedules, which are simpler to understand.
The Scheduler also comes with a web service API that enables us to create schedules dynamically from within another service, which we will look at in the next couple of recipes.
This is also useful for deployment purposes, as we can use this to create scheduled jobs as part of the process of deploying composites to the SOA Suite.