A Quartz Scheduler JobStore that uses Redis for persistent storage.
To get Quartz up and running quickly with RedisJobStore, use the following example to configure your quartz.properties file:
# setting the scheduler's misfire threshold, in milliseconds
org.quartz.jobStore.misfireThreshold: 60000
# setting the scheduler's JobStore to RedisJobStore
org.quartz.jobStore.class: com.garantia.quartz.RedisJobStore
# setting your redis host
org.quartz.jobStore.host: <your_redis_host>
# setting your redis port
org.quartz.jobStore.port: <your_redis_port>
# setting your redis password (optional)
org.quartz.jobStore.password: <your_redis_password>
# setting a 'releaseTriggersInterval' will trigger a mechanism for releasing triggers of non-alive schedulers in a given interval, in milliseconds
org.quartz.jobStore.releaseTriggersInterval: 600000
# setting a path for writing the scheduler's id, in order to release triggers of previous schedulers on startup
org.quartz.jobStore.instanceIdFilePath: /etc/quartz
RedisJobStore uses the jedis and gson libraries, so you'll have to download them and add them to your project's classpath or define the relevant Maven dependencies:
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
RedisJobStore attempts to be fully compliant with all of Quartz's features, but currently has some limitations that you should be aware of:
- Only
SimpleTriggerandCronTriggerare supported. - For any
GroupMatcher, only aStringOperatorName.EQUALSoperator is supported. You should note that if your scheduler is designed to compare any group of jobs, triggers, etc. with a pattern-based matcher. RedisJobStoreis designed to use multiple schedulers, but it is not making any use of theorg.quartz.scheduler.instanceName. The only limitation here is that you should maintain the uniquness of your trigger_group_name:trigger_name, and your job_group_name:job:name and you'll be good to go with multiple schedulers.
To better understand the workflow and the behavior of a Quartz Scheduler using a RedisJobStore, you may want to review the redis schema in which the RedisJobStore is making a use of, at: add_schema_link