Class: Bunny::GetResponse

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bunny/get_response.rb

Overview

Wraps AMQ::Protocol::Basic::GetOk to provide access to the delivery properties as immutable hash as well as methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelBunny::Channel (readonly)

Returns Channel this basic.get-ok response is on.

Returns:



20
21
22
# File 'lib/bunny/get_response.rb', line 20

def channel
  @channel
end

Instance Method Details

#[](k) ⇒ Object

Accesses delivery properties by key

See Also:

  • Hash#[]


43
44
45
# File 'lib/bunny/get_response.rb', line 43

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

#delivery_tagString

Returns Delivery identifier that is used to acknowledge, reject and nack deliveries.

Returns:

  • (String)

    Delivery identifier that is used to acknowledge, reject and nack deliveries



63
64
65
# File 'lib/bunny/get_response.rb', line 63

def delivery_tag
  @get_ok.delivery_tag
end

#each(*args, &block) ⇒ Object

Iterates over the delivery properties

See Also:

  • Enumerable#each


37
38
39
# File 'lib/bunny/get_response.rb', line 37

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

#exchangeString

Returns Name of the exchange this message was published to.

Returns:

  • (String)

    Name of the exchange this message was published to



74
75
76
# File 'lib/bunny/get_response.rb', line 74

def exchange
  @get_ok.exchange
end

#redeliveredBoolean Also known as: redelivered?

Returns true if this delivery is a redelivery (the message was requeued at least once).

Returns:

  • (Boolean)

    true if this delivery is a redelivery (the message was requeued at least once)



68
69
70
# File 'lib/bunny/get_response.rb', line 68

def redelivered
  @get_ok.redelivered
end

#routing_keyString

Returns Routing key this message was published with.

Returns:

  • (String)

    Routing key this message was published with



79
80
81
# File 'lib/bunny/get_response.rb', line 79

def routing_key
  @get_ok.routing_key
end

#to_hashHash

Returns Hash representation of this delivery info.

Returns:

  • (Hash)

    Hash representation of this delivery info



48
49
50
# File 'lib/bunny/get_response.rb', line 48

def to_hash
  @hash
end