Editing and scheduling background jobs


Editing the job description

Determining whether the job is active

Setting transaction tracking for the background job

Selecting the Quartz cluster used by the job

Providing additional comments about the job

Scheduling the job

Creating queue information for the job (selected jobs only)


Editing the job description

On the Background Job Maintenance page, in the Description field, you can edit the text description of the background job. You cannot edit the database name.

Determining whether the job is active

The Active check box determines whether the job is active and will run on the set schedule. To make the job active, check the Active check box. To make the job inactive, uncheck the check box.

Setting transaction tracking for the background job

From the Transaction tracking dropdown, select how often to record transactions for this background job. The available options are:

Record errors only Only records a transaction when there is an error.
Record both errors and the number of events processed Only records a transaction:
  • When there is an error
  • To show the number of events processed
Record full transaction information Records a transaction:

  • When a background job starts
  • When a background job is executed manually
  • When there is an error
  • To indicate the number of events processed
  • When the background job finishes

Selecting the Quartz cluster used by the job

If you have configured multiple Quartz scheduler clusters for Poetic, then from the Scheduler cluster dropdown, select the cluster to use for this background job.

If you change the cluster assigned to a background job, you must restart the application server.

Providing additional comments about the job

At the bottom of the Background Job Maintenance page is a text box where you can type any additional comments about the job.

Scheduling the job

About cron expressions

In the Schedule field, you type the schedule for running the background job. Poetic background jobs are scheduled using cron expressions.

A cron expression is a string made up of time units from seconds to years. Each unit is separated by a space. Each time unit has available values that allow you to run the job:

For example, the expression "0 0 11 ? * WED" means to run the job every Wednesday at 11:00 AM.

Elements of a cron expression

The following table lists in order the elements of a cron expression and the allowed values for each.

Unit Primary allowed values Notes/Special characters
Seconds 0-59

For example, 15 means second 15 of the minute.

Use * to specify all values (every second).

Use a / to specify an increment. The value before the slash is the second at which to start. For an increment, * and 0 before the slash mean the same thing. The value after the slash is the number of seconds in the increment. For example:

  • 0/15 or */15 means every 15 seconds during the minute, starting at second 0
  • 3/20 means every 20 seconds during the minute, starting at second 3

Use commas to separate a specific list of values. For example:

  • 5,17,33,49 means at 5, 17, 33, and 49 seconds during the minute
  • 10,45 means at 10 and 45 seconds during the minute

Use a dash to specify a range of seconds. For example, 2-5 means at 2, 3, 4, and 5 seconds during the minute.

Minutes 0-59

For example, 25 means minute 25 after the hour.

Use * to specify all values (every minute).

Use a / to specify an increment. The value before the slash is the minute at which to start. For an increment, * and 0 before the slash mean the same thing. The value after the slash is the number of minutes in the increment. For example:

  • 0/30 or */30 means every 30 minutes during the hour starting at minute 0.
  • 10/20 means every 20 minutes during the hour starting at minute 10.

Use commas to separate a list of specific values. For example:

  • 10,25,45 means at minute 10, minute 25, and minute 45 of the hour
  • 5,45 means at minute 5 and minute 45 of the hour

Use a dash to specify a range of minutes. For example, 32-36 means at minute 32, 33, 34, 35, and 36 of the hour.

Hours 0-23 (military time)

For example:

  • 9 means 9 AM
  • 18 means 6 PM

Be careful when specifying hours between midnight and 1:00 AM. Changing to or from Daylight Savings Time can cause a run to be skipped or repeated.

Use * to specify all values (every hour).

Use a / to specify an increment. The value before the slash is the hour at which to start. For an increment, * and 0 before the slash mean the same thing. The value after the slash is the number of hours in the increment. For example:

  • 0/2 means every 2 hours starting at 12:00 AM (midnight)
  • 14/4 means every 4 hours starting at 2:00 PM

Use commas to separate a list of specific values. For example:

  • 2,9,17,20 means at 2:00 AM, 9:00 AM, 5:00 PM, and 8:00 PM
  • 8,16,22 means at 8:00 AM, 4:00 PM, and 10:00 PM

Use a dash to set a range of hours. For example, 13-16 means at 1:00 PM, 2:00 PM, 3:00 PM, and 4:00 PM.

Day of the month 1-31

For example:

  • 3 means the 3rd of the month
  • 24 means the 24th of the month

