Back to Scheduler BC, or Scheduler BC Info
| At line 5 changed 1 line. |
| The Scheduler Binding Component (BC), powered by [OpenSymphony Quartz|http://www.opensymphony.com/quartz/], affords scheduling capability to kick off (consume) other JBI component providers, for example a BPEL Service Engine.\\ |
| The Scheduler Binding Component (BC), powered by [OpenSymphony Quartz|http://www.opensymphony.com/quartz/], affords scheduling capability to kick off (consume) other JBI component providers, for example a BPEL Service Engine. |
| At line 11 changed 181 lines. |
| The Scheduler BC works pretty much the same as any other, such as File BC. However, with the recent WSDL Binding Wizard changes across the board for all BC's, it's worth mentioning how to create a deployment for a Scheduler BC triggering a BPEL to write to a File BC. |
| !!Create a Scheduler WSDL Document |
| * Launch the WSDL Binding Wizard by right-clicking over the __{{Process Files}}__ folder of a BPEL project and select __{{New | WSDL Document}}__ |
| ** Or equivalently, select __{{New | Other | ESB (Category) | Binding (File Type)}}__ from the __{{Process Files}}__ context menu |
| [{Image src='SchedulerBC/newSchedBinding.png' align='center'}] |
| [{Image src='SchedulerBC/newSchedWSDL.png' align='center'}] |
| * Enter an appropriate __{{File Name}}__ for the WSDL, choose __{{Concrete WSDL Document}}__ for the __{{WSDL Type}}__, select __{{SCHEDULER}}__ from the __{{Binding}}__ drop-down box and press __{{Next}}__ |
| [{Image src='SchedulerBC/defineCtrlTriggers.png' align='center'}] |
| * To create a Simple trigger, choose __{{Simple}}__ from the __{{Add}}__ combo box or if so already, simply press the __{{+}}__ (plus) button, key in appropriate data and press __{{Add Simple Trigger}}__ button when done |
| [{Image src='SchedulerBC/addNewTrigger.png' align='center'}] |
| * Optionally, define a custom date and time format to be used with the scheduler; this format is used both to interpret date and time values persisted in the Scheduler's WSDL as well as displaying the date and time in the message sent to the endpoint being triggered |
| [{Image src='SchedulerBC/defineCustomDateFormat.png' align='center'}] |
| * Compose the __{{Format}}__ by selecting from the various date/time component __{{Pattern}}__ drop-down boxes, as well as typing other literals; all the while a __{{Sample}}__ text field illustrates what the date and time will look like |
| [{Image src='SchedulerBC/configureCustomDateFormat.png' align='center'}] |
| * As a comparison to Simple trigger that sends a message at periodic intervals of time, let's create a Cron trigger that does so at particular moments in time. Start by choosing __{{Cron}}__ from the __{{Add}}__ combo box |
| [{Image src='SchedulerBC/addCronTrigger.png' align='center'}] |
| * We'll start off with a very simple Cron trigger to fire the top of every minute, that is, at the zeroth second. Appropriately fill in __{{Name}}__, __{{Description}}__ and __{{Message}}__ fields and then select the __{{Second (1)}}__ tab if not already done. Select the __{{Just on Second}}__ choice if not already so and the associated spinner to set the second-of-the-minute will be automatically enabled and set this to __{{0}}__. (''Note, the respective controls in the other choices are only enabled if that choice is selected.'') This is the only condition that needs to be defined because all the others are already defaulted appropriately (verifiable in the __{{Cron Expression}}__ text field (see CronExpression JavaDoc [here|http://www.opensymphony.com/quartz/api/org/quartz/CronExpression.html]) and so you can simply press __{{Add Cron Trigger}}__ button |
| [{Image src='SchedulerBC/specifyCronTrigger.png' align='center'}] |
| * Although a more complicated Cron Expression generally takes a longer period to run than a demo affords, for illustration sake, let's define one that reminds Americans to vote in the General Election. This is typically the first Tuesday in November every four years, and let's say poll opens at 8:00:00 AM. Start by selecting the __{{Second (1)}}__ tab and __{{Just on Second}}__ choice, and setting the second spinner to zero (0) |
| [{Image src='SchedulerBC/VoteSecondCond.png' align='center'}] |
| * Set the __{{Just on Minute}}__ spinner to __{{0}}__, __{{Just on Hour}}__ spinner to __{{8}}__, of the __{{Minute (2)}}__ and __{{Hour (3)}}__ tabs respectively |
| [{Image src='SchedulerBC/VoteMinuteCond.png' align='center'}] |
| [{Image src='SchedulerBC/VoteHourCond.png' align='center'}] |
| * Select the __{{Day-of-Week (6)}}__ tab and select choice __{{On the}}__ and drop down settings __{{First}}__ and __{{TUE}}__ |
| [{Image src='SchedulerBC/VoteDayOfWeekCond.png' align='center'}] |
| * Having done so, the __{{Day (4)}}__ tab is automatically set to __{{No specific Day of the month}}__ because the Quartz Scheduler API requires it to be mutually exclusive with __{{Day-of-Week}}__ |
| [{Image src='SchedulerBC/VoteDayCond.png' align='center'}] |
| * Select the __{{Month (5)}}__ tab and choose __{{Just on Month}}__ and month __{{11}}__ (November) |
| [{Image src='SchedulerBC/VoteMonthCond.png' align='center'}] |
| * Finally, we need to specify the optional __{{Year (7)}}__ tab by checking on the option box and then select the __{{Starting on Year}}__ choice, setting year to __{{2008}}__ and the __{{repeating every}}__ to __{{4}}__ |
| [{Image src='SchedulerBC/VoteYearCond.png' align='center'}] |
| * Press __{{Finish}}__ and the new Scheduler WSDL editor appears |
| [{Image src='SchedulerBC/finishSchedWSDL.png' align='center'}] |
| [{Image src='SchedulerBC/resultSchedWSDL.png' align='center'}] |
| * Recently, the __{{Hybrid}}__ trigger has been added, please read the [blog|http://blogs.sun.com/edwong/entry/scheduler_is_going_hybrid] for more info. |
| !! Create a File WSDL Document |
| * Similarly, right click over the __{{Process Files}}__ folder again, select __{{New | WSDL Document}}__ and this time create a __{{FILE Binding Concrete WSDL Document}}__ of __{{Type Write}}__ and press __{{Next}}__ |
| [{Image src='SchedulerBC/newFileWSDL.png' align='center'}] |
| * Specify the respective fields and click __{{Finish}}__ |
| [{Image src='SchedulerBC/finishFileWSDL.png' align='center'}] |
| !! Create a BPEL and Connect the Components |
| * Create a new BPEL in the same __{{Process Files}}__ folder and drag and drop the Scheduler WSDL to approximately the middle of the Ports column left of the BPEL canvas |
| [{Image src='SchedulerBC/dndSchedWSDL.png' align='center'}] |
| * If it appears, __{{OK}}__ the ensuing dialog confirming creation of Partner Link to represent the Scheduler BC consuming endpoint |
| [{Image src='SchedulerBC/createSchedPartnerLink.png' align='center'}] |
| * Similarly, drag and drop the File WSDL to the right column |
| [{Image src='SchedulerBC/dndFileWSDL.png' align='center'}] |
| * Again, if the ensuing dialog appears, click the __{{Swap Roles}}__ button since this time the BPEL is the consumer of the service the File BC provides |
| [{Image src='SchedulerBC/createFilePartnerLink.png' align='center'}] |
| * Create __{{Receive}}__, __{{Assign}}__, and __{{Invoke}}__ activities in the BPEL and Edit the Receive activity to select the Partner Link representing the Scheduler BC |
| [{Image src='SchedulerBC/editReceive.png' align='center'}] |
| [{Image src='SchedulerBC/createSchedInstance.png' align='center'}] |
| * Press the __{{Create}}__ button to create an __{{Input Variable}}__ for the Scheduler operation by accepting all the default values in the pop-up dialog (not shown) and hit __{{OK}}__ here |
| [{Image src='SchedulerBC/okReceive.png' align='center'}] |
| * Similarly edit the __{{Invoke}}__ activity and also create an __{{Input Variable}}__ for the File BC operation |
| [{Image src='SchedulerBC/okInvoke.png' align='center'}] |
| * Double click on the __{{Assign}}__ activity to bring up the Mapper and concatentate the __{{FireTriggerOperationIn | Properties | SchedulerBC | Inbound | Trigger Date}}__ and __{{FireTriggerOperationIn | schedPart}}__ fields and map to __{{part1}}__ of the File input variable, __{{WriteIn}}__, and __{{Save All}}__ your work |
| [{Image src='SchedulerBC/mapPayloadToPart1.png' align='center'}] |
| !! Deploy a Composite Application for Scheduler BC -> BPEL -> File BC |
| * Create a new __{{Composite Application}}__ project and drag and drop the BPEL project onto the CASA Editor canvas |
| [{Image src='SchedulerBC/dndBPELToCASA.png' align='center'}] |
| * Hit the __{{Build}}__ (hammer) button twice (second time to get rid of progress label...known issue) |
| [{Image src='SchedulerBC/resultSchedBPELFileConnected.png' align='center'}] |
| * Right click over the CASA project and select __{{Deploy}}__ (you must have a running Glass Fish server with Scheduler Binding Component installed already of course) and you should be getting results in __{{C:\temp\output.xml}}__ like this: |
| {{{ |
| 12 November 2008 at 3:47:31 PM: Do you need more money Joe? |
| 12 November 2008 at 3:48:00 PM: Top of the Minute to you Hank Paulson, please send more money! |
| 12 November 2008 at 3:48:31 PM: Do you need more money Joe? |
| 12 November 2008 at 3:49:00 PM: Top of the Minute to you Hank Paulson, please send more money! |
| 12 November 2008 at 3:49:31 PM: Do you need more money Joe? |
| 12 November 2008 at 3:50:00 PM: Top of the Minute to you Hank Paulson, please send more money! |
| }}} |
| !! Scheduler Binding WSDL Document Syntax |
| Here's what the above WSDL looks like: |
| {{{ |
| <?xml version="1.0" encoding="UTF-8"?> |
| <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" |
| xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
| xmlns:sched="http://schemas.sun.com/jbi/wsdl-extensions/scheduler/" |
| name="schedEZLoans" targetNamespace="http://j2ee.netbeans.org/wsdl/bpelSubPrimeOrBust/schedEZLoans" xmlns:tns="http://j2ee.netbeans.org/wsdl/bpelSubPrimeOrBust/schedEZLoans" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"> |
| <wsdl:types/> |
| <wsdl:message name="TriggerEventMessage"> |
| <wsdl:part name="schedPart" type="xsd:string"/> |
| </wsdl:message> |
| <wsdl:portType name="TriggerPortType"> |
| <wsdl:operation name="FireTriggerOperation"> |
| <wsdl:input name="inMsg" message="tns:TriggerEventMessage"/> |
| </wsdl:operation> |
| </wsdl:portType> |
| <wsdl:binding name="TriggerBinding" type="tns:TriggerPortType"> |
| <sched:binding group="schedEZLoans" date-format="dd MMMM yyyy 'at' h:mm:ss a"/> |
| <wsdl:operation name="FireTriggerOperation"> |
| <sched:operation mode="static"/> |
| <wsdl:input name="inMsg"> |
| <sched:trigger name="SendLoanApplicationStatus" type="simple" enabled="true" description="Trigger sending loan application status to Joe The Plumber" repeat="indefinite" interval="60000" message="Do you need more money Joe?"/> |
| <sched:trigger name="AskForBailoutMoney" type="cron" enabled="true" description="Trigger requesting more bailout billions from Feds" cron-expr="0 * * * * ?" message="Top of the Minute to you Hank Paulson, please send more money!"/> |
| <sched:trigger name="VoteTheScoundrelOut" type="cron" enabled="true" description="Remind Americans to vote to save the economy" cron-expr="0 0 8 ? 11 3#1 2008/4" message="Back away from the remote, get up and go vote!"/> |
| </wsdl:input> |
| </wsdl:operation> |
| </wsdl:binding> |
| <wsdl:service name="TriggerService"> |
| <wsdl:port name="schedEZLoans_TriggerPort" binding="tns:TriggerBinding"> |
| <sched:active-period starting="now" ending="never" timezone="America/Los_Angeles"/> |
| </wsdl:port> |
| </wsdl:service> |
| <plnk:partnerLinkType name="schedEZLoans"> |
| <!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes. |
| In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type. |
| A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.--> |
| <plnk:role name="TriggerPortTypeRole" portType="tns:TriggerPortType"/> |
| </plnk:partnerLinkType> |
| </wsdl:definitions> |
| }}} |
| See [SchedulerBCTutorial] |
| At line 193 removed 1 line. |
| At line 195 changed 2 lines. |
| ! Systemic Qualities (QoS) |
| * Please refer to this [blog|http://blogs.sun.com/edwong/entry/systemic_qualities_enhancements] |
| * Systemic Qualities (QoS): please refer to this [blog|http://blogs.sun.com/edwong/entry/systemic_qualities_enhancements] |
| At line 198 removed 2 lines. |
| At line 31 added 1 line. |
| The Scheduler BC is released as part of GlassFish ESB v2.1 |