thundr-quartz

Skeleton thundr module

License

License

Categories

Categories

Quartz Application Layer Libs Job Scheduling
GroupId

GroupId

com.threewks.thundr
ArtifactId

ArtifactId

thundr-quartz
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

thundr-quartz
Skeleton thundr module
Project URL

Project URL

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

Project Organization

3wks
Source Code Management

Source Code Management

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

Download thundr-quartz

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
com.threewks.thundr : thundr jar 0.9.11
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.0.1