Vert.x CronUtils
An abstraction of cron-utils for the vertx scheduler. Unix, Cron4j and Quartz style expressions are supported.
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"] image:https://badgen.net/discord/online-members/mZAjkQfYSj["Discord",link="https://discord.gg/mZAjkQfYSj"]
= 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 5.0.11 ----- Gradle (in your
build.gradlefile):
[source,groovy,subs="+attributes"]
compile 'com.noenv:vertx-cronutils:5.0.11'
== 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"); });