Class: AMQP::Header
- Inherits:
-
Object
- Object
- AMQP::Header
- Defined in:
- lib/amqp/header.rb
Overview
Message metadata (aka envelope).
Instance Attribute Summary (collapse)
-
- (Hash) attributes
readonly
AMQP message attributes.
- - (AMQP::Channel) channel readonly
-
- (AMQ::Protocol::Method) method
readonly
AMQP method frame this header is associated with.
Instance Method Summary (collapse)
-
- (Object) ack(multiple = false)
Acknowledges the receipt of this message with the server.
-
- (Object) consumer_tag
delivery_tag.
-
- (Object) content_type
delivery_mode.
-
- (Object) correlation_id
reply_to.
-
- (Object) delivery_mode
headers.
-
- (Object) delivery_tag
to_hash.
-
- (Object) exchange
redelivered?.
- - (Object) header deprecated Deprecated.
-
- (Object) headers
header.
-
- (Header) initialize(channel, method, attributes)
constructor
A new instance of Header.
-
- (Object) message_id
correlation_id.
-
- (Object) method_missing(meth, *args, &blk)
Returns AMQP message attributes.
-
- (Object) priority
type.
-
- (Object) redelivered
consumer_tag.
-
- (Boolean) redelivered?
redelivered.
-
- (Object) reject(opts = {})
Reject this message.
-
- (Object) reply_to
priority.
-
- (Object) timestamp
content_type.
-
- (Hash) to_hash
AMQP message header w/o method-specific information.
-
- (Object) type
timestamp.
Constructor Details
- (Header) initialize(channel, method, attributes)
A new instance of Header
27 28 29 |
# File 'lib/amqp/header.rb', line 27 def initialize(channel, method, attributes) @channel, @method, @attributes = channel, method, attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(meth, *args, &blk)
Returns AMQP message attributes.
115 116 117 118 119 120 121 |
# 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 |
Instance Attribute Details
- (Hash) attributes (readonly)
AMQP message attributes
24 25 26 |
# File 'lib/amqp/header.rb', line 24 def attributes @attributes end |
- (AMQP::Channel) channel (readonly)
13 14 15 |
# File 'lib/amqp/header.rb', line 13 def channel @channel end |
- (AMQ::Protocol::Method) method (readonly)
AMQP method frame this header is associated with. Carries additional information that varies between AMQP methods.
20 21 22 |
# File 'lib/amqp/header.rb', line 20 def method @method end |
Instance Method Details
- (Object) ack(multiple = false)
Acknowledges the receipt of this message with the server.
34 35 36 |
# File 'lib/amqp/header.rb', line 34 def ack(multiple = false) @channel.acknowledge(@method.delivery_tag, multiple) end |
- (Object) consumer_tag
delivery_tag
55 56 57 |
# File 'lib/amqp/header.rb', line 55 def consumer_tag @method.consumer_tag end |
- (Object) content_type
delivery_mode
84 85 86 |
# File 'lib/amqp/header.rb', line 84 def content_type @attributes[:content_type] end |
- (Object) correlation_id
reply_to
104 105 106 |
# File 'lib/amqp/header.rb', line 104 def correlation_id @attributes[:correlation_id] end |
- (Object) delivery_mode
headers
80 81 82 |
# File 'lib/amqp/header.rb', line 80 def delivery_mode @attributes[:delivery_mode] end |
- (Object) delivery_tag
to_hash
51 52 53 |
# File 'lib/amqp/header.rb', line 51 def delivery_tag @method.delivery_tag end |
- (Object) exchange
redelivered?
67 68 69 |
# File 'lib/amqp/header.rb', line 67 def exchange @method.exchange end |
- (Object) header
72 73 74 |
# File 'lib/amqp/header.rb', line 72 def header @attributes end |
- (Object) headers
header
76 77 78 |
# File 'lib/amqp/header.rb', line 76 def headers @attributes[:headers] end |
- (Object) message_id
correlation_id
108 109 110 |
# File 'lib/amqp/header.rb', line 108 def @attributes[:message_id] end |
- (Object) priority
type
96 97 98 |
# File 'lib/amqp/header.rb', line 96 def priority @attributes[:priority] end |
- (Object) redelivered
consumer_tag
59 60 61 |
# File 'lib/amqp/header.rb', line 59 def redelivered @method.redelivered end |
- (Boolean) redelivered?
redelivered
63 64 65 |
# File 'lib/amqp/header.rb', line 63 def redelivered? @method.redelivered end |
- (Object) reject(opts = {})
Reject this message.
41 42 43 |
# File 'lib/amqp/header.rb', line 41 def reject(opts = {}) @channel.reject(@method.delivery_tag, opts.fetch(:requeue, false)) end |
- (Object) reply_to
priority
100 101 102 |
# File 'lib/amqp/header.rb', line 100 def reply_to @attributes[:reply_to] end |
- (Object) timestamp
content_type
88 89 90 |
# File 'lib/amqp/header.rb', line 88 def @attributes[:timestamp] end |
- (Hash) to_hash
AMQP message header w/o method-specific information.
47 48 49 |
# File 'lib/amqp/header.rb', line 47 def to_hash @attributes end |
- (Object) type
timestamp
92 93 94 |
# File 'lib/amqp/header.rb', line 92 def type @attributes[:type] end |