Be careful when specifying days of the month to take into account days with less than 31 days.If you set the day of the month to 31, then the job will never run in February, April, June, September, and November.

Use * to specify every day of the month.

Use a / to specify an increment. The value before the slash is the day on which to start. The value after the slash is the number of days in the increment. For example:

  • 1/5 means every 5 days starting on the first of the month
  • 7/3 means every 3 days starting on the 7th of the month

Use commas to separate a list of specific values. For example, 3,14,22 means to run the job on the 3rd, 14th, and 22nd of the month.

Use a dash to set a range of dates. For example 10-14 means to run the job on the 10th, 11th, 12th, 13th, and 14th of the month.

Use ? when you don't want to specify a day of the month. For example, if you set the job to run every Tuesday, then you probably do not want to set a specific day of the month.

Use L to specify the last day of the month, no matter what day that is (28th, 30th, or 31st).

Use W to specify the weekday closest to the date specified. For example, to run the job on the weekday closest to the 15th, you would set the day-of-the-month slot to 15W. If the 15th is a Thursday, the job runs on the 15th itself. If the 15th is a Saturday, the job runs on Monday the 17th.

LW means to run the job on the last weekday of the month.

Month 1-12 or JAN-DEC Use * to specify every month.

Use a / to specify an increment. The value before the slash is the month on which to start. The value after the slash is the number of months in the increment. For example:

  • 1/6 means every 6 months starting in January
  • 3/2 means every 2 months starting in March

Use commas to separate a list of specific values. For example, JAN,JUN,NOV means to run the job in January, June, and November. 5,7,10 means to run the job in May, July, and October.

Use a dash to set a range of dates. For example, 3-5 means to run the job in March, April, and May. JUL-OCT means to run the job in July, August, September, and October.

Day of the week 1-7 or SUN-SAT Use * to specify every day of the week.

Use a / to specify an increment. The value before the slash is the day of the week on which to start. The value after the slash is the number of days in the increment. For example:

  • 1/3 means every 3 days starting on Sunday
  • 2/1 means every day starting on Monday

Use commas to separate a list of specific values. For example, MON,WED,FRI means every Monday, Wednesday, and Friday. 2,6 means every Monday and Friday.

Use a dash to set a range of days. For example, TUE-THU means every Tuesday, Wednesday, and Thursday. 4-7 means every Wednesday, Thursday, Friday, and Saturday.

Use ? when you don't want to set a day of the week. For example, if you set a day of the month, you probably don't want to set a day of the week.

Use L by itself to set the last day of the week (Saturday). Use in combination with a value to set the last of that day of the week in the month. For example 3L means the last Tuesday of the month.

Use # to specify the nth occurrence of a day of the week in the month. The value before the # is the day of the week, and the value after is the number of the occurrence. For example 5#3 means the third Thursday of the month. If an occurrence doesn't exist (for example, the day of the week is set to 3#5, but there are only four Tuesdays in the month), it is skipped.

Year Empty or 1970-2099 Use * to specify every year. An empty value also means every year.

Use a / to specify an increment. The value before the slash is the year in which to start. The value after the slash is the number of years in the increment. For example:

  • 1999/3 means every 3 years starting in 1999
  • 2000/2 means every 2 years starting in 2000

Use commas to separate a list of specific values. For example, 2008,2011 means in 2008 and 2011.

Use a dash to set a range of years. For example, 2002-2005 means in 2002, 2003, 2004, and 2005.

Sample cron expressions

Expression Meaning
0/30 * * * * ? Fire every 30 seconds
* 0/10 * * * ? Fire every 10 minutes
* * 0/4 * * ? Fire every 4 hours
0 0 12 * * ? Fire at 12pm (noon) every day
0 15 10 ? * * Fire at 10:15am every day
0 15 10 * * ? Fire at 10:15am every day
0 15 10 * * ? * Fire at 10:15am every day
0 15 10 * * ? 2005 Fire at 10:15am every day during the year 2005
0 * 14 * * ? Fire every minute starting at 2pm and ending at 2:59pm, every day
0 0/5 14 * * ? Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
0 0/5 14,18 * * ? Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day
0 0-5 14 * * ? Fire every minute starting at 2pm and ending at 2:05pm, every day
0 10,44 14 ? 3 WED Fire at 2:10pm and at 2:44pm every Wednesday in the month of March
0 15 10 ? * MON-FRI Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday, and Friday
0 15 10 15 * ? Fire at 10:15am on the 15th day of every month
0 15 10 L * ? Fire at 10:15am on the last day of every month
0 15 10 LW * ? Fire at 10:15am on the last weekday of every month
0 15 10 ? * 6L Fire at 10:15am on the last Friday of every month
0 15 10 ? * 6L Fire at 10:15am on the last Friday of every month
0 15 10 ? * 6L 2002-2005 Fire at 10:15am on every last Friday of every month during the years 2002, 2003, 2004 and 2005
0 15 10 ? * 6#3 Fire at 10:15am on the third Friday of every month

