@hectortav/hermes
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Hermes

A persistent but minimal Redis job scheduler

Hermes is a minimal Node.js job scheduler. Hermes uses Redis to ensure reliability and job persistence between reloads and restarts. Hermes uses Typescript by default.

Install

# using npm
npm install @hectortav/hermes
# using yarn
yarn add @hectortav/hermes

Usage

import { Hermes } from "@hectortav/hermes";
// Connect Redis
const hermes = new Hermes({
    host: "127.0.0.1",
    port: 6379,
});

const main = async () => {
    // Create a handler
    hermes.addHandler({
        name: "console_log",
        func: ({ message }) => console.log(message),
    });
    // Create job
    hermes.schedule({
        // Choose a handler
        handler: "console_log",
        // Add a unique Id
        id: 13,
        // Expire in 45 seconds
        expiration: 45,
        // Add arguments for handler function
        args: { message: "hello world" },
    });
};

main();

Contributors

Name Website
hectortav https://github.com/hectortav

Package Sidebar

Install

npm i @hectortav/hermes

Weekly Downloads

0

Version

1.0.4

License

Apache-2.0

Unpacked Size

8.15 kB

Total Files

5

Last publish

Collaborators

  • hectortav