Job queueing and execute Mechanism
Posted
by Calm Storm
on Stack Overflow
See other posts from Stack Overflow
or by Calm Storm
Published on 2010-05-18T13:16:01Z
Indexed on
2010/05/18
13:20 UTC
Read the original article
Hit count: 190
In my webservice all method calls submits jobs to a queue. Basically these operations take long time to execute, so all these operations submit a Job to a queue and return a status saying "Submitted". Then the client keeps polling using another service method to check for the status of the job.
Presently, what I do is create my own Queue, Job classes that are Serializable and persist these jobs (i.e, their serialized byte stream format) into the database. So an UpdateLogistics operation just queues up a "UpdateLogisticsJob" to the queue and returns. I have written my own JobExecutor which wakes up every N seconds, scans the database table for any existing jobs, and executes them. Note the jobs have to persisted because these jobs have to survive app-server crashes.
This was done a long time ago, and I used bespoke classes for my Queues, Jobs, Executors etc. But now, I would like to know has someone done something similar before? In particular,
- Are there frameworks available for this ? Something in Spring/Apache etc
- Any framework that is easy to adapt/debug and plays well along with libraries like Spring will be great.
© Stack Overflow or respective owner