Sha256: 4eab96cd5cdaec57d78923320ecb451a1f3e6ce99fc16f0af12fa5c2e4af22d0

Contents?: true

Size: 1016 Bytes

Versions: 2

Compression:

Stored size: 1016 Bytes

Contents

# encoding: utf-8

require "amq/client/channel"

# Basic.Nack
module AMQ
  module Client
    module Extensions
      module RabbitMQ
        module Basic
          module ChannelMixin

            # Overrides {AMQ::Client::Channel#reject} behavior to use basic.nack.
            #
            # @api public
            # @see http://www.rabbitmq.com/amqp-0-9-1-quickref.html#basic.nack
            def reject(delivery_tag, requeue = true, multi = false)
              if multi
                @client.send_frame(Protocol::Basic::Nack.encode(self.id, delivery_tag, multi, requeue))
              else
                super(delivery_tag, requeue)
              end
            end # reject

          end # ChannelMixin
        end # Basic
      end # RabbitMQ
    end # Extensions

    class Channel
      # use modules, a native Ruby way of extension of existing classes,
      # instead of reckless monkey-patching. MK.      
      include Extensions::RabbitMQ::Basic::ChannelMixin
    end
  end # Client
end # AMQ

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha29 lib/amq/client/extensions/rabbitmq/basic.rb
amq-client-0.7.0.alpha28 lib/amq/client/extensions/rabbitmq/basic.rb