Sha256: 6460931951dca00e397141700534872d749af05b06ec13e3d905460604136571

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

module Jackhammer
  class Queue
    def initialize(topic:, queue:, handler:, routing:)
      @topic = topic
      @queue = queue
      @queue.bind @topic, routing_key: routing
      @handler_object = handler
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jackhammer-0.1.1 lib/jackhammer/queue.rb
jackhammer-0.1.0 lib/jackhammer/queue.rb