class Bunny::DeliveryInfo
Wraps {AMQ::Protocol::Basic::Deliver} to provide access to the delivery properties as immutable hash as well as methods.
Attributes
@return [Bunny::Channel] Channel
this delivery is on
@return [Bunny::Consumer] Consumer
this delivery is for
Public Class Methods
Source
# File lib/bunny/delivery_info.rb, line 27 def initialize(basic_deliver, consumer, channel) @basic_deliver = basic_deliver @hash = { :consumer_tag => basic_deliver.consumer_tag, :delivery_tag => VersionedDeliveryTag.new(basic_deliver.delivery_tag, channel.recoveries_counter), :redelivered => basic_deliver.redelivered, :exchange => basic_deliver.exchange, :routing_key => basic_deliver.routing_key, :consumer => consumer, :channel => channel } @consumer = consumer @channel = channel end
@private
Public Instance Methods
Source
# File lib/bunny/delivery_info.rb, line 50 def [](k) @hash[k] end
Accesses delivery properties by key @see Hash#[]
Source
# File lib/bunny/delivery_info.rb, line 70 def consumer_tag @basic_deliver.consumer_tag end
@return [String] Consumer
tag this delivery is for
Source
# File lib/bunny/delivery_info.rb, line 75 def delivery_tag @basic_deliver.delivery_tag end
@return [String] Delivery identifier that is used to acknowledge, reject and nack deliveries
Source
# File lib/bunny/delivery_info.rb, line 44 def each(*args, &block) @hash.each(*args, &block) end
Iterates over delivery properties @see Enumerable#each
Source
# File lib/bunny/delivery_info.rb, line 86 def exchange @basic_deliver.exchange end
@return [String] Name of the exchange this message was published to
Source
# File lib/bunny/delivery_info.rb, line 65 def inspect to_hash.inspect end
@private
Source
# File lib/bunny/delivery_info.rb, line 80 def redelivered @basic_deliver.redelivered end
@return [Boolean] true if this delivery is a redelivery (the message was requeued at least once)
Source
# File lib/bunny/delivery_info.rb, line 91 def routing_key @basic_deliver.routing_key end
@return [String] Routing key this message was published with
Source
# File lib/bunny/delivery_info.rb, line 55 def to_hash @hash end
@return [Hash] Hash representation of this delivery info