...
ServiceMix Quartz
The servicemix-quartz ServiceMix Quartz component is a standard JBI Service Engine able to schedule and trigger jobs using the great Quartz scheduler.
...
Maven Archetype
You can use Maven servicemix-quartz
...
Installation
Installing the servicemix-quartz component can be done in several ways:
- drop the installer zip in an hotdeploy directory monitored by ServiceMix
- using ant tasks
Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console.
Info |
---|
To configure the internal Quartz Component (eg cluster, database, plugin), put quartz.properties into SERVICEMIX_HOME |
Service Unit packaging
A service unit will typically consist in:
- an
xbean.xml
configuration file
Content of xbean.xml file to be packaged as a SU
...
<beans xmlns:quartz="http://servicemix.apache.org/quartz/1.0">
... add endpoints here ...
</beans>
-service-unit archetype to create a Quartz service unit:
Code Block |
---|
mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-quartz-service-unit \
-DarchetypeVersion=2010.01 \
-DgroupId=your.group.id \
-DartifactId=your.artifact.id \
-Dversion=your-service
|
Endpoint Configuration
The Quartz
Using servicemix-quartz in a ServiceMix xml configuration file
...
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:quartz="http://servicemix.apache.org/quartz/1.0">
<sm:container ...>
<sm:activationSpecs>
<sm:activationSpec>
<sm:component>
<quartz:component>
<quartz:endpoints>
... add quartz endpoints here ...
</quartz:endpoints>
</quartz:component>
</sm:component>
</sm:activationSpec>
...
</sm:activationSpecs>
</sm:container>
...
</beans>
Quartz endpoint
The quartz endpoint can be used to fire message exchanges at a given (recurrent) time.
Examples:
Code Block | ||||
---|---|---|---|---|
| ||||
<quartz:endpoint service="test:service" endpoint="endpoint1" targetService="test:receiver1"> <quartz:trigger> <quartz:cron cronExpression="0/5 * * * * ?" /> </quartz:trigger> </quartz:endpoint> |
Code Block | ||||
---|---|---|---|---|
| ||||
<quartz:endpoint service="test:service" endpoint="endpoint2" targetService="test:receiver2"> <quartz:trigger> <quartz:simple repeatCount="0" repeatInterval="1000" /> </quartz:trigger> </quartz:endpoint> |
Code Block | ||||
---|---|---|---|---|
| ||||
<quartz:endpoint service="test:service" endpoint="endpoint3" targetService="test:receiver3"> <quartz:jobDetail> <quartz:jobDetail> <quartz:jobDataAsMap> <quartz:property key="xml"><![CDATA[ <hello>world</hello> ]]></quartz:property> </quartz:jobDataAsMap> </quartz:jobDetail> </quartz:jobDetail> <quartz:triggers> <quartz:simple repeatCount="0" repeatInterval="1000" /> <quartz:cron cronExpression="0 * 1 * * ?" /> </quartz:triggers> <quartz:marshaler> <bean class="org.apache.servicemix.quartz.CustomMarshaler" /> </quartz:marshaler> </quartz:endpoint> |
...