View Source

{section}
{column}

h1. Scheduling service invocations (Consumes mode)

h2. Usage

Since this component only supports consuming configurations, no WSDL is required.
However, the messages sent by this component must respect the WSDL of the invoked service.
One way to ensure that is to generate the message's XML skeleton from the WSDL of the target service.
A tool like SoapUI works well for this kind of task.

The messages sent by this component are sent with the *InOnly* pattern.
It is not possible to add file attachments in the sent messages. These messages only have an XML payload.
This message is sent every time the time expression is reached.

Time expressions are CRON expressions. The syntax is explained on the [website of the Quartz project|http://www.quartz-scheduler.org/].
Below are given some sample CRON expressions and their meaning.

{column}
{column:width=25%}
{panel:title=Table of contents}{toc:outline=true}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list|showAnonymous=true|showCount=true|showLastTime=true}{panel}
{column}
{section}

|| CRON expression || Meaning ||
| 0 0 12 * * ? | Fire at 12pm (noon) 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 ? * 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. |
| 0 0 12 1/5 * ? | Fire at 12pm (noon) every 5 days every month, starting on the first day of the month. |


h2. JBI Descriptor

The Quartz component is configured with a CRON expression, the identifiers of a service to call and an XML message request to send to the service.
You have to deploy a service-unit with a JBI descriptor containing a *consumes* section with the right parameters.

\\
Here is a sample of a SU JBI descriptor to call a Hello service with <text>hello</text> message, at 10:15am every day during the year 2005.
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>

<!-- JBI descriptor for PEtALS' "petals-se-quartz" (QUARTZ), version 1.1 -->
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:quartz="http://petals.ow2.org/components/quartz/version-1"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:generatedNs="http://petals.ow2.org/components/hello/version-3.0">

<jbi:services binding-component="false">
<jbi:consumes
interface-name="generatedNs:Hello"
service-name="generatedNs:HelloSrv"
endpoint-name="HelloSrvEndpoint">

<!-- CDK specific elements -->
<petalsCDK:operation>sayHelloOperation</petalsCDK:operation>
<petalsCDK:mep>InOnly</petalsCDK:mep>

<!-- Component specific elements -->
<quartz:cron-expression>0 15 10 * * ? 2005</quartz:cron-expression>
<quartz:content><![CDATA[
<text>hello</text>
]]></quartz:content>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{code}

\\
A JBI descriptor for a Quartz service-unit can only define one _consumes_ block.

{include:0 CDK SU Consume Configuration}
\\
{center}{*}Configuration of a Service Unit to consume a service (Quartz)*{center}
{table-plus}




|| Parameter || Description || Default || Required ||
| cron-expression | A CRON expression, for example *0 30 10-13 ? * WED,FRI*: trigger that fires at 10:30, 11:30, 12:30, and 13:30, on every Wednesday and Friday. | {center}\-{center} | {center}Yes{center} |
| content | The XML message to send to the scheduled service. Must be included in a CDATA section, as shown in the sample jbi.xml above. | {center}\-{center} | {center}Yes{center} |
{table-plus}
{include:0 CDK SU Interceptor configuration}


h2. Service-Unit content

The service-unit must only contain the JBI descriptor.

The directory structure of a SU for the Quartz component looks like this:

{noformat}
su-quartz-SchedulerName-consume.zip
+ META-INF
- jbi.xml
{noformat}


h1. Configuring the component

This component has no specific parameter in its configuration.
It only has the inherited ones from the CDK.


{include:0 CDK Component Configuration Table 5.4.0}
{include:0 CDK Parameter scope}
{include:0 CDK Component Interceptor configuration}