Creating queue information for the job (selected jobs only)

About background job queues

To improve performance, some background jobs allow you to configure multiple queues. If queues are allowed for the background job, then a Queue configuration text area displays on the Background Job Maintenance page.

Jobs are assigned queues based on the number of items that need to be processed.

Each queue can have multiple "lanes". The number of lanes represents the number of requests within the queue that can be processed at the same time.

Structure of the queue configuration XML

The queues are configured using an XML format. The basic structure of the queue configuration is:

xml
  QueueConfig (Used to set how often to check for new requests and the estimated number of requests that can be processed per minute)
    Queue (One for each queue. Includes the queue name, pub ID, and number of lanes.)
      Criteria (Used to set the minimum and maximum number of items a request can have in order to be assigned to the queue. The numbers cannot overlap between queues.)

Here is an example of queue configuration XML.

<?xml version="1.0" encoding="UTF-8"?>
<QueueConfig scanBatchesInMin="3" performancePerMin="1">
     <Queue name="Small batch" pubID="SM1" numLanes="3" maxParallelWorkUnits="3">
          <Criteria minCount="1" maxCount="100"/>
     </Queue>
     <Queue name="Medium batch" pubID="M2" numLanes="2" maxParallelWorkUnits="2">
          <Criteria minCount="101" maxCount="800"/>
     </Queue>
     <Queue name="Large batch" pubID="L2" numLanes="2" maxParallelWorkUnits="2">
          <Criteria minCount="801" maxCount="999999999"/>
     </Queue>
</QueueConfig>

Adding queue names to the BATCH_QUEUE_NAME list

Before you configure the queues, you must add each queue to the BATCH_QUEUE_NAME list. In the list, the queue pub ID is the list value code, and the queue name is the list value description.

If you try to configure a queue without first adding it to the BATCH_QUEUE_NAME list, an error is displayed and you will not be able to complete the queue configuration.

Queue configuration elements and attributes

The QueueConfig element provides general information about the request processing for all of the queues:

scanBatchesInMin How often each queue should check for new events to process.

For example, if scanBatchesInMin is 3, then each queue checks every 3 minutes to see if a new event has been raised.

performancePerMin The number of items that can be processed per minute. This value is used to calculate the estimated time it will take to complete a process. For example, if performancePerMin is 1, then the background job can process one item per minute.

Each queue is represented by a Queue element with the following attributes:

name Required. The name of the queue. This is the list value description for the queue in the BATCH_QUEUE_NAME list.
pubID Required. The pub ID of the queue. This is the list value code for the queue in the BATCH_QUEUE_NAME list.
numLanes Required. The number of lanes in the queue (number of events that can be processed simultaneously. Must be at least 1, indicating that only one event can be processed at a time.
maxParallelWorkUnits The number of work units that can be processed simultaneously within each lane.

A work unit represents a single transaction within a request. For example, for batch activation, a work unit represents a single machine. For batch rehost, a work unit represents a single from/to machine group.

When maxParallelWorkUnits is 3, then up to 3 work units can be processed simultaneously. For batch activation, that would mean up to three machines could be processed at a time.

Each Queue element contains a Criteria element to specify the minimum and maximum number of items a request must have in order to be assigned to that queue. For example, you could create one queue to process requests with less than 100 items, one to process requests greater than 100 but less than 800 items, and another to process requests greater than 800 items.

The numbers cannot overlap between queues. For example, you cannot create queue that processes requests with less than 200 items, and another that processes requests greater than 100 items.

If you have only one queue, you do not need to provide queue criteria.

The Criteria attributes are:

minCount The minimum number of items.
maxCount The maximum number of items.

Resetting the cache after changing the queue configuration

If you change the queue configuration, then after you save the changes to the background job, you must also reset the server cache.