Class: Bunny::MessageProperties
- Inherits:
-
Object
- Object
- Bunny::MessageProperties
- Includes:
- Enumerable
- Defined in:
- lib/bunny/message_properties.rb
Overview
Wraps basic properties hash as returned by amq-protocol to provide access to the delivery properties as immutable hash as well as methods.
Instance Method Summary collapse
-
#[](k) ⇒ Object
Accesses message properties by key.
-
#app_id ⇒ String
Publishing application, as set by the publisher.
-
#cluster_id ⇒ String
Cluster ID, as set by the publisher.
-
#content_encoding ⇒ String
(Optional) content encoding of the message, as set by the publisher.
-
#content_type ⇒ String
(Optional) content type of the message, as set by the publisher.
-
#correlation_id ⇒ String
What message this message is a reply to (or corresponds to), as set by the publisher.
-
#delivery_mode ⇒ Integer
Delivery mode (persistent or transient).
-
#each(*args, &block) ⇒ Object
Iterates over the message properties.
-
#expiration ⇒ String
Message expiration, as set by the publisher.
-
#headers ⇒ String
Message headers.
-
#initialize(properties) ⇒ MessageProperties
constructor
A new instance of MessageProperties.
- #inspect ⇒ Object
-
#message_id ⇒ String
Message ID, as set by the publisher.
-
#priority ⇒ Integer
Message priority, as set by the publisher.
-
#reply_to ⇒ String
(Optional) How to reply to the publisher (usually a reply queue name).
-
#timestamp ⇒ Time
Message timestamp, as set by the publisher.
-
#to_hash ⇒ Hash
Hash representation of this delivery info.
- #to_s ⇒ Object
-
#type ⇒ String
Message type, as set by the publisher.
-
#user_id ⇒ String
Publishing user, as set by the publisher.
Constructor Details
#initialize(properties) ⇒ MessageProperties
Returns a new instance of MessageProperties.
18 19 20 |
# File 'lib/bunny/message_properties.rb', line 18 def initialize(properties) @properties = properties end |
Instance Method Details
#[](k) ⇒ Object
Accesses message properties by key
30 31 32 |
# File 'lib/bunny/message_properties.rb', line 30 def [](k) @properties[k] end |
#app_id ⇒ String
Returns Publishing application, as set by the publisher.
110 111 112 |
# File 'lib/bunny/message_properties.rb', line 110 def app_id @properties[:app_id] end |
#cluster_id ⇒ String
Returns Cluster ID, as set by the publisher.
115 116 117 |
# File 'lib/bunny/message_properties.rb', line 115 def cluster_id @properties[:cluster_id] end |
#content_encoding ⇒ String
Returns (Optional) content encoding of the message, as set by the publisher.
55 56 57 |
# File 'lib/bunny/message_properties.rb', line 55 def content_encoding @properties[:content_encoding] end |
#content_type ⇒ String
Returns (Optional) content type of the message, as set by the publisher.
50 51 52 |
# File 'lib/bunny/message_properties.rb', line 50 def content_type @properties[:content_type] end |
#correlation_id ⇒ String
Returns What message this message is a reply to (or corresponds to), as set by the publisher.
75 76 77 |
# File 'lib/bunny/message_properties.rb', line 75 def correlation_id @properties[:correlation_id] end |
#delivery_mode ⇒ Integer
Returns Delivery mode (persistent or transient).
65 66 67 |
# File 'lib/bunny/message_properties.rb', line 65 def delivery_mode @properties[:delivery_mode] end |
#each(*args, &block) ⇒ Object
Iterates over the message properties
24 25 26 |
# File 'lib/bunny/message_properties.rb', line 24 def each(*args, &block) @properties.each(*args, &block) end |
#expiration ⇒ String
Returns Message expiration, as set by the publisher.
85 86 87 |
# File 'lib/bunny/message_properties.rb', line 85 def expiration @properties[:expiration] end |
#headers ⇒ String
Returns Message headers.
60 61 62 |
# File 'lib/bunny/message_properties.rb', line 60 def headers @properties[:headers] end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/bunny/message_properties.rb', line 45 def inspect to_hash.inspect end |
#message_id ⇒ String
Returns Message ID, as set by the publisher.
90 91 92 |
# File 'lib/bunny/message_properties.rb', line 90 def @properties[:message_id] end |
#priority ⇒ Integer
Returns Message priority, as set by the publisher.
70 71 72 |
# File 'lib/bunny/message_properties.rb', line 70 def priority @properties[:priority] end |
#reply_to ⇒ String
Returns (Optional) How to reply to the publisher (usually a reply queue name).
80 81 82 |
# File 'lib/bunny/message_properties.rb', line 80 def reply_to @properties[:reply_to] end |
#timestamp ⇒ Time
Returns Message timestamp, as set by the publisher.
95 96 97 |
# File 'lib/bunny/message_properties.rb', line 95 def @properties[:timestamp] end |
#to_hash ⇒ Hash
Returns Hash representation of this delivery info.
35 36 37 |
# File 'lib/bunny/message_properties.rb', line 35 def to_hash @properties end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/bunny/message_properties.rb', line 40 def to_s to_hash.to_s end |
#type ⇒ String
Returns Message type, as set by the publisher.
100 101 102 |
# File 'lib/bunny/message_properties.rb', line 100 def type @properties[:type] end |
#user_id ⇒ String
Returns Publishing user, as set by the publisher.
105 106 107 |
# File 'lib/bunny/message_properties.rb', line 105 def user_id @properties[:user_id] end |