Class: AMQ::Protocol::Basic::Ack

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(delivery_tag, multiple) ⇒ Ack

Returns a new instance of Ack.



2019
2020
2021
2022
# File 'lib/amq/protocol/client.rb', line 2019

def initialize(delivery_tag, multiple)
  @delivery_tag = delivery_tag
  @multiple = multiple
end

Instance Attribute Details

#delivery_tagObject (readonly)

Returns the value of attribute delivery_tag.



2018
2019
2020
# File 'lib/amq/protocol/client.rb', line 2018

def delivery_tag
  @delivery_tag
end

#multipleObject (readonly)

Returns the value of attribute multiple.



2018
2019
2020
# File 'lib/amq/protocol/client.rb', line 2018

def multiple
  @multiple
end

Class Method Details

.decode(data) ⇒ Object

Optimized decode using unpack1 and getbyte

Returns:



2012
2013
2014
2015
2016
# File 'lib/amq/protocol/client.rb', line 2012

def self.decode(data)
  delivery_tag = data.byteslice(0, 8).unpack1(PACK_UINT64_BE)
  multiple = (data.getbyte(8) & 1) != 0
  self.new(delivery_tag, multiple)
end

.encode(channel, delivery_tag, multiple) ⇒ Object

u’delivery_tag = false’, u’multiple = false’

Returns:



2030
2031
2032
2033
2034
2035
2036
2037
# File 'lib/amq/protocol/client.rb', line 2030

def self.encode(channel, delivery_tag, multiple)
  buffer = @packed_indexes.dup
  buffer << AMQ::Pack.pack_uint64_big_endian(delivery_tag)
  bit_buffer = 0
  bit_buffer = bit_buffer | (1 << 0) if multiple
  buffer << [bit_buffer].pack(PACK_CHAR)
  MethodFrame.new(buffer, channel)
end

.has_content?Boolean

Returns:

  • (Boolean)


2024
2025
2026
# File 'lib/amq/protocol/client.rb', line 2024

def self.has_content?
  false
end