24 releases (6 breaking)

Uses old Rust 2015

0.7.0 Mar 8, 2017
0.6.2 Oct 13, 2016
0.5.2 Sep 1, 2016
0.4.3 Aug 31, 2016
0.1.2 Aug 27, 2016

#283 in Asynchronous

Download history 1/week @ 2020-10-30 1/week @ 2020-11-20 29/week @ 2020-11-27 24/week @ 2020-12-04 1/week @ 2020-12-11 2/week @ 2020-12-18 27/week @ 2021-01-01 28/week @ 2021-01-08 27/week @ 2021-01-15 27/week @ 2021-02-05 80/week @ 2021-02-12

145 downloads per month

MIT license

1MB
913 lines

Sidekiq-rs Build Status Crates.io Crates.io Crates.io

Sidekiq compatible server in rust, which behaviours totally same as vanilla when you take a look into sidekiq's dashboard.

The basic idea is that, since ruby is slow, we write job handlers in rust with native code. So we write job definitions in ruby and implementations in rust and enqueue jobs in ruby and done jobs in rust.

Snapshots:

dashboard

tui

Usage:

  1. Implementing your own JobHandler
  2. Instantiate a sidekiq-rs server and insert your own job handlers
  3. Set up dummy jobs with same name as your job handlers in ruby
  4. Run sidekiq-rs server and submit jobs from ruby

You can refer to examples/main.rs for building a sidekiq-rs server, and refer to codes in ruby to get an idea on write dummy tasks in ruby.

Advanced usage:

You can definitely embed a ruby VM in your job handlers, running ruby codes when the job is not a native job, so that it soon becomes a complete sidekiq server with additional native code support.

Terminate the sidekiq-rs:

sidekiq-rs includes an implementation of signal handling, and it currently recognize 2 type of signals:

  • SIGINT, fpr force exiting the server. The server will terminate all workers and exit in exactly certain time. The default time is 10 seconds.
  • SIGUSR1, for gracefully exiting the server. The server will inform and wait workers to quit.

Server will not accept anymore jobs if either signal received.

TODO:

  • Sidekiq dashboard capability.
  • Exit signal handling.
  • Support arbitrary fields in job object.
  • Middleware support.
  • Job retry support via middleware.
  • Documentation.
  • Unique job support via middleware.
  • Ruby code handler
  • Regex handler matching.

Dependencies

~8MB
~193K SLoC