configure a soascheduler for a composite in soa …...by robert baumgartner, senior solution...

27
Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page 1 Configure a SOAScheduler for a composite in SOA Suite 11g By Robert Baumgartner, Senior Solution Architect ORACLE November 2010

Upload: others

Post on 30-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 1

Configure a SOAScheduler for a composite in SOA Suite 11g

By Robert Baumgartner Senior Solution Architect ORACLE

November 2010

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 2

Prerequisite Install the bpel-101-HelloWorld from httpssoasamplessamplecodeoraclecom into your running

Oracle SOA Suite 11g This is our example SOA composite which will be triggered by our Scheduler

This scheduler will also work with BPMN processes if they are exposed as service within their SCA

composite

Implementing SOAScheduler in JDeveloper In this section we will create a simple a web service proxy component a scheduler job class that is

called by the SOAScheduler and a java class SOASchedulerServlet that initiate the quartz scheduler

Creating the Web Service Proxy Component At first we need the WSDL of the example SOA composite This can be found at the Oracle Enterprise

Manager You will find the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em Log in with the administration user eg ldquoweblogicrdquo On the farm overview

page click on the newly deployed SOA example composite ldquobpel-101-HelloWorldrdquo

Figure 1

Click on ldquoShow WSDL and endpoint URIrdquo

Figure 2

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 3

Figure 3

Copy the WSDL location

To get started create a new Application in JDeveloper by click CTRL-N name it SOAScheduler

select ldquoGeneric Applicationrdquo

Figure 4

And create a new Project named SchedulerProject select ldquoJavardquo and ldquoWeb Servicesrdquo as ldquoProject

Technologiesrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 4

Figure 5

Click Finish

Create a new Web Service Proxy by click ldquoFileNewrdquo or CRTL-N

Figure 6

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 5

Click ldquoOKrdquo and ldquoNextrdquo

Figure 7

Select ldquoJAX-WS Stylerdquo and click ldquoNextrdquo

Figure 8

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 2: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 2

Prerequisite Install the bpel-101-HelloWorld from httpssoasamplessamplecodeoraclecom into your running

Oracle SOA Suite 11g This is our example SOA composite which will be triggered by our Scheduler

This scheduler will also work with BPMN processes if they are exposed as service within their SCA

composite

Implementing SOAScheduler in JDeveloper In this section we will create a simple a web service proxy component a scheduler job class that is

called by the SOAScheduler and a java class SOASchedulerServlet that initiate the quartz scheduler

Creating the Web Service Proxy Component At first we need the WSDL of the example SOA composite This can be found at the Oracle Enterprise

Manager You will find the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em Log in with the administration user eg ldquoweblogicrdquo On the farm overview

page click on the newly deployed SOA example composite ldquobpel-101-HelloWorldrdquo

Figure 1

Click on ldquoShow WSDL and endpoint URIrdquo

Figure 2

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 3

Figure 3

Copy the WSDL location

To get started create a new Application in JDeveloper by click CTRL-N name it SOAScheduler

select ldquoGeneric Applicationrdquo

Figure 4

And create a new Project named SchedulerProject select ldquoJavardquo and ldquoWeb Servicesrdquo as ldquoProject

Technologiesrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 4

Figure 5

Click Finish

Create a new Web Service Proxy by click ldquoFileNewrdquo or CRTL-N

Figure 6

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 5

Click ldquoOKrdquo and ldquoNextrdquo

Figure 7

Select ldquoJAX-WS Stylerdquo and click ldquoNextrdquo

Figure 8

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 3: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 3

Figure 3

Copy the WSDL location

To get started create a new Application in JDeveloper by click CTRL-N name it SOAScheduler

select ldquoGeneric Applicationrdquo

Figure 4

And create a new Project named SchedulerProject select ldquoJavardquo and ldquoWeb Servicesrdquo as ldquoProject

Technologiesrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 4

Figure 5

Click Finish

Create a new Web Service Proxy by click ldquoFileNewrdquo or CRTL-N

Figure 6

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 5

Click ldquoOKrdquo and ldquoNextrdquo

Figure 7

Select ldquoJAX-WS Stylerdquo and click ldquoNextrdquo

Figure 8

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 4: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 4

Figure 5

Click Finish

Create a new Web Service Proxy by click ldquoFileNewrdquo or CRTL-N

Figure 6

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 5

Click ldquoOKrdquo and ldquoNextrdquo

Figure 7

Select ldquoJAX-WS Stylerdquo and click ldquoNextrdquo

Figure 8

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 5: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 5

