Sha256: cc344a450f161a615b2953189197447a7402f8a712ba583cc938495220ef115b

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

module QueueBus
  class Worker

    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

    # all our workers include this one
    def perform(json)
      # instance method level support for sidekiq
      self.class.perform(json)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
queue-bus-0.9.0 lib/queue_bus/worker.rb
queue-bus-0.8.1 lib/queue_bus/worker.rb
queue-bus-0.8.0 lib/queue_bus/worker.rb
queue-bus-0.7.0 lib/queue_bus/worker.rb
queue-bus-0.6.0 lib/queue_bus/worker.rb