Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/NoEnv/vertx-cronutils

An abstraction of cron-utils for the vertx scheduler
https://github.com/NoEnv/vertx-cronutils

async cron extension scheduler timeout timer vertx

Last synced: 3 months ago
JSON representation

An abstraction of cron-utils for the vertx scheduler

Awesome Lists containing this project

README

        

image:https://github.com/NoEnv/vertx-cronutils/actions/workflows/ci.yml/badge.svg["Build Status",link="https://github.com/NoEnv/vertx-cronutils/actions/workflows/ci.yml"]
image:https://codecov.io/gh/NoEnv/vertx-cronutils/branch/main/graph/badge.svg["Code Coverage",link="https://codecov.io/gh/NoEnv/vertx-cronutils"]
image:https://badgen.net/maven/v/maven-central/com.noenv/vertx-cronutils["Maven Central",link="https://search.maven.org/artifact/com.noenv/vertx-cronutils"]

= Vert.x-CronUtils

Vert.x-CronUtils is an implementation of the cron-utils library for Vert.x.

This module allows scheduling tasks with unix cron expressions.

== Using Vert.x-CronUtils

To use the Vert.x Cron-Utils, add the following dependency to the _dependencies_ section of your build descriptor:

* Maven (in your `pom.xml`):

[source,xml,subs="+attributes"]
----

com.noenv
vertx-cronutils
4.5.9

----

* Gradle (in your `build.gradle` file):

[source,groovy,subs="+attributes"]
----
compile 'com.noenv:vertx-cronutils:4.5.9'
----

== Creating a cron scheduler

You can create cron schedulers using the following flavours `Unix`, `Cron4j` and `Quartz`

[source,java]
----
CronScheduler
.create(vertx, "0/1 * * * * ?", CronType.QUARTZ) //trigger every second
.schedule(s ->
System.out.println("timer triggered")
);
----

[source,java]
----
CronScheduler
.create(vertx, "0 * * * * ?") //trigger every minute
.schedule(s -> {
s.cancel();
System.out.println("timer triggered and canceled");
});
----