Skip to content

litert/xxl-job-integration.js

Repository files navigation

LiteRT/XXL-Job Integration

Strict TypeScript Checked npm version License node GitHub issues GitHub Releases

A lightweight integration of XXL-Job for NodeJS.

Features

  • Completely flexible and composable

    The library is designed to be flexible and composable, allowing you to use only the features you need. And you can replace most of the components with other implementations if you want.

  • Glue Types

    • Bean

      Write your job handler in NodeJS, so it can be called by the XXL-Job server with a specific handler name.

    • NodeJS Script

      Run a NodeJS script in current process, which can be used to run a job handler written in NodeJS.

      This allows you to create extra job handlers without the need to change the executor code.

      However, this may cause some RCE vulnerabilities if you use untrusted scripts, so be careful when using this feature.

    • Shell Script

      Not yet implemented, but will be available in the future.

    • Python Script

      Not yet implemented, but will be available in the future.

  • Register Agent

    Automatically register the executor to the XXL-Job server and keep it alive.

  • Routing strategies

    • FAIL_OVER
    • BUSY_OVER
  • Log storage (with rotation support)

    • Built-in: MemoryLogManager

      Store the logs in memory, which is suitable for development and testing purposes.

    • Built-in: FileLogManager

      Store the logs in files, which is suitable for production environments. It supports log rotation based on file creation time.

    • Custom logs storage

      You can also implement your own log storage to store the job logs in a persistent way as you want.

Requirement

  • TypeScript v5.0.0 (or newer)

  • Node.js v18.0.0 (or newer)

  • XXL-Job v3.1.0 (or newer)

    The lower versions may work, but they are not tested and not guaranteed to work.

Installation

npm i @litert/xxl-job-integration --save

Example Usage

Documentation

License

This library is published under Apache-2.0 license.