No commit activity in last 3 years
No release in over 3 years
Passing context values when create a job for Sidekiq Jobs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

>= 4.1.0
 Project Readme

Sidekiq::PerformingContext

Sidekiq::PerformingContext is a server-side Sidekiq middleware which provides a way to passing context values when create a job for Sidekiq Jobs.

wercker status

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-performing_context'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sidekiq-performing_context

Usage

class Worker
  include Sidekiq::Worker
 
  attr_reader :context_attr_1
  attr_reader :context_attr_2
 
  def perform
    @context_attr_1 # => 'sample'
    @context_attr_2 # => 1
    @context_attr_3 # => 'not accessor'

    @performing_context # => {context_attr_1: 'sample', context_attr_2: 1, context_attr_3: 'not accessor'}
  end
end

Worker.with_context(context_attr_1: 'sample', context_attr_2: 1, context_attr_3: 'not accessor').perform_async

Contributing

  1. Fork it ( https://github.com/dany1468/sidekiq-performing_context/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request