The Scheduler Binding Component (BC), powered by OpenSymphony Quartz, affords scheduling capability to kick off (consume) other JBI component providers, for example a BPEL Service Engine.
Like other Binding Components such as File or JMS, in order to use Scheduler BC one has to first create a WSDL Document defining the Scheduler binding and then use it to construct a BPEL service to act as a provider endpoint. When the scheduler triggers, a message will be sent to the Business Process and it'll be incumbent on the business logic implemented there to perform an appropriate task.
Current (Release 1.0)
- The Scheduler BC currently only supports statically defined triggers (that is, whatever is specified in the Scheduler WSDL Document).
- Quartz SimpleTrigger (for example, do something every 30 seconds) is supported.
- Quartz CronTrigger (a la Unix crontab) will be supported soon.
- Dynamically defined and persisted triggers. In other words, a consumer endpoint can send a create new trigger request to the Scheduler BC provider endpoint and at the appointed time, the respective trigger message will be sent back to same endpoint but of course, now in a provider role.
As mentioned above, the Scheduler BC follows pretty much the same modus operandi as other BCs in that all its configuration is persisted in the corresponding WSDL Document. The latter is then used to define a Business Process that will receive the triggering message and do something appropriate.
These instructions will illustrate how to trigger JBI components (service providers) using a Scheduler project. It is assumed that the reader is familiar with the JBI paradigm and in particular, how to design a BPEL project to implement and invoke specific web services.
- Step 1
- Go to File | New Project... | SOA (category) | Scheduler Module (project)
- Step 2
- Key in Project name. The name forms the first half of the Scheduler consumer endpoint name so choose one that's meaningful yet succinct (no spaces or other unsavory characters for now), for example schedules related to a particular demo, such as SchedulerDemo.
- Step 3
- Right-click the project's Process Files folder and choose New | Schedule File...
- Step 4
- Key in Schedule file name. The name forms the latter half of the Scheduler consumer endpoint name so again, choose one that's meaningful yet succinct (no spaces or other unsavory characters for now), for example what this particular schedule will trigger, such as KickOffBPEL (don't prvoide any extensions in the name for a standard .sched extension is always used).
- Step 5
- In the ensuing Schedule editor, click the Add Simple Trigger toolbar button and a new trigger row will appear in the table below.
- Step 6
- With the respective trigger table row highlighted (note, the Selected checkbox is used for indicating triggers selected for deletion), you can specify the various parameters for that trigger. Changes to a field are registered when either focus is lost or an Enter key is pressed (except for the Message text area since it will accept newlines as part of the data).
- The Starting and Ending date/time entries delineate when this trigger will be active. If you want the trigger to be active immediately after the Composite Application has been deployed, select the Now checkbox (and similarly select the Never checkbox if the active period has no end). Alternatively, you can unselect these checkboxes to enter specific starting/ending date and times. Simply place the text caret in the date/time component field and push on the up or down spinner arrows accordingly.
- If you wish to change the date/time format, press the Format button and a SimpleDateFormat Choose dialog will pop up. Simply build the format pattern by selecting from the respective date/time pattern combo boxes and the corresponding pattern will be inserted at the caret position in the Format field; all the while the Sample field is updated to show what the date/time will look like.
- A simple trigger basically repeats after a certain time interval so specify the Repeat Count or Indefinite and the various time units that comprise the overall time interval.
- Finally, the Job section pertains to the Message that will be sent when the trigger fires and will contain a metadata part that details the appointed date and time the trigger was configured to fire (note, this may precede the actual time the message is received due to network latency) in the specified Date Format (that can be configured by selecting the <define custom> entry from the drop-down list. Moreover, the metadata will also contain the trigger's name and group to which it belongs.
- Step 7
- Save your work and build the Scheduler project.
- Step 8
- Use the generated WSDL files as appropriate to set up the provider endpoints to be triggered.
- Step 9
- Create a JBI project that provisions the desired endpoints to be triggered, for example in the following BPEL project.
- Step 10
- Add this Scheduler project and other required ones into a Composite Application project.
- Step 11
- Connect the various Scheduler consumer endpoints with their respective provider endpoints to be triggered.
- Step 12
- Save Composite Application project, build, and deploy into running instance of GlassFish Application Server.
Schedule XML File Syntax
Here's what a typical one looks like:
<?xml version="1.0" encoding="UTF-8"?>
<schedule name="kickOffBPEL" group="SchedulerDemo"
<trigger name="everyMinute" enabled="true" description="Triggering the BPEL usecase every minute">
<date value="9/30/08 11:59 PM"/>
<message date-format="M/d/yy h:mm a">Send status to loan applicant!</message>
- NetBeans 6.1 with Patch 3 (available via NetBeans Update Center after installing standard NetBeans 6.1, or simply use the OpenESB Installer)
- JDK 1.5 or greater
- Complete OpenESB Installer available here
- A La Carte Binaries
Number of visits: 5