Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/NoEnv/vertx-cronutils
- Owner: NoEnv
- License: apache-2.0
- Created: 2018-11-16T14:49:52.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T19:03:18.000Z (4 months ago)
- Last Synced: 2024-07-19T02:29:00.491Z (4 months ago)
- Topics: async, cron, extension, scheduler, timeout, timer, vertx
- Language: Java
- Homepage:
- Size: 208 KB
- Stars: 18
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.txt
Awesome Lists containing this project
- vertx-awesome - Vert.x CronUtils - An abstraction of cron-utils for the vertx scheduler. Unix, Cron4j and Quartz style expressions are supported. (Utilities)
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");
});
----