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.



1892
1893
1894
1895
1896
1897
1898
# File 'lib/amq/protocol/client.rb', line 1892

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.



1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1891

def consumer_tag
  @consumer_tag
end

#delivery_tagObject (readonly)

Returns the value of attribute delivery_tag.



1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1891

def delivery_tag
  @delivery_tag
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1891

def exchange
  @exchange
end

#redeliveredObject (readonly)

Returns the value of attribute redelivered.



1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1891

def redelivered
  @redelivered
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1891

def routing_key
  @routing_key
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
# File 'lib/amq/protocol/client.rb', line 1869

def self.decode(data)
  offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  consumer_tag = data[offset, length]
  offset += length
  delivery_tag = AMQ::Pack.unpack_uint64_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)


1900
1901
1902
# File 'lib/amq/protocol/client.rb', line 1900

def self.has_content?
  true
end