Click ldquoOKrdquo and ldquoNextrdquo

Figure 7

Select ldquoJAX-WS Stylerdquo and click ldquoNextrdquo

Figure 8

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 6: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 6

Paste the WSDL location into ldquoWSDL Document URLrdquo and click ldquoNextrdquo

Figure 9

Write ldquosampleoracleotnsoaschedulerproxyrdquo into ldquoPackage Namerdquo and

ldquosampleoracleotnsoaschedulerproxytypesrdquo into ldquoRoot Package for Generated Typesrdquo and click

ldquoFinishrdquo

In the new HelloWorldProcess_ptClientjava add the Line

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

public static void main(String [] args)

helloworldprocess_client_ep = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_client_epgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(helloWorldProcessprocess(SOAScheduler))

Click on F11 or on the run icon The composite will be executed by the new generated service

proxy

In the message window you will see the correct output of SOA example composite

Figure 10

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 7: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 7

Add Quartz library to the project Click on ldquoApplicationrdquo ldquoProject Propertiesrdquo ldquoAdd JARDirectoryhelliprdquo

Figure 11

Select in your JDeveloper home ldquohellipjdevelopersoamodulesquartz-all-165jarrdquo Click ldquoSelectrdquo

Figure 12

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 8: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 8

Click ldquoOKrdquo

Creating the Scheduler Job Component Create a new ldquoJava Classrdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 13

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 9: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 9

Figure 14

Set the Name to ldquoHelloWorldJobrdquo and Package to ldquosampleoracleotnsoaschedulerjobrdquo and click

ldquoOKrdquo

Replace the generated source with the following lines

package sampleoracleotnsoaschedulerjob

import javatextDateFormat

import javatextSimpleDateFormat

import javautilDate

import sampleoracleotnsoaschedulerproxyHelloworldprocess_client_ep

import sampleoracleotnsoaschedulerproxyHelloWorldProcess

import javaxxmlwsWebServiceRef

import orgquartzJob

import orgquartzJobExecutionContext

public class HelloWorldJob implements Job

WebServiceRef

private static Helloworldprocess_client_ep helloworldprocess_client

public HelloWorldJob()

helloworldprocess_client = new Helloworldprocess_client_ep()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 10: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 10

public void execute(JobExecutionContext jobExecutionContext)

DateFormat df = new SimpleDateFormat(yyyyMMdd HHmmss)

Date date = new Date()

Systemoutprintln(HelloWorldJob started)

try

helloworldprocess_client = new Helloworldprocess_client_ep()

HelloWorldProcess helloWorldProcess = helloworldprocess_clientgetHelloWorldProcess_pt()

Add your code to call the desired methods

Systemoutprintln(HelloWorld Response + helloWorldProcessprocess(SOAScheduler +

dfformat(date)))

catch (Exception e)

Systemoutprintln(HelloWorld Process failed + etoString())

eprintStackTrace()

Creating the SOASchedulerServlet java class Create a new Java Class in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 15

Set the Name to ldquoSOASchedulerServletrdquo Package to ldquosampleoracleotnsoaschedulerrdquo Extends

ldquojavaxservlethttpHttpServletrdquo and click on ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 11: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 11

Replace the generated source with the following lines

package sampleoracleotnsoascheduler

import sampleoracleotnsoaschedulerjobHelloWorldJob

import javaioIOException

import javaioPrintWriter

import javautilDate

import javautilCalendar

import javautilGregorianCalendar

import javaxservletServletConfig

import javaxservletServletException

import javaxservlethttpHttpServlet

import javaxservlethttpHttpServletRequest

import javaxservlethttpHttpServletResponse

import orgquartzCronTrigger

import orgquartzJobDetail

import orgquartzScheduler

import orgquartzSimpleTrigger

import orgquartzTrigger

import orgquartzimplStdSchedulerFactory

import orgquartzimplcalendarAnnualCalendar

public class SOASchedulerServlet extends HttpServlet

StdSchedulerFactory schedFact

Scheduler sched

public void init(ServletConfig config) throws ServletException

superinit(config)

try

schedFact = new StdSchedulerFactory(soa_quartzproperties)

sched = schedFactgetScheduler()

Systemoutprintln(thisgetClass()getName() + started)

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

schedstart()

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 12: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 12

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

String cronExpr = null

Get the cron Expression as an Init parameter

cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

public void destroy()

try

if (sched = null)

schedunscheduleJob(TRIGGER_NAME JOB_NAME)

schedshutdown()

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

Systemoutprintln(thisgetClass()getName() + stopped)

