class AMQP::Header

Message metadata (aka envelope).

Attributes

attributes[R]

AMQP message attributes @return [Hash]

channel[R]

@api public @return [AMQP::Channel]

method[R]

AMQP method frame this header is associated with. Carries additional information that varies between AMQP methods.

@api public @return [AMQ::Protocol::Method]

Public Class Methods

new(channel, method, attributes) click to toggle source

@api public

# File lib/amqp/header.rb, line 27
def initialize(channel, method, attributes)
  @channel, @method, @attributes = channel, method, attributes
end

Public Instance Methods

ack(multiple = false) click to toggle source

Acknowledges the receipt of this message with the server. @param [Boolean] multiple Whether or not to acknowledge multiple messages @api public

# File lib/amqp/header.rb, line 34
def ack(multiple = false)
  @channel.acknowledge(@method.delivery_tag, multiple)
end
consumer_tag() click to toggle source
# File lib/amqp/header.rb, line 55
def consumer_tag
  @method.consumer_tag
end
content_type() click to toggle source
# File lib/amqp/header.rb, line 84
def content_type
  @attributes[:content_type]
end
correlation_id() click to toggle source
# File lib/amqp/header.rb, line 104
def correlation_id
  @attributes[:correlation_id]
end
delivery_mode() click to toggle source
# File lib/amqp/header.rb, line 80
def delivery_mode
  @attributes[:delivery_mode]
end
delivery_tag() click to toggle source
# File lib/amqp/header.rb, line 51
def delivery_tag
  @method.delivery_tag
end
exchange() click to toggle source
# File lib/amqp/header.rb, line 67
def exchange
  @method.exchange
end
header() click to toggle source

@deprecated

# File lib/amqp/header.rb, line 72
def header
  @attributes
end
headers() click to toggle source
# File lib/amqp/header.rb, line 76
def headers
  @attributes[:headers]
end
message_id() click to toggle source
# File lib/amqp/header.rb, line 108
def message_id
  @attributes[:message_id]
end
method_missing(meth, *args, &blk) click to toggle source

Returns AMQP message attributes. @api public

# File lib/amqp/header.rb, line 115
def method_missing(meth, *args, &blk)
  if @attributes && args.empty? && blk.nil? && @attributes.has_key?(meth)
    @attributes[meth]
  else
    @method.__send__(meth, *args, &blk)
  end
end
priority() click to toggle source
# File lib/amqp/header.rb, line 96
def priority
  @attributes[:priority]
end
redelivered() click to toggle source
# File lib/amqp/header.rb, line 59
def redelivered
  @method.redelivered
end
redelivered?() click to toggle source
# File lib/amqp/header.rb, line 63
def redelivered?
  @method.redelivered
end
reject(opts = {}) click to toggle source

Reject this message. @option opts [Hash] :requeue (false) Whether message should be requeued. @api public

# File lib/amqp/header.rb, line 41
def reject(opts = {})
  @channel.reject(@method.delivery_tag, opts.fetch(:requeue, false))
end
reply_to() click to toggle source
# File lib/amqp/header.rb, line 100
def reply_to
  @attributes[:reply_to]
end
timestamp() click to toggle source
# File lib/amqp/header.rb, line 88
def timestamp
  @attributes[:timestamp]
end
to_hash() click to toggle source

@return [Hash] AMQP message header w/o method-specific information. @api public

# File lib/amqp/header.rb, line 47
def to_hash
  @attributes
end
type() click to toggle source
# File lib/amqp/header.rb, line 92
def type
  @attributes[:type]
end