Class: APN::QueueManager

Inherits:
Object
  • Object
show all
Extended by:
BeforeUnregisterSupport, Resque
Defined in:
lib/apn/queue_manager.rb

Overview

Extends Resque, allowing us to add all the callbacks to Resque we desire without affecting the expected functionality in the parent app, if we’re included in e.g. a Rails application.

Class Method Summary collapse

Methods included from BeforeUnregisterSupport

before_unregister_worker, before_unregister_worker=

Class Method Details

.enqueue(queue, klass, *args) ⇒ Object

We define our own enqueue method so we can specify a dynamic queue



23
24
25
26
27
28
29
# File 'lib/apn/queue_manager.rb', line 23

def self.enqueue(queue, klass, *args)
  Resque::Job.create(queue, klass, *args)

  Resque::Plugin.after_enqueue_hooks(klass).each do |hook|
    klass.send(hook, *args)
  end
end

.to_sObject



18
19
20
# File 'lib/apn/queue_manager.rb', line 18

def self.to_s
  "APN::QueueManager (Resque Client) connected to #{redis.server}"
end