Java CAPS 6, Scheduler for JCA and JBI Projects, Note
By Michael.Czapski on Jul 23, 2008
Java CAPS 5.x used to have a Scheduler eWay. Java CAPS 6 also has the Scheduler eWay but only on the Repository-based side. At this point in time there is no Scheduler JCA Adapter or a Scheduler Binding Component. Why would one be bothered by that? One would be bothered because there are business requirements that call for scheduling of activities. The one that comes to mind immediately is polling an FTP server for a file which to transfer. For polling the local file system there is the Batch Inbound JCA, which was used in solutions discussed in JCA Notes 2 and 3. For Batch FTP JCA there is no such thing.
Rather then ignoring the issue of lack of the Scheduler JCA Adapter I determined to see what can be done to provide this functionality for non-Repository-based Java CAPS 6 solutions.
When asked, one of my colleagues in the US suggested that EJB Timers are the way to go and provided the links to the material. I looked at what was discussed, threw up my hand in the air and exclaimed. I will not quote what I said. In short, EJB Timers may be all very well for a competent Java EE developer but not for a regular Integration, or SOA, developer. EJB Timers are, in my view, way too complex to implement and do not offer sufficient advantage over a Scheduler eWay to make it worth while to spend the time developing a solution that uses them.
The next thing I looked at was the open source Quarz scheduler, which also turned up to require more effort then I considered worth while for the Notes.
I felt that the simplest thing to do will be to use an external scheduler, a native one, provided by the OS. For Windows, on which I develop for the Notes, there is the “Scheduled Tasks” scheduler. For Unix there are Cron facilities. Both are well know and typically good enough in terms of timer resolution and scheduling flexibility. Above all else, using one does not require me to write scheduler code myself, merely write the code that triggers my solution when the scheduled event fires.
So, this Note walks through implementation of a Scheduler solution, which can be used to trigger a Batch FTP JCA solution or any other JCA-based or JBI-based solution that has to be triggered to some schedule.
Document 00Scheduler.pdf contains the entire Note.