Sha256: cbb964068b4439379482af921dd8c65c9e46db2c9d18cce9101117084167c54c

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module Vx
  module Lib
    module Consumer
      module Ack

        def ack(multiple = false)
          instrumentation = {
            consumer:      self.class.params.consumer_name,
            properties:    properties,
            multiple:      multiple,
            channel:       _channel.id
          }
          if _channel.open?
            _channel.ack delivery_info.delivery_tag, multiple
            instrument("ack", instrumentation)
            true
          else
            instrument("ack_failed", instrumentation)
            false
          end
        end

        def nack(multiple = false, requeue = false)
          instrumentation = {
            consumer:      self.class.params.consumer_name,
            properties:    properties,
            multiple:      multiple,
            requeue:       requeue,
            channel:       channel.id
          }
          if _channel.open?
            _channel.ack delivery_info.delivery_tag, multiple, requeue
            instrument("nack", instrumentation)
            true
          else
            instrument("nack_failed", instrumentation)
            false
          end
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vx-lib-consumer-0.2.2 lib/vx/lib/consumer/ack.rb
vx-lib-consumer-0.2.1 lib/vx/lib/consumer/ack.rb