Sidekiq is a simple and efficient background processing library for Ruby. This repository provieds a sidekiq compatible server in rust, which behaves totally the same as vanilla in terms of 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 and enqueue jobs in ruby, while implementations and done jobs are written in rust.
- Implementing your own
JobHandler
- Instantiate a server and insert your own job handlers
- Set up dummy jobs with same name as your job handlers in ruby
- Run sidekiq_server and submit jobs from ruby
You can see examples/main.rs
for building a Sidekiq server, and see codes in ruby/
to get an idea on writing dummy tasks in ruby.
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.
sidekiq_server currently recognizes 2 types of UNIX signals:
-
SIGINT For forcing the server to exit. 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 workers and wait them to quit.
Server will not accept anymore jobs if receives either of the above signals.
- 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.