• Stars
    star
    75
  • Rank 409,553 (Top 9 %)
  • Language
    Groovy
  • License
    Apache License 2.0
  • Created almost 12 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This project provides integration of the Quartz scheduling framework into the Grails Framework

Grails Quartz Plugin

Maven Central Java CI

Documentation

Latest documentation and snapshots are available.

Branches

Branch Grails Version
1.x 2
2.0.x 3-5
3.0.x 6

Using

Quick start

To start using Quartz plugin just simply add implementation 'org.grails.plugins:quartz:{version}' in your build.gradle.

Note

2.0.13 for Grails 3.3.*
Properties changed to static from def.
For example: def concurrent will be now static concurrent.

Scheduling Jobs

To create a new job run the grails create-job command and enter the name of the job. Grails will create a new job and place it in the grails-app/jobs directory:

package com.mycompany.myapp

class MyJob {

    static triggers = {
        simple repeatInterval: 1000
    }

    void execute() {
        print "Job run!"
    }
}

The above example will call the execute() method every second.

Scheduling configuration syntax

Currently, plugin supports three types of triggers:

  • simple trigger โ€” executes once per defined interval (ex. "every 10 seconds");
  • cron trigger โ€” executes job with cron expression (ex. "at 8:00 am every Monday through Friday");
  • custom trigger โ€” your implementation of Trigger interface.

Multiple triggers per job are allowed.

class MyJob {

    static triggers = {
        simple name: 'simpleTrigger', startDelay: 10000, repeatInterval: 30000, repeatCount: 10
        cron name: 'cronTrigger', startDelay: 10000, cronExpression: '0/6 * 15 * * ?'
        custom name: 'customTrigger', triggerClass: MyTriggerClass, myParam: myValue, myAnotherParam: myAnotherValue
    }

    void execute() {
        println "Job run!"
    }
}

With this configuration, job will be executed 11 times with 30 seconds interval with first run in 10 seconds after scheduler startup (simple trigger), also it'll be executed each 6 second during 15th hour (15:00:00, 15:00:06, 15:00:12, ... โ€” this configured by cron trigger) and also it'll be executed each time your custom trigger will fire.

Three kinds of triggers are supported with the following parameters. The name field must be unique:

  • simple:
    • name โ€” the name that identifies the trigger;
    • startDelay โ€” delay (in milliseconds) between scheduler startup and first job's execution;
    • repeatInterval โ€” timeout (in milliseconds) between consecutive job's executions;
    • repeatCount โ€” trigger will fire job execution (1 + repeatCount) times and stop after that (specify 0 here to have one-shot job or -1 to repeat job executions indefinitely);
  • cron:
    • name โ€” the name that identifies the trigger;
    • startDelay โ€” delay (in milliseconds) between scheduler startup and first job's execution;
    • cronExpression โ€” cron expression
  • custom:

Configuration plugin syntax

You can add the following properties to control persistence or not persistence:

  • quartz.pluginEnabled - defaults to true, can disable plugin for test cases etc
  • quartz.jdbcStore - true to enable database store, false to use RamStore (default: true)
  • quartz.autoStartup - delays jobs until after bootstrap startup phase (default: false)
  • quartz.jdbcStoreDataSource - jdbc data source alternate name
  • quartz.waitForJobsToCompleteOnShutdown - wait for jobs to complete on shutdown (default: true)
  • quartz.exposeSchedulerInRepository - expose Schedule in repository
  • quartz.scheduler.instanceName - name of the scheduler to avoid conflicts between apps
  • quartz.purgeQuartzTablesOnStartup - when jdbcStore set to true and this is true, clears out all quartz tables on startup

More Repositories

1

grails-core

The Grails Web Application Framework
HTML
2,752
star
2

grails

A powerful web application framework based on the Groovy language
Groovy
448
star
3

grails-spring-security-core

Grails Spring Security Core Plugin
Groovy
255
star
4

grails-data-mapping

GORM - Groovy Object Mapping
Groovy
215
star
5

grails-spring-security-rest

Grails plugin to implement token-based, RESTful authentication using Spring Security
Groovy
204
star
6

grails-doc

Documentation Project For The Grails Web Application Framework
Groovy
201
star
7

grails-gradle-plugin-archived

Groovy
142
star
8

grails-database-migration

Grailsยฎ framework Database Migration Plugin
Groovy
97
star
9

gorm-graphql

An automatic GraphQL schema generator for GORM
JavaScript
79
star
10

