Class: QueueBus::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_bus/worker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.perform(json) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/queue_bus/worker.rb', line 5

def self.perform(json)
  klass = nil
  attributes = ::QueueBus::Util.decode(json)
  begin
    class_name = attributes['bus_class_proxy']
    klass = ::QueueBus::Util.constantize(class_name)
  rescue NameError
    # not there anymore
    return
  end

  QueueBus.worker_middleware_stack.run(attributes) do
    klass.perform(attributes)
  end
end

Instance Method Details

#perform(json) ⇒ Object

all our workers include this one



22
23
24
25
# File 'lib/queue_bus/worker.rb', line 22

def perform(json)
  # instance method level support for sidekiq
  self.class.perform(json)
end