class Bunny::GetResponse
Wraps {AMQ::Protocol::Basic::GetOk} to provide access to the delivery properties as immutable hash as well as methods.
Attributes
channel[R]
@return [Bunny::Channel] Channel
this basic.get-ok response is on
Public Class Methods
new(get_ok, channel)
click to toggle source
@private
# File lib/bunny/get_response.rb, line 23 def initialize(get_ok, channel) @get_ok = get_ok @hash = { :delivery_tag => @get_ok.delivery_tag, :redelivered => @get_ok.redelivered, :exchange => @get_ok.exchange, :routing_key => @get_ok.routing_key, :channel => channel } @channel = channel end
Public Instance Methods
[](k)
click to toggle source
Accesses delivery properties by key @see Hash#[]
# File lib/bunny/get_response.rb, line 43 def [](k) @hash[k] end
delivery_tag()
click to toggle source
@return [String] Delivery identifier that is used to acknowledge, reject and nack deliveries
# File lib/bunny/get_response.rb, line 63 def delivery_tag @get_ok.delivery_tag end
each(*args, &block)
click to toggle source
Iterates over the delivery properties @see Enumerable#each
# File lib/bunny/get_response.rb, line 37 def each(*args, &block) @hash.each(*args, &block) end
exchange()
click to toggle source
@return [String] Name of the exchange this message was published to
# File lib/bunny/get_response.rb, line 74 def exchange @get_ok.exchange end
inspect()
click to toggle source
@private
# File lib/bunny/get_response.rb, line 58 def inspect to_hash.inspect end
redelivered()
click to toggle source
@return [Boolean] true if this delivery is a redelivery (the message was requeued at least once)
# File lib/bunny/get_response.rb, line 68 def redelivered @get_ok.redelivered end
Also aliased as: redelivered?
routing_key()
click to toggle source
@return [String] Routing key this message was published with
# File lib/bunny/get_response.rb, line 79 def routing_key @get_ok.routing_key end
to_hash()
click to toggle source
@return [Hash] Hash representation of this delivery info
# File lib/bunny/get_response.rb, line 48 def to_hash @hash end
to_s()
click to toggle source
@private
# File lib/bunny/get_response.rb, line 53 def to_s to_hash.to_s end