Class: GorgonBunny::MessageProperties

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gorgon_bunny/lib/gorgon_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

Constructor Details

#initialize(properties) ⇒ MessageProperties

Returns a new instance of MessageProperties.



18
19
20
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 18

def initialize(properties)
  @properties = properties
end

Instance Method Details

#[](k) ⇒ Object

Accesses message properties by key

See Also:

  • Hash#[]


30
31
32
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 30

def [](k)
  @properties[k]
end

#app_idString

Returns Publishing application, as set by the publisher.

Returns:

  • (String)

    Publishing application, as set by the publisher



110
111
112
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 110

def app_id
  @properties[:app_id]
end

#cluster_idString

Returns Cluster ID, as set by the publisher.

Returns:

  • (String)

    Cluster ID, as set by the publisher



115
116
117
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 115

def cluster_id
  @properties[:cluster_id]
end

#content_encodingString

Returns (Optional) content encoding of the message, as set by the publisher.

Returns:

  • (String)

    (Optional) content encoding of the message, as set by the publisher



55
56
57
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 55

def content_encoding
  @properties[:content_encoding]
end

#content_typeString

Returns (Optional) content type of the message, as set by the publisher.

Returns:

  • (String)

    (Optional) content type of the message, as set by the publisher



50
51
52
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 50

def content_type
  @properties[:content_type]
end

#correlation_idString

Returns What message this message is a reply to (or corresponds to), as set by the publisher.

Returns:

  • (String)

    What message this message is a reply to (or corresponds to), as set by the publisher



75
76
77
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 75

def correlation_id
  @properties[:correlation_id]
end

#delivery_modeInteger

Returns Delivery mode (persistent or transient).

Returns:

  • (Integer)

    Delivery mode (persistent or transient)



65
66
67
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 65

def delivery_mode
  @properties[:delivery_mode]
end

#each(*args, &block) ⇒ Object

Iterates over the message properties

See Also:

  • Enumerable#each


24
25
26
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 24

def each(*args, &block)
  @properties.each(*args, &block)
end

#expirationString

Returns Message expiration, as set by the publisher.

Returns:

  • (String)

    Message expiration, as set by the publisher



85
86
87
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 85

def expiration
  @properties[:expiration]
end

#headersString

Returns Message headers.

Returns:

  • (String)

    Message headers



60
61
62
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 60

def headers
  @properties[:headers]
end

#inspectObject



45
46
47
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 45

def inspect
  to_hash.inspect
end

#message_idString

Returns Message ID, as set by the publisher.

Returns:

  • (String)

    Message ID, as set by the publisher



90
91
92
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 90

def message_id
  @properties[:message_id]
end

#priorityInteger

Returns Message priority, as set by the publisher.

Returns:

  • (Integer)

    Message priority, as set by the publisher



70
71
72
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 70

def priority
  @properties[:priority]
end

#reply_toString

Returns (Optional) How to reply to the publisher (usually a reply queue name).

Returns:

  • (String)

    (Optional) How to reply to the publisher (usually a reply queue name)



80
81
82
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 80

def reply_to
  @properties[:reply_to]
end

#timestampTime

Returns Message timestamp, as set by the publisher.

Returns:

  • (Time)

    Message timestamp, as set by the publisher



95
96
97
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 95

def timestamp
  @properties[:timestamp]
end

#to_hashHash

Returns Hash representation of this delivery info.

Returns:

  • (Hash)

    Hash representation of this delivery info



35
36
37
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 35

def to_hash
  @properties
end

#to_sObject



40
41
42
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 40

def to_s
  to_hash.to_s
end

#typeString

Returns Message type, as set by the publisher.

Returns:

  • (String)

    Message type, as set by the publisher



100
101
102
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 100

def type
  @properties[:type]
end

#user_idString

Returns Publishing user, as set by the publisher.

Returns:

  • (String)

    Publishing user, as set by the publisher



105
106
107
# File 'lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb', line 105

def user_id
  @properties[:user_id]
end