I've been working on creating a Web Service Listener that will poll a web service and then execute an action pipeline. We have no option but to poll very frequently to have a good enough response time, so the need to be able have a little more control over when a service is triggered emerged.
After having refactored the polling to be able to use it for the WSListener, I had a chat with TomF about this matter and this a suggestion for scheduling of services.
Below is an example of what a configuration of scheduling could look like (example is from the helloworld_file_action quickstart):
<fs-listener name="FileGateway" busidref="helloFileChannel" maxThreads="1" is-gateway="true"> <property name="cronExpression" value="0/30 * * * * ?" /> <property name="startDate" value="07-07-08 19:17:00" /> <property name="endDate" value="07-07-08 19:20:00" /> <!-- or simply specify <property name="pollLatencySeconds" value="10" /> <property name="repeatCount" value="6" /> --> </fs-listener>
The properties startDate and endDate are optional, aswell as the repeatCount if one want's to specify a pollLatencySeconds like you can do in the current code base.
The scheduling uses Quartz and the cronExpression is a Quartz CronExpression.
An AbstractScheduler that extends AbstractThreadedManagedLifecycle has been created which can be "inserted" into the inheritence chain, which is what has been done for AbstractFileGateway. I didn't want to have to refactor too much of the code and this felt like way to not have to.
This is the first time I've used Quartz so if anyone has used it before it would be great if you could take a look:)
This would not only let services like gateways and listener so be scheduled, it should be usable for other types of service that to not need to call an action pipeline, like BAM services for gathering statistics for example.
This can be found in the workspace http://anonsvn.jboss.org/repos/labs/labs/jbossesb/workspace/dbevenius/wslistener if anyone feels like trying it out. Just do a normal build and then start the jbossesb-server, then run the helloworld_file_action quickstart.
Any suggestions, additional requirements and comments are welcome.