<commit_before># quartz

Cron triggers, job scheduling and async processing via [Quartz](http://quartz-scheduler.org/).

## dependency

```xml
<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-quartz</artifactId>
  <version>{{version}}</version>
</dependency>
```
## usage

```java
import org.jooby.quartz.Quartz;

{
  use(new Quartz().with(MyJob.class));
}
```

Previous example will startup Quartz and schedule MyJob.

## jobs
A job can implement the ```Job``` interface as described in the [Quartz documentation]
(http://quartz-scheduler.org/documentation)

If you prefer to not implement the ```Job``` interface, all you have to do is to annotated a method with the ```Scheduled``` annotation.

By default, job name is set the class name or to the method name. Default group is set to the package name of the job class.

### job methods

A job method must follow this rules:

* It must be a public method
* Without a return value
* Have ZERO arguments
* or just ONE argument of type ```JobExecutionContext```

The next section will you show how to add a trigger to a job and some examples too.

## triggers

Trigger are defined by the ```Scheduled``` annotation. The annotation defines a single and required attributes, which is basically a trigger expression or a reference to one.

Examples:

Run every 5 minutes, start immediately and repeat for ever:

    @Scheduled("5m")
    @Scheduled("5m; delay=0")
    @Scheduled("5m; delay=0; repeat=*")<commit_msg>typo in quartz doc<commit_after># quartz

Cron triggers, job scheduling and async processing via [Quartz](http://quartz-scheduler.org/).

## dependency

```xml
<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-quartz</artifactId>
  <version>{{version}}</version>
</dependency>
```
## usage

```java
import org.jooby.quartz.Quartz;

{
  use(new Quartz().with(MyJob.class));
}
```

Previous example will startup Quartz and schedule MyJob.

## jobs
A job can implement the ```Job``` interface as described in the [Quartz documentation]
(http://quartz-scheduler.org/documentation)

If you prefer to not implement the ```Job``` interface, all you have to do is to annotated a method with the ```Scheduled``` annotation.

By default, job name is set the class name or to the method name. Default group is set to the package name of the job class.

### job methods

A job method must follow these rules:

* It must be a public method
* Without a return value
* Have ZERO arguments
* or just ONE argument of type ```JobExecutionContext```

The next section will you show how to add a trigger to a job and some examples too.

## triggers

Trigger are defined by the ```Scheduled``` annotation. The annotation defines a single and required attributes, which is basically a trigger expression or a reference to one.

Examples:

Run every 5 minutes, start immediately and repeat for ever:

    @Scheduled("5m")
    @Scheduled("5m; delay=0")
    @Scheduled("5m; delay=0; repeat=*")
{'fraction_non_alphanumeric': 0.10818120351588911, 'fraction_numerical': 0.004056795131845842, 'mean_word_length': 4.520522388059701, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169469', 'n_tokens_mistral': 904, 'n_tokens_neox': 838, 'n_words': 376}