Class: AMQ::Protocol::Basic::Deliver

Inherits:
Method
  • Object
show all
Defined in:
lib/amq/protocol/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Method

encode_body, index, inherited, instantiate, method_id, methods, name, split_headers

Constructor Details

#initialize(consumer_tag, delivery_tag, redelivered, exchange, routing_key) ⇒ Deliver

Returns a new instance of Deliver.



1750
1751
1752
1753
1754
1755
1756
# File 'lib/amq/protocol/client.rb', line 1750

def initialize(consumer_tag, delivery_tag, redelivered, exchange, routing_key)
  @consumer_tag = consumer_tag
  @delivery_tag = delivery_tag
  @redelivered = redelivered
  @exchange = exchange
  @routing_key = routing_key
end

Instance Attribute Details

#consumer_tagObject (readonly)

Returns the value of attribute consumer_tag.



1749
1750
1751
# File 'lib/amq/protocol/client.rb', line 1749

def consumer_tag
  @consumer_tag
end

#delivery_tagObject (readonly)

Returns the value of attribute delivery_tag.



1749
1750
1751
# File 'lib/amq/protocol/client.rb', line 1749

def delivery_tag
  @delivery_tag
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



1749
1750
1751
# File 'lib/amq/protocol/client.rb', line 1749

def exchange
  @exchange
end

#redeliveredObject (readonly)

Returns the value of attribute redelivered.



1749
1750
1751
# File 'lib/amq/protocol/client.rb', line 1749

def redelivered
  @redelivered
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



1749
1750
1751
# File 'lib/amq/protocol/client.rb', line 1749

def routing_key
  @routing_key
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
# File 'lib/amq/protocol/client.rb', line 1727

def self.decode(data)
  offset = 0
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  consumer_tag = data[offset, length]
  offset += length
  delivery_tag = AMQ::Hacks.unpack_64_big_endian(data[offset, 8]).first
  offset += 8
  bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  redelivered = (bit_buffer & (1 << 0)) != 0
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  exchange = data[offset, length]
  offset += length
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  routing_key = data[offset, length]
  offset += length
  self.new(consumer_tag, delivery_tag, redelivered, exchange, routing_key)
end

.has_content?Boolean

Returns:

  • (Boolean)


1758
1759
1760
# File 'lib/amq/protocol/client.rb', line 1758

def self.has_content?
  true
end