Tuesday Mar 24, 2009

Worth a hill of beans!

In this blog, we'll show how to get Scheduler BC to trigger a Stateless Session Bean (SLSB) deployed in a Java EE Service Engine.  I'm using GlassFish ESB v2.1 Milestone 1 Installer from here so YMMV if using a different version:

  1. Start a new EJB Module project:

  2. Enter Name and Location of EJB Module:

  3. Select the GlassFish Server and press Finish:

  4. Under the Source Packages node of the project, create a Scheduler WSDL Binding:

  5. Choose the SCHEDULER Binding Type and press Next:

  6. Add a new Simple trigger:

  7. Define the Simple Trigger:

  8. Ensure the appropriate Date Format is selected before pressing Finish:

  9. Under the Source Packages node, create a Web Service from WSDL:

  10. Specify the Name and Location step and browse for the Scheduler Binding WSDL created earlier:

  11. Remember to enter a Package name before pressing Finish:

  12. In the Java editor that appears, implement the method accordingly:

  13. Almost done, save everything and create a Composite Application project:

  14. Key in Project Name and press Finish:

  15. Drag the EJB Module project onto the CASA canvas and do a Build Project and afterwards, should look like this:

  16. Save everything, Deploy the Composite Application project, and you should get similar results:

Tuesday Nov 11, 2008

Cron Trigger Now Available

Took some time but hopefully it was worth waiting for, Cron triggering capability is finally available for the Scheduler BC!  Cron triggers enable your business logic to do something at particular moments in time, as opposed to Simple triggers that perform a task at a periodic interval of time.  An assumption here is you are already familiar with the current Scheduler BC (if not please read some of the previous blog entries first) and using BC's and SE's in general.

  • Create a Scheduler Binding (WSDL) as before by right-clicking over the Process Files folder and choosing New | Other | ESB | Binding and choose SCHEDULER Binding:



  • Click Next and select Cron from the Add combo box (or if already so, just press the plus (+) sign button) to begin adding a new Cron trigger:



  • We'll start off with a very simple Cron trigger to fire the top of every minute.  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, then set it to zero (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) and so you can simply press Add Cron Trigger button:



  • I deliberately didn't choose a more complicated Cron Expression because if run, they'll generally span a longer period than a demo affords.  However, just for illustration, let's define one that reminds Americans to vote in the General Election once every four years and this is typically the first Tuesday in November 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):



  • Set the Just on Minute spinner to 0, Just on Hour spinner to 8, of the Minute (2) and Hour (3) tabs respectively:





  • Select the Day-of-Week (6) tab and select choice On the and drop down settings First and TUE:



  • 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:



  • Select the Month (5) tab and choose Just on Month and month 11 (November):



  • 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:



  • Not that we can practically test out this exact expression, but you can try something similar otherwise.  Anyways, as a contrast, let's define also a Simple trigger that repeats every minute by choosing Simple from the Add combo box and filling in the respective fields:





  • Since we're testing at the Second granularity, the default Date Format setting is insufficient so let's change it to W3C XML date and time format:



  • We're done and can now press Finish and here's the resulting WSDL:



  • Next, we'll define a FILE binding (process not shown here) that appends to a file and a BPEL Process (please refer to previous blogs if uncertain how to create FILE binding or BPEL Process) to map the Message payload from the trigger to the file output part1:



  • Create the customary Composite Application project and drag the BPEL project into it and Build:



  • Deploy the Composite Application project and you'll get results similar to:



  • Since this feaature has just been checked in on November 11, 2008, the officially built binaries won't be available yet for you to try out the Cron trigger, so here are the home-baked cookies:

About

Edward Wong

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today