个人学习,有误见谅

1.Quartz定时轮询使用者调度器

   Using QuartzScheduledPollConsumerScheduler

   介绍:The ​​Quartz​​ component provides a Polling Consumer scheduler

             which allows to use cron based scheduling for ​​Polling Consumer​

            such as the File and FTP consumers.



    例子:

          For example to use a cron based expression to poll for files every 2nd second,

          then a Camel route can be define simply as:

              from("file:inbox?scheduler=quartz&scheduler.cron=0/2+*+*+*+*+?")

             .to("bean:process");

     注意:Notice we define the ​​scheduler=quartz​​ to instruct Camel to use the ​​Quartz​​ based scheduler.

               Then we use ​​scheduler.xxx​​ options to configure the scheduler.

               The ​​Quartz​​ scheduler requires the cron option to be set.

     支持的选项:

              The following options is supported:

             1.quartzScheduler(类型:org.quartz.Scheduler):

                 To use a custom Quartz scheduler.

                 If none configure then the shared scheduler

                 from the ​​Quartz​​ component is used.

             2.cron(类型:String):

                 Mandatory: To define the cron expression for triggering the polls.

             3.triggerId(类型:String):

                 To specify the trigger id. If none provided then an UUID is generated and used.

             4.triggerGroup(默认:QuartzScheduledPollConsumerScheduler,类型:String ):

                  To specify the trigger group.

             5.timeZone(类型:TimeZone):

                  The time zone to use for the CRON trigger.

 

     注意:

            Important:

                Remember configuring these options from the endpoint

                URIs must be prefixed with ​​scheduler.​​.

                For example to configure the trigger id and group:

               from("file:inbox?scheduler=quartz&scheduler.cron=0/2+*+*+*+*+?

                                                                    &scheduler.triggerId=myId

                                                                    &scheduler.triggerGroup=myGroup")

              .to("bean:process");

          基于Spring框架的定时任务调度:

          There is also a CRON scheduler in Spring, so you can use the following as well:

          from("file:inbox?scheduler=spring&scheduler.cron=0/2+*+*+*+*+?")

          .to("bean:process");

 

2.Cron Component Support(Cron表达式的配置)

   The Quartz component can be used as

    implementation of the Camel Cron component.

    Maven users will need to add the following

   additional dependency to their ​​pom.xml​​:

      <dependency>

          <groupId>org.apache.camel</groupId>

          <artifactId>camel-cron</artifactId>

         <version>x.x.x</version>

         <!-- use the same version as your Camel core version -->

    </dependency>

    只是基于Cron组件的定时任务调度:

          Users can then use the cron component instead of the quartz component,

         as in the following route(演示的是定時的MQ處理):

           from("cron://name?schedule=0+0/5+12-18+?+*+MON-FRI")

        .to("activemq:Totally.Rocks");

 

3.结合Spring Boot配置

   Spring Boot Auto-Configuration

   When using quartz with Spring Boot make sure to use the following

   Maven dependency to have support for auto configuration:

           <dependency>

             <groupId>org.apache.camel.springboot</groupId>

             <artifactId>camel-quartz-starter</artifactId>

             <version>x.x.x</version>

            <!-- use the same version as your Camel core version -->

        </dependency>

    支持以下选项:

    The component supports 14 options, which are listed below.

     1.camel.component.quartz.auto-start-scheduler:

        Whether or not the scheduler should be auto started. This options is default true

     2.camel.component.quartz.basic-property-binding:

        Whether the component should use basic property binding (Camel 2.x)

        or the newer property binding with additional capabilities

    3.camel.component.quartz.bridge-error-handler

        Allows for bridging the consumer to the Camel routing Error Handler,

        which mean any exceptions occurred while the consumer is trying to

        pickup incoming messages, or the likes, will now be processed as a

        message and handled by the routing Error Handler. By default the consumer

        will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,

        that will be logged at WARN or ERROR level and ignored.

    4.camel.component.quartz.enable-jmx

        Whether to enable Quartz JMX which allows to manage

        the Quartz scheduler from JMX. This options is default true

    5.camel.component.quartz.enabled:

       Whether to enable auto configuration of the quartz component.

       This is enabled by default.

    6.camel.component.quartz.interrupt-jobs-on-shutdown(interrupt:打断)

      Whether to interrupt jobs on shutdown which forces the scheduler

      to shutdown quicker and attempt to interrupt any running jobs.

      If this is enabled then any running jobs can fail due to being interrupted.

   7.camel.component.quartz.prefix-instance-name(instance:实例):

      Whether to prefix the Quartz Scheduler instance name with the CamelContext name.

      This is enabled by default, to let each CamelContext use its own Quartz scheduler instance by default.

      You can set this option to false to reuse Quartz scheduler instances between multiple CamelContext’s.

   8.camel.component.quartz.prefix-job-name-with-endpoint-id

      Whether to prefix the quartz job with the endpoint id. This option is default false.

   9.camel.component.quartz.properties

     Properties to configure the Quartz scheduler.

  10.camel.component.quartz.properties-file

      File name of the properties to load from the classpath

   11.camel.component.quartz.properties-ref

       References to an existing Properties or Map to lookup

       in the registry to use for configuring quartz.

   12.camel.component.quartz.scheduler

        To use the custom configured Quartz scheduler,

        instead of creating a new Scheduler.

       The option is a org.quartz.Scheduler type.

   13.camel.component.quartz.scheduler-factory

       To use the custom SchedulerFactory which is used to create the Scheduler.

       The option is a org.quartz.SchedulerFactory type.

    14.camel.component.quartz.start-delayed-seconds

         Seconds to wait before starting the quartz scheduler.