Quartz
JVM since1.0.0 Native since1.0.0
Schedule sending of messages using the Quartz 2.x scheduler.
What’s inside
-
Quartz component, URI syntax:
quartz:groupName/triggerName
Please refer to the above link for usage and configuration details.
Maven coordinates
Or add the coordinates to your existing project:
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-quartz</artifactId>
</dependency>
Check the User guide for more information about writing Camel Quarkus applications.
Usage
Clustering
There are two options how to run Quartz in clustered mode:
Quarkus based
This is the preferred option. Follow the scheduling periodic tasks quartz guide.
-
Define database configuration in
application.properties
. -
Use for example
flyway
to create database tables required forQuartz
.
Quartz based with an Agroal datasource
Follow the Configure Clustering with JDBC-JobStore Guide with different DS configuration:
-
Declare to use
io.quarkus:quarkus-agroal
inpom.xml
explicitly.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
-
Use
quartz.properties
to configure theJobStore
. -
Define a datasource via quarkus (see the Quarkus datasource documentation) and use
CamelQuarkusQuartzConnectionProvider
as theConnectionProvider
inquartz.properties
:
...
org.quartz.jobStore.dataSource = myDS
# datasource configuration
org.quartz.dataSource.myDS.connectionProvider.class = org.apache.camel.quarkus.component.quartz.CamelQuarkusQuartzConnectionProvider
org.quartz.dataSource.myDSB.dataSourceName = ds_name_if_not_set_default_ds_will_be_used
-
You can use for example
flyway
to create database tables required forQuartz
.
Quartz based
You can follow the Configure Clustering with JDBC-JobStore Guide without any modification:
...
org.quartz.jobStore.dataSource = myDS
# datasource configuration
org.quartz.dataSource.myDS.driver = org.postgresql.Driver
# datasource configuration
org.quartz.dataSource.myDS.URL=jdbc:postgresql://localhost:5432/default
org.quartz.dataSource.myDS.user = quarkus
org.quartz.dataSource.myDS.password = quarkus