0.01
No commit activity in last 3 years
No release in over 3 years
Syntax sugar for Resque consumers. Each consumer is a class, with clean interface, and custom logger. Usefull when count of different events ~100 and more.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

 Project Readme

Resque Kawai

Syntax sugar for Resque consumers. Each consumer is a class, with clean interface, and custom logger. Usefull when count of different events ~100 and more.

gem 'resque-kawai'
rails generate rq:add bla

Consumer

app/workers/rq_bla.rb

class RqBla < RqQueue

  def some_method1(a, b, c)
    logger.info "async called some_method1 with #{[a, b, c].inspect}"
  end
  
  def some_method2(x)
    logger.info "async called some_method2 with #{x.inspect}"
  end
  
end

Insert event into queue like this:

RqBla.some_method1(1, 2, 3)

or

RqBla.add_event(:some_method2, some_x)

Logger for this consumer: Rails.root/log/workers/bla.log

Options

class RqBla < RqQueue

  # specify custom logger
  self.logger_path = "#{Rails.root}/log/bla.log"
  
  # enables benchmark for each event (into logger)
  self.benchmark = true
  
end

Proxy method to consumer

Usefull in specs

  RqBla.proxy(:some_method1)

When code call RqBla.some_method1(a,b,c) this would be convert into RqBla.new.some_method1(a,b,c)

Insert event with Resque-scheduler

  RqBla.add_event_in(10.seconds, :some_method1, 1, 2, 3)
  
  RqBla.enqueue_in(10.seconds, :some_method1, 1, 2, 3)