thundr-contrib-quartz

A Quartz scheduler module for Thundr

License

License

Categories

Categories

Quartz Application Layer Libs Job Scheduling
GroupId

GroupId

com.threewks.thundr
ArtifactId

ArtifactId

thundr-contrib-quartz
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

thundr-contrib-quartz
A Quartz scheduler module for Thundr
Project URL

Project URL

http://github.com/kuhnza/thundr-contrib-quartz/
Project Organization

Project Organization

3wks
Source Code Management

Source Code Management

https://github.com/kuhnza/thundr-contrib-quartz

Download thundr-contrib-quartz

How to add to project

<!-- https://jarcasting.com/artifacts/com.threewks.thundr/thundr-contrib-quartz/ -->
<dependency>
    <groupId>com.threewks.thundr</groupId>
    <artifactId>thundr-contrib-quartz</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.threewks.thundr/thundr-contrib-quartz/
implementation 'com.threewks.thundr:thundr-contrib-quartz:0.1.0'
// https://jarcasting.com/artifacts/com.threewks.thundr/thundr-contrib-quartz/
implementation ("com.threewks.thundr:thundr-contrib-quartz:0.1.0")
'com.threewks.thundr:thundr-contrib-quartz:jar:0.1.0'
<dependency org="com.threewks.thundr" name="thundr-contrib-quartz" rev="0.1.0">
  <artifact name="thundr-contrib-quartz" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.threewks.thundr', module='thundr-contrib-quartz', version='0.1.0')
)
libraryDependencies += "com.threewks.thundr" % "thundr-contrib-quartz" % "0.1.0"
[com.threewks.thundr/thundr-contrib-quartz "0.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.threewks.thundr : thundr jar 1.1.0
org.quartz-scheduler : quartz jar 2.1.7

test (3)

Group / Artifact Type Version
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-all jar 1.9.5

Project Modules

There are no modules declared in this project.

Thundr Quartz

A Quartz scheduler module for Thundr

Build Status

Usage

In your ApplicationModule:

@Override
public void requires(DependencyRegistry dependencyRegistry) {
    super.requires(dependencyRegistry);

    dependencyRegistry.addDependency(QuartzModule.class);
}

Once registered as a dependency thundr-contrib-quartz injects a QuartzScheduler into the injection context. Hence you can use it as follows:

QuartzScheduler scheduler = injectionContext.get(QuartzScheduler.class);

JobDetail myJob = JobBuilder.newJob(MyJob.class)
                            .withIdentity("MyJob")
                            .build();

Trigger myJobTrigger = TriggerBuilder
        .newTrigger()
        .withIdentity("myJobTrigger")
        .withSchedule(
                SimpleScheduleBuilder.simpleSchedule()
                        .withIntervalInHours(24)
                        .repeatForever())
                        .build();

scheduler.scheduleJob(myJob, myJobTrigger);

Since Thundr Quartz is just a thin wrapper around Quartz virtually anything you can do with Quartz standalone should be possible. Refer to the official Quartz docs for details.

A note on previous versions

Previous versions of thundr-contrib-quartz required that you run the Quartz scheduler as a daemon thread to ensure a clean shutdown. This is no longer necessary as Thundr 1.x now provides shutdown hooks that allow the module to manage clean up properly.

Quartz configuration

Should you need to provide further configurations options to Quartz you should also create a quartz.properties file in your src/resources folder. All configuration values specified in the Quartz configuration docs are valid.

Versions

Version
0.1.0