Quartz Hazelcast JobStore

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

Categories

Categories

Hazelcast Application Layer Libs Distributed Applications Quartz Job Scheduling
GroupId

GroupId

com.github.erwan-boulard
ArtifactId

ArtifactId

quartz-hazelcast-jobstore
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

bundle
Description

Description

Quartz Hazelcast JobStore
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

https://github.com/erwan-boulard/quartz-scheduler-hazelcast-jobstore/

Download quartz-hazelcast-jobstore

Dependencies

compile (6)

Group / Artifact Type Version
org.quartz-scheduler : quartz jar 2.2.3
org.quartz-scheduler : quartz-jobs jar 2.2.3
com.hazelcast : hazelcast-client jar 3.8.1
com.hazelcast : hazelcast jar 3.8.1
org.slf4j : slf4j-api jar 1.7.7
com.google.guava : guava jar 20.0

test (6)

Group / Artifact Type Version
org.testng : testng jar 6.8.13
junit : junit jar 4.12
org.hamcrest : hamcrest-core jar 1.3
org.slf4j : slf4j-log4j12 jar 1.7.7
org.assertj : assertj-core jar 2.6.0
joda-time : joda-time jar 2.9.7

Project Modules

There are no modules declared in this project.

Quartz-Scheduler Hazelcast Job Store Build Status

An implementation of a Quartz Scheduler Job Store using Hazelcast distributed Maps and Sets.

Fork compatible with JDK7

This implementation is based on Ameausoone/quartz-hazelcast-jobstore.

About Quartz

Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components that may execute virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as support for JTA transactions and clustering.

Job Stores in Quartz

JobStore's are responsible for keeping track of all the "work data" that you give to the scheduler: jobs, triggers, calendars, etc. Selecting the appropriate JobStore for your Quartz scheduler instance is an important step. Luckily, the choice should be a very easy one once you understand the differences between them. You declare which JobStore your scheduler should use (and it's configuration settings) in the properties file (or object) that you provide to the SchedulerFactory that you use to produce your scheduler instance.

Read More

About Hazelcast

Hazelcast is an in-memory open source software data grid based on Java. By having multiple nodes form a cluster, data is evenly distributed among the nodes. This allows for horizontal scaling both in terms of available storage space and processing power. Backups are also distributed in a similar fashion to other nodes, based on configuration, thereby protecting against single node failure.

Read More

Adding Dependency

<dependency>
    <groupId>com.github.erwan-boulard</groupId>
    <artifactId>quartz-hazelcast-jobstore</artifactId>
    <version>1.1.0</version>
</dependency>

Clustering

When using Hazelcast Job Store we rely on Hazelcast to provide a Cluster where our jobs are stored. This way we can easily have a cluster of Quartz Scheduler instances that share the same data.

Persisting Data

Note that you can use Hazelcast MapStores to store all the data in your in-memory Maps in a datastore like Cassandra, Elasticsearch, PostgreSQL, etc (synchronously or asynchronously). Learn more about it here.

Testing it

Pre-requisites

  • JDK 7 or newer
  • Maven 3.1.0 or newer

Clone

git clone https://github.com/erwan-boulard/quartz-scheduler-hazelcast-jobstore.git
cd quartz-scheduler-hazelcast-jobstore

Build

mvn clean install

How to Use HazelcastJobStore with Quartz

// Setting Hazelcast Instance
HazelcastJobStore.setHazelcastClient(hazelcastInstance);

// Setting Hazelcast Job Store
Properties props = new Properties();
props.setProperty(StdSchedulerFactory.PROP_JOB_STORE_CLASS, HazelcastJobStore.class.getName());

StdSchedulerFactory scheduler = new StdSchedulerFactory(props).getScheduler();

// Starting Scheduler
scheduler.start();

// Scheduling job
JobDetail job = JobBuilder.newJob(jobClass).withIdentity(jobName, grouName).build();
Trigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerName, triggerGroup).forJob(job).startAt(new Date(startAt)).build();

scheduler.scheduleJob(job, trigger);

Versions

Version
1.2.0
1.1.0
1.0.6