What structure can be used for advanced planning of work in Java?

In my application, I need to run background tasks periodically (which I can easily do with Quartz, i.e., schedule a task that will run periodically at certain times).

But I would like to have a little more control. In particular, I need:

  • reboot the system that was not started at the scheduled time (i.e. the server was not working, and because of this, the task was not started. In this situation, I want the "late" task to be performed by ASAP)
  • it would be nice to easily manage tasks, i.e. run a task on demand or see when the last task was executed, or transfer a task that will be executed at another time

It seems to me that the above points can be achieved with the help of Spring Batch Admin, but I have no experience in this area yet. In addition, I saw a lot of posts about how Spring Batch is not a planning tool, so I am starting to doubt what the right tool to work here.

So my question is: can this be achieved with Spring Batch Admin? Or maybe quartz is enough, but you need to tune it to make it higher? Or maybe I need both? Or something else?

Thank you very much :) Peter

+4
source share
1 answer

the system will restart a task that was not started at the scheduled time

This feature in Quartz is called Skipping Instructions and does exactly what you need, but is much more flexible. All you need to do is define a JDBCJobStore .

it would be nice to easily manage tasks - for example, launch a task on demand or see when the last task was completed, or transfer a task that will be executed at another time

You can use Quartz JMX to access various information (for example, previous and next runtimes) or directly access quartz database tables. There are also free and commercial basex management tools at the above input. I believe that you can also manually complete tasks there.

Spring Package can be integrated using quartz, but does not replace it.

+4
source

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


All Articles