Queuing and executing a mechanism

In my web service, all method calls send jobs to the queue. Basically, these operations take a lot of time, so all these operations send the job to the queue and return the status "Sent". The client then polls using a different service method to check the status of the job.

I am currently creating my own Queue, Job Serializable classes and storing these jobs (i.e. their sequential byte stream format) in the database. Thus, the UpdateLogistics operation simply pauses the "UpdateLogisticsJob" in the queue and returns. I wrote my own JobExecutor, which wakes up every N seconds, scans the database table for any existing jobs, and executes them. Please note that jobs must be saved as these jobs must withstand failures of server applications.

This was done a long time ago, and I used special classes for my queues, jobs, performers, etc. But now I would like to know if someone has done something like this before? In particular,

  • Is there a framework for this? Something in Spring / Apache etc.
  • Any infrastructure that is easy to adapt / debug and play well with libraries like Spring will be great.

EDIT - Quartz

Sorry, if I haven’t explained more yet, Quartz is good for stateless tasks (as well as for some tasks while maintaining working capacity), but the key for me is the “task instances” (not just tasks or tasks), which are very state-stable. So, for example, an operation executeWorkflow("SUBMIT_LEAVE")can actually create 5 job instances, each of which contains at least 5-10 parameters, such as userId, accountId, etc., which will be stored in the database.

I was looking for some support around this area where job instances can be stored in the database and recreated, etc.?

+3
4

JBoss jBPM. , . , , .

+2

Quartz, , , .

0

spring -

0

Source: https://habr.com/ru/post/1745984/


All Articles