public void doGet(HttpServletRequest request

HttpServletResponse response) throws ServletException

IOException

PrintWriter ajax = new PrintWriter(responsegetOutputStream())

loggerwarning(get)

String action = requestgetParameter(action)

if (singleequals(action))

if (sched = null)

try

Trigger trigger =

new SimpleTrigger(SOASingleTrigger GROUP_NAME new Date())

triggersetJobName(JOB_NAME)

triggersetJobGroup(GROUP_NAME)

Schedule the trigger

schedscheduleJob(trigger)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (startequals(action))

if (sched = null)

try

JobDetail jd = new JobDetail(JOB_NAME GROUP_NAME HelloWorldJobclass)

CronTrigger cronTrigger = new CronTrigger(TRIGGER_NAME GROUP_NAME)

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 13: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 13

Get the cron Expression as an Init parameter

String cronExpr = getInitParameter(cronExpr)

Systemoutprintln(thisgetClass()getName() + Cron Expression for + JOB_NAME + + cronExpr)

cronTriggersetCronExpression(cronExpr)

Systemoutprintln(thisgetClass()getName() + Scheduling Job + JOB_NAME)

schedscheduleJob(jd cronTrigger)

Systemoutprintln(thisgetClass()getName() + Job + JOB_NAME + scheduled)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + egetLocalizedMessage())

eprintStackTrace()

else if (stopequals(action))

if (sched = null)

try

schedunscheduleJob(TRIGGER_NAME GROUP_NAME)

Systemoutprintln(thisgetClass()getName() + stopped)

catch (Exception e)

Systemoutprintln(thisgetClass()getName() + failed to shutdown + etoString())

eprintStackTrace()

ajaxprintln(lthtmlgt)

ajaxprintln( ltheadgt)

ajaxprintln( lttitlegtSOAScheduler - Web Interfacelttitlegt)

ajaxprintln( ltlink rel=stylesheet type=textcss href=cssmystylecssgtltlinkgt)

ajaxprintln( ltheadgt)

ajaxprintln( ltbody onload=startAjaxPeriodicalUpdater()gt)

ajaxprintln( lth2gt)

ajaxprintln( SOAScheduler )

ajaxprintln( ltspan class=servergt + SystemgetProperty(weblogicName) + ltspangt)

ajaxprintln( lth2gt)

ajaxprintln(lttable id=events_table class=events_table width=100gt)

ajaxprintln(lttbodygt)

String[] jobGroups

String[] jobsInGroup

String[] triggerGroups

Trigger[] jobTriggers

String[] calendersList

AnnualCalendar calen

CronTrigger cronTrigger

int i j k

try

jobGroups = schedgetJobGroupNames()

triggerGroups = schedgetTriggerGroupNames()

calendersList = schedgetCalendarNames()

for (i= 0 i lt calendersListlength i++)

calen = (AnnualCalendar)schedgetCalendar(calendersList[i])

Systemoutprintln(Calendar + calendersList[i])

ajaxprintf(Calendar + calendersList[i])

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 14: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 14

for (i = 0 i lt jobGroupslength i++)

Systemoutprintln(Group + jobGroups[i] + contains the following jobs)

jobsInGroup = schedgetJobNames(jobGroups[i])

for (j = 0 j lt jobsInGrouplength j++)

Systemoutprintln(- + jobsInGroup[j])

jobTriggers = schedgetTriggersOfJob(jobsInGroup[j] jobGroups[i])

for (k = 0 k lt jobTriggerslength k++)

Systemoutprintln(- + triggersInGroup[j])

if (orgquartzCronTriggerequals(jobTriggers[k]getClass()getName()))

cronTrigger = (CronTrigger)jobTriggers[k]

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttdgtLast

slttdgtlttdgtCron slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime()

jobTriggers[k]getPreviousFireTime()

cronTriggergetCronExpression())

else

ajaxprintf(lttr class=sgtlttd align=leftgtTrigger slttdgtlttdgtNext slttdgtlttrgt

events jobTriggers[k]getName()

jobTriggers[k]getNextFireTime())

catch (Exception e)

Systemoutprintln(SOASchdulerServlet failed + etoString())

eprintStackTrace()

ajaxprintln(lttbodygt)

ajaxprintln(lttablegt)

ajaxflush()

static final String GROUP_NAME = SOAGroup

static final String TRIGGER_NAME = SOATrigger

static final String JOB_NAME = SOAJob

static final String TARGET_PAGE = indexjsp

Create a quartz property file Create a new File (General) in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 15: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 15

Figure 16

Select ldquoFile (General)rdquo

Figure 17

