Sha256: 01da0462a65d22a9c2670dd9b5dc871c87af992bc404d95d5d8513ecb076be44

Contents?: true

Size: 1016 Bytes

Versions: 5

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
                @connection.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, the 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

5 entries across 5 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha34 lib/amq/client/extensions/rabbitmq/basic.rb
amq-client-0.7.0.alpha33 lib/amq/client/extensions/rabbitmq/basic.rb
amq-client-0.7.0.alpha32 lib/amq/client/extensions/rabbitmq/basic.rb
amq-client-0.7.0.alpha31 lib/amq/client/extensions/rabbitmq/basic.rb
amq-client-0.7.0.alpha30 lib/amq/client/extensions/rabbitmq/basic.rb