grails-redis

Base redis plugin for Grails
Groovy
74
star
11

grails-spring-security-ui

The Spring Security UI plugin provides CRUD screens and other user management workflows.
Groovy
73
star
12

gorm-mongodb

GORM for MongoDB
Groovy
68
star
13

grails-maven

Java
67
star
14

gorm-hibernate5

GORM for Hibernate 5
Java
62
star
15

grails-views

Additional View Technologies for Grails
Groovy
56
star
16

inconsequential

Note - this is an old repository and the code has been moved to https://github.com/SpringSource/spring-data-mapping
Java
54
star
17

grails-howtos

The source and build for a set of Grails HOWTO documents
Groovy
48
star
18

grails-samples

THIS IS DEAD CODE AND HAS BEEN MOVED TO https://github.com/grails-samples/
Groovy
43
star
19

grails-profile-repository

The Grails 3 profile repository - contains metadata for Grails profiles
Groovy
38
star
20

grails-spring-security-acl

Groovy
33
star
21

grails-boot

Grails integrations with Spring Boot
Java
32
star
22

grails-maven-archetype

Shell
25
star
23

grails-static-website

Static version of the website
Groovy
23
star
24

grails-cache

Grails Cache Plugin
Groovy
23
star
25

grails-spring-security-cas

CSS
19
star
26

gorm-neo4j

GORM for Neo4j
Groovy
17
star
27

grails-gsp

GSP (Grails Server Pages) - A server-side view rendering technology based on Groovy
Groovy
16
star
28

scaffolding

Scaffolding plugin for Grailsยฎ framework
Groovy
15
star
29

grails-functional-tests-old

Groovy
14
star
30

grails-guides

Repository for Guides to using Grails
CSS
12
star
31

gorm-redis

GORM for Redis
Java
12
star
32

grails-testing-support

Trait-based testing library for Grails framework
Groovy
11
star
33

grails-gdoc-engine

Java
8
star
34

geb

Geb Functional Testing for Grailsยฎ framework
Groovy
8
star
35

grails-functional-tests-v2

Groovy
8
star
36

gorm-docs

Documentation for GORM
HTML
7
star
37

grails-http

Grails HTTP Utility Classes
Groovy
7
star
38

GSSC-CVE-2022-41923

Groovy
6
star
39

gorm-rest-client

An implementation of RxGORM as a REST Client
Groovy
6
star
40

gant

Gant is a Groovy way of using the Ant tasks -- Ant scripting using Groovy, no XML.
Groovy
6
star
41

grails-angularjs-scaffolding

A plugin for generating client side assets based on domain classes
Groovy
5
star
42

grails-async

Repository for Grails async plugins
Groovy
5
star
43

grails-gradle-plugin

Groovy
5
star
44

gorm-hibernate4

GORM for Hibernate 4
Groovy
5
star
45

grails-spring-security-oauth2

Spring security Oauth Grails 3 plugin
Groovy
4
star
46

grails-sts-tests

Grails STS Tests
Java
3
star
47

gorm-cassandra

GORM for Cassandra
Groovy
3
star
48

grails-testing-tests

Groovy
3
star
49

groovy-grails-joint-build

3
star
50

grails-spring-security-core-rest-objc

Objective-C
3
star
51

grails-embedded-mongodb

Embedded MongoDB Grails Plugin
Groovy
2
star
52

grails-forge

This is Grails project creator. Grails projects may be created using the browser interface, Command Line, or via CURL.
Java
2
star
53

grails-forge-ui

JavaScript
2
star
54

grails-wrapper

Grails Wrapper
Java
2
star
55

grails-spring-security-rest-java-client

Java
2
star
56

grails-datastore-test-support

Unit testing support for GORM
Groovy
2
star
57

grails-plugin-converters

Legacy converters plugin
Java
2
star
58

grails-slack-redirect

HTML
1
star
59

grails-profiles-tests

Shell
1
star
60

grails-upgrade

HTML
1
star
61

scaffolding-old

Repository for Scaffolding core libraries
Groovy
1
star
62

groovy-rest-doc

Groovy
1
star
63

basictests

This is a temporary repository to hold some initial tests for Grails 3.
CSS
1
star
64

github-actions

Shell
1
star
65

grails-common-build

Common Gradle Build Scripts for Publishing Grails Core Projects
HTML
1
star
66

grails-plugins-metadata

1
star
67

grails-rxgorm-docs

Documentation for RxGORM
Shell
1
star