springBoot Quartz integration framework

    

A: Quartz framework

  What is Quartz: Quartz is a Java open source project OpenSymphony open source organization, in 2009 was acquired by Terracotta

  Quartz is what to do: to do something at a certain specified time, Quartz is to define a trigger condition, it would be responsible to a point in time (to meet the conditions for a trigger event) triggers the appropriate task  

  For example Quartz things you can do (in the case of life):

     1 year birthday

     2, flower chanting monthly repayment

     3, at intervals of one hour, back up your study notes

  Quartz features:

    1, a powerful scheduling features, such as support for a variety of scheduling

    2, flexible application ways, such as supporting a variety of combinations and task scheduling

    3, distributed and clustering capabilities, Terracotta after the acquisition, the original function has been further upgrade
  The main concept of Quartz
    1, the scheduler (Scheduler): Core Quartz is the scheduler, the scheduler is responsible for managing Quartz application runtime environment scheduler not do all the work on their own, relying instead on some very important components in the framework. To ensure scalability, Quartz-based architecture uses a multi-threaded. At startup, the initialization of a frame worker thread, this thread scheduler to perform a predetermined job. This is how Quartz can run multiple jobs concurrently principle. Quartz dependent member of a loosely coupled thread pool management thread to manage the environment.
    2, task (Job): is what we have written business logic, to help us perform quartz.
    3, triggers (Trigger): When did you begin, end execution when the conditions of the event triggers
  Quartz relationship between the basic elements as shown below:
      
  SpringBoot Quartz integration framework:
    The basic process:
      1, first create a maven project
      2, and introduced into the base Quartz dependent dependent
       

       3, create a configuration class uses Quartz @Configuration annotation, this annotation is equivalent to the xml tag, it will be used @bean notes, the equivalent tag, usually used in conjunction with both

        

      4, a write scheduler  

        

 

         Method scheduler:

          1, fixedDelay in N seconds after the trigger unit on a task ms

          

          2, fixedRate after N seconds on a start task begins milliseconds

          

 

          3, cron = complex scheduling period after the equals sign is an expression cron = "expression" expression format: the expression: [sec] [min] [time] [day] [month] [weeks] [Y] in generally do not set

            

 

          cron expression wildcards: Wildcard generate website: https: //qqe2.com/cron

           1, * represents all values. For example: In the sub-field setting * indicates every minute trigger.

            2 ,? said they did not specify a value, do not need to be concerned about the current setting value of this field

            3, - representing the interval. For example, set up "10-12" on the hour, 10, 11, represents the point triggers

            4 ,, represents specify multiple values, such as setting "MON, WED, FRI" in the week field said on Monday, Wednesday and Friday trigger

            5, / for incrementing trigger. 0/5 every 5 seconds

               6, L represents the last meaning W represents the weekday closest to the specified date (Monday to Friday)

            7, # number (represented in the first few days of the week each month), for example, is provided in the peripheral field "6 # 3" represents the third Saturday of each month

 
  

Guess you like

Origin www.cnblogs.com/snyv-nice/p/12606877.html