Crate bullrs

Crate bullrs 

Source
Expand description

§BullRS

A BullMQ compatible message queue for highly reliable job processing.

§State of this project

[!WARNING]
This project is not ready. It lacks error handling, documentation and some functionality to be really useful.

The project currently only implements the most basic features of BullMQ and is much less tested. Also the API is expected to change over the next few versions.

§Why use BullRS or BullMQ

BullMQ and BullRS use Redis to manage jobs in a highly reliable and scalable manner, distribute them across workers, with retrials, inspecting logs and much more.
It’s a great choice for distributed, event driven systems with fallible units of work.

§Relation to BullMQ

This library can be used completely without a BullMQ instance. However, it works exactly the same way, thereby using established, well tested patterns and it also uses the lua script of BullMQ to be executed on the Redis server. This way it ensures interoperability with BullMQ. Projects having producers and workers in BullMQ (TypeScript / JavaScript) can slowly migrate to Rust based BullRS producers and workers.

§BullRS

BullRS is async and builds on the tokio runtime. I always target interoperability with the newest BullMQ version, but most things are expected to be backwards compatible in both ways.

Priorities:

    1. Reliability
    • everything should work exactly as expected and no job should ever be lost
    1. Ease of use
    • beginner friendly, sensible defaults and hard to misuse
    1. Performance
    • Minimize roundtrips to Redis

§Features

BullMQ has many features. The list below keeps track, which of them are yet to be imeplemented:

  • Managing Jobs
    • Adding immediate Jobs, LIFO and FIFO
    • Awaiting Job Results
    • Remove Jobs
    • Adding delayed Jobs
    • Adding priority Jobs
    • Repeatable Jobs
    • Job Hiearchy
  • Worker
    • Dequeue immediate Jobs
    • Requeue stalled jobs (e.g. worker went offline during processing)
    • Retry jobs with backoff
    • Repeatable Jobs
    • Job Hiearchy
  • Queue
    • Pause / unpause entire queue

Modules§

milliserde
Multiple serde modules for converting between milliseconds (as in JavaScript Dates once strigified) and rust equivalents, namely Duration, Option<Duration>, chrono::DateTime<Utc> and Option<chrono::DateTime<Utc>>.

Structs§

JobJoinHandle
Can be obtained by enqueuing a job and can be used for awaiting it’s result or changing it’s parameters and data as long as it is not yet processed.
JobOptions
Configure enqueue and retry behaviour of a job.
ProgressPercent
A progress type, which is forced to be between 0.0 and 100.0 at runtime. Construct it with
Queue
Represents a single queue of jobs of the same format.
QueueName
Worker
The worker makes jobs available for processing.
WorkerArgs
Parameterize a worker. The defaults should be fine for most use cases. For high performance applications, try increasing parallel_jobs and parallel_connections.

Enums§

InvalidQueueName
There are multiple reasons why a queue name is invalid.
ProgressPercentError