Saving JavaQuartz

I am not very good at Java Quartz, we just used the test task, which is scheduled daily. For our Struts2 web application, we want to run several daily tasks that are scheduled at different times of the day. Workstations must be in a save state, so even if jobs are not running due to a server or application failure, they must be rerun later when the server is finished. I can also save the status / results of tasks in the database to track tasks. Any suggestions would be helpful.

- thanks

+6
source share
3 answers

All that you mentioned is possible in the Quartz scheduler, and there is already a function with triggers, which we usually call Misfire Instructions , this is what doc is talking about.

Another important property of a trigger is its “misfire instruction”. Skipping gaps occur if a constant trigger “misses” the response time due to the scheduler stopping or due to the lack of available threads in the Quartz thread pool to complete the task. Different types of triggers have different skipping instructions. By default, they use the smart policy command, which has dynamic behavior based on the type and configuration of the trigger. When the scheduler starts, it searches for any persistent triggers that are missed, and then updates each of them based on their individually configured skip instructions. When you start using Quartz in your own projects, you should familiarize yourself with the skip instructions that are defined in these types of triggers and explained in their JavaDoc. More information about skipping instructions will be provided in the lessons of the lessons specific to each type of trigger.

In terms of job preservation, Quartz comes with a small build mechanism and all you need to install JobStore as JDBCJobStore

I suggest you go with the Quartz scheduler document its pretty easy and have lots of tutorials and examples to get you started.

If you are not using Spring in your application, there is no need to add an extra layer of abstraction and dependencies.

+6
source

You can use quartz in combination with a sprig batch .

The first provides an API for managing various threads (as difficult as possible), permanent storage of the task status and api for monitoring and restarting tasks in accordance with their execution status. Another convenient Spring Batch admin library. It has a web console and 5 minutes of guidance.

Quartz is used as the state of the job task scheduler, processed by the Spring package. It can work as a standalone java application, as well as in a web / application container (Tomcat was enough for me).

Good luck

+2
source

We have Job stores api in Java Quartz. This will store data in Job information databases. So I think this will help you. You can check this link to get an idea of ​​the structure of the code and the database.

+1
source

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


All Articles