Sha256: f1ed825948bab8fcf9e24f7030d455eed4d929c323e9f2a8e139606e15334ff8

Contents?: true

Size: 628 Bytes

Versions: 9

Compression:

Stored size: 628 Bytes

Contents

module Jackhammer
  class Queue
    attr_reader :queue, :handler_object

    def initialize(topic:, queue:, handler:, routing_key:)
      @topic = topic
      @queue = queue
      @queue.bind @topic, routing_key: routing_key
      @handler_object = handler
    end

    def subscribe
      queue.subscribe do |delivery_info, properties, content|
        Log.info { [delivery_info.inspect, properties.inspect].join(' || ') }
        Log.debug { content }
        handler_object.call content
      rescue StandardError => e
        Log.error e
        Jackhammer.configuration.exception_adapter.call e
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
jackhammer-1.3.7 lib/jackhammer/queue.rb
jackhammer-1.3.6 lib/jackhammer/queue.rb
jackhammer-1.3.5 lib/jackhammer/queue.rb
jackhammer-1.3.4 lib/jackhammer/queue.rb
jackhammer-1.3.3 lib/jackhammer/queue.rb
jackhammer-1.3.2 lib/jackhammer/queue.rb
jackhammer-1.3.1 lib/jackhammer/queue.rb
jackhammer-1.3.0 lib/jackhammer/queue.rb
jackhammer-1.2.0 lib/jackhammer/queue.rb