Set File Name to ldquosoa_quartzpropertiesrdquo and Directory to the src directory of your project Click

ldquoOKrdquo

Insert the following lines into the property file

Configure Main Scheduler Properties

orgquartzschedulerinstanceName = SOASchedulerorgquartzschedulerinstanceId = AUTO

orgquartzschedulerrmiexport = false

orgquartzschedulerrmiproxy = false

Configure ThreadPool

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 16: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 16

orgquartzthreadPoolclass = orgquartzsimplSimpleThreadPool

orgquartzthreadPoolthreadCount = 5

orgquartzthreadPoolthreadPriority = 4

Configure JobStore

orgquartzjobStoremisfireThreshold = 5000

orgquartzjobStoreclass = orgquartzsimplRAMJobStore

Create a J2EE Deployment Descriptor (webxml) Create a new webxml in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 18

Select ldquoJava EE Deployment Descriptorrdquo Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 17: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 17

Figure 19

Select ldquowebxmlrdquo Click ldquoNextrdquo

Figure 20

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 18: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 18

Select ldquo25rdquo Click ldquoFinishrdquo

Select ldquoServletsrdquo and click on the green ldquo+rdquo (Create Servlet)

Set Name to ldquoSOASchedulerServletrdquo Servlet Class to

ldquosampleoracleotnsoaschedulerSOASchedulerServletrdquo Set ldquoLoad Servlet onrdquo to ldquoApplication Startrdquo

Select ldquoServlet Mappingsrdquo and click on the green ldquo+rdquo (Create ldquoServlet Mappingsrdquo) Add

ldquosoaschedulerservletrdquo as URL Pattern

Select ldquoInitialization Parametersrdquo and click on the green ldquo+rdquo (Create ldquoServlet Initialization

parametersrdquo) Add ldquocronExprrdquo as Name and ldquo0 0510152025303540455055 rdquo as Value

Figure 21

Select ldquoPagesrdquo and click on the green ldquo+rdquo (Create ldquoWelcome Filerdquo) Add ldquosoaschedulerservletrdquo

Figure 22

The Source should look like thishellip

ltxml version = 10 encoding = windows-1252gt

ltweb-app xmlnsxsi=httpwwww3org2001XMLSchema-instance

xsischemaLocation=httpjavasuncomxmlnsjavaee httpjavasuncomxmlnsjavaeeweb-

app_2_5xsd

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 19: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 19

version=25 xmlns=httpjavasuncomxmlnsjavaeegt

ltservletgt

ltservlet-namegtSOASchedulerServletltservlet-namegt

ltservlet-classgtsampleoracleotnsoaschedulerSOASchedulerServletltservlet-classgt

ltinit-paramgt

ltparam-namegtcronExprltparam-namegt

ltparam-valuegt0 0510152025303540455055 ltparam-valuegt

ltinit-paramgt

ltload-on-startupgt0ltload-on-startupgt

ltservletgt

ltservlet-mappinggt

ltservlet-namegtSOASchedulerServletltservlet-namegt

lturl-patterngtsoaschedulerservletlturl-patterngt

ltservlet-mappinggt

ltwelcome-file-listgt

ltwelcome-filegtsoaschedulerservletltwelcome-filegt

ltwelcome-file-listgt

ltweb-appgt

Click ldquoSave Allrdquo

Attention The name ldquocronExprrdquo is requested in the SOASchedulerServletjava and the value means

that the SOA composite bpel-101-helloworld is started every five minutes every day For other values

you will find more examples later

Create WAR File (Deployment Profile) Create a new ldquoWAR Filerdquo in JDeveloper by click ldquoFileNewrdquo or CRTL-N

Figure 23

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 20: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 20

Figure 24

Set the Profile Name to ldquoSOASchedulerrdquo Click ldquoOKrdquo

Figure 25

On the ldquoGeneralrdquo tab set the ldquoWeb Context Rootrdquo to ldquoSOASchedulerrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 21: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 21

Figure 26

On the Filters subtub of WEB-INFlib deselect ldquoquartz-all-165jarrdquo because it is already available on

the WebLogic Server 103123 Click ldquoOKrdquo

Figure 27

Click ldquoOKrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 22: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 22

Deploy your application Right click on your Project select ldquoDeployrdquo and click on ldquoSOASchedulerrdquo

Figure 28

Figure 29

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 23: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 23

Select ldquoDeploy to Application Serverrdquo Click ldquoNextrdquo

Figure 30

Select your Application Server where the Oracle SOA Suite is installed If you have not your

application server already configured Add a new connection with the green ldquo+rdquo Click ldquoNextrdquo

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 24: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 24

Figure 31

Select ldquoAdminServerrdquo Click ldquoFinishrdquo

If deployment successful the message window shows following

Figure 32

Test your SOAScheduler When the application SOAScheduler is deployed the SOA composite bpel-101-helloworld is executed

every 5 minutes You will find this in the Oracle Enterprise Manager at httpserverportem eg

httplocalhost7001em

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 25: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 25

Figure 33

By click on one ldquoInstance IDrdquo you will get the details of the SOA compsite

Figure 34

Figure 35

You will find also some output in your server log file

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 26: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 26

Advanced Configuration

Calling the SOAScheduler Servlet and StartingStopping the SOAScheduler You can go to httpserverportSOASchedulersoaschedulerservlet and will see the next and the

last run of the trigger eg httplocalhost7001SOASchedulersoaschedulerservlet

This servlet has a parameter with the name action Valid values are ldquostartrdquo ldquostoprdquo and ldquosinglerdquo

start Start the SOAScheduler if it has been previously stopped

Stop Stop the SOAScheduler

single Start the job immediately Works only if the scheduler is running

eg httplocalhost7001SOASchedulersoaschedulerservlet action=stop

Business Calendar In the SOASchedulerServlet is an example how to add holidays to the calendar If you want to use this

feature you have to uncomment this coding and to add the correct date for your local holidays

Add the holiday calendar to the schedule

AnnualCalendar holidays = new AnnualCalendar()

fourth of July (July 4)

Calendar fourthOfJuly = new GregorianCalendar(2011 7 4)

holidayssetDayExcluded(fourthOfJuly true)

halloween (Oct 31)

Calendar halloween = new GregorianCalendar(2011 9 31)

holidayssetDayExcluded(halloween true)

christmas (Dec 25)

Calendar christmas = new GregorianCalendar(2011 11 25)

holidayssetDayExcluded(christmas true)

tell the schedule about our holiday calendar

schedaddCalendar(holidays holidays false false)

SOAScheduler in a Cluster You can use this SOAScheuler in a cluster Quartz ndash the software used by the SOAScheduler - ships

with well-proven clustering capabilities that offer scaling and high availability features You can read

about these features in the Quartz Configuration Reference You will need to setup a JDBC-JobStore

See httpwwwquartz-schedulerorgdocsconfigurationConfigJDBCJobStoreClusteringhtml

Examples for cron expressions A cron expression is a string comprised of 6 or 7 fields separated by white space Field Name Mandatory Allowed Values Allowed Special Characters

Seconds YES 0-59 -

Minutes YES 0-59 -

Hours YES 0-23 - L W

Day of month YES 1-31 - L W

Month YES 1-12 or JAN-DEC -

Day of week YES 1-7 or SUN-SAT - L

Year NO empty 1970-2099 -

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)

Page 27: Configure a SOAScheduler for a composite in SOA …...By Robert Baumgartner, Senior Solution Architect ORACLE November 2010 Scheduler for the Oracle SOA Suite 11g: SOAScheduler Page

Scheduler for the Oracle SOA Suite 11g SOAScheduler Page 27

Examples for cron Expression Meaning

0 0 12 Fire at 12pm (noon) every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 Fire at 1015am every day

0 15 10 2005 Fire at 1015am every day during the year 2005

0 14 Fire every minute starting at 2pm and ending at 259pm every day

0 05 14 Fire every 5 minutes starting at 2pm and ending at 255pm every day

0 05 1418 Fire every 5 minutes starting at 2pm and ending at 255pm AND fire every 5 minutes starting

at 6pm and ending at 655pm every day

0 0-5 14 Fire every minute starting at 2pm and ending at 205pm every day

0 1044 14 3 WED Fire at 210pm and at 244pm every Wednesday in the month of March

0 15 10 MON-FRI Fire at 1015am every Monday Tuesday Wednesday Thursday and Friday

0 15 10 15 Fire at 1015am on the 15th day of every month

0 15 10 L Fire at 1015am on the last day of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L Fire at 1015am on the last Friday of every month

0 15 10 6L 2002-2005 Fire at 1015am on every last Friday of every month during the years 2002 to 2005

0 15 10 63 Fire at 1015am on the third Friday of every month

0 0 12 15 Fire at 12pm (noon) every 5 days every month starting on the first day of the month

0 11 11 11 11 Fire every November 11th at 1111am

See httpwwwquartz-schedulerorgdocstutorialscrontriggerhtml

Tested with Oracle SOA Suite 11g(11113)