Project

rubykiq

0.03
No commit activity in last 3 years
No release in over 3 years
Sidekiq agnostic enqueuing using Redis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0.14
>= 0
~> 10.0
~> 0.19
>= 0

Runtime

 Project Readme

Rubykiq

Sidekiq agnostic enqueuing using Redis.

Sidekiq is a fantastic message processing library which has a simple and stable message format. Rubykiq aims to be a portable library to push jobs in to Sidekiq with as little overhead as possible whilst having feature parity on Sidekiq::Client's conventions.

Installation

gem 'rubykiq', '~> 1.0'
require 'rubykiq'

Features / Usage Examples

  • Redis has support for alternative drivers, Rubykiq is tested with these in mind. (eg :synchrony)
  • the :class parameter can be a Class or a String of a Class (eg push jobs to Sidekiq from anywhere, not just where you have Sidekiq classes loaded)
  • The :at parameter supports Time, Date and any Time.parse-able strings.
  • Pushing multiple and singular jobs have the same interface (simply nest args)
  • Slightly less gem dependecies, and by that I mean Sidekiq::Client without Celluloid (which is already very light!)
  • Easier configuration (IMO)
# will also detect REDIS_URL, REDIS_PROVIDER and REDISTOGO_URL ENV variables
Rubykiq.url = 'redis://127.0.0.1:6379'

# alternative driver support ( :ruby, :hiredis, :synchrony )
Rubykiq.driver = :synchrony

# defaults to nil
Rubykiq.namespace = 'background'

# uses 'default' queue unless specified
Rubykiq.push(class: 'Worker', args: ['foo', 1, bat: 'bar'])

# args are optionally set to empty
Rubykiq.push(class: 'Scheduler', queue: 'scheduler')

# will batch up multiple jobs
Rubykiq.push(class: 'Worker', args: [['foo'], ['bar']]) 

# at param can be a 'Time', 'Date' or any 'Time.parse'-able strings
Rubykiq.push(class: 'DelayedHourMailer', at: Time.now + 3600)
Rubykiq.push(class: 'DelayedDayMailer', at: DateTime.now.next_day)
Rubykiq.push(class: 'DelayedMailer', at: '2013-01-01T09:00:00Z')

# alias based sugar
job = { class: 'Worker' }
Rubykiq << job

# create multiple Rubykiq clients with their own drivers
ruby_client = Rubykiq::Client.new
hiredis_client = Rubykiq::Client.new(driver: :hiredis)

# create multiple Rubykiq clients with their own namespaces
foo_client = Rubykiq::Client.new(namespace: 'foo')
bar_client = Rubykiq::Client.new(namespace: 'bar')

Caveats

  • It's advised that using Sidekiq::Client's push method when already a dependency is better in most everyday cases
  • If you rely on any Sidekiq Middleware, Rubykiq is not aware of them so defaults will not be applied to the job hash.

Build & Dependency Status

Gem Version Build Status Code Quality Code Coverage Gittip

Supported Redis Drivers

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

  • Ruby 2.1.0 (drivers: ruby, hiredis, synchrony)
  • Ruby 2.0.0 (drivers: ruby, hiredis, synchrony)
  • Ruby 1.9.3 (drivers: ruby, hiredis, synchrony)
  • JRuby (drivers: ruby)
  • Rubinius (drivers: ruby)

Credits

Inspiration:

Cribbed: