Class: AMQ::Protocol::Channel::Close
- Defined in:
- lib/amq/protocol/client.rb,
lib/amq/protocol/channel_close.rb
Instance Attribute Summary collapse
-
#class_id ⇒ Object
readonly
Returns the value of attribute class_id.
-
#method_id ⇒ Object
readonly
Returns the value of attribute method_id.
-
#reply_code ⇒ Object
readonly
Returns the value of attribute reply_code.
-
#reply_text ⇒ Object
readonly
Returns the value of attribute reply_text.
Class Method Summary collapse
- .decode(data) ⇒ Object
-
.encode(channel, reply_code, reply_text, class_id, method_id) ⇒ Object
[u’reply_code = nil’, u’reply_text = EMPTY_STRING’, u’class_id = nil’, u’method_id = nil’].
- .has_content? ⇒ Boolean
Instance Method Summary collapse
-
#delivery_ack_timeout? ⇒ Boolean
True if the channel was closed due to a consumer delivery acknowledgement timeout.
-
#initialize(reply_code, reply_text, class_id, method_id) ⇒ Close
constructor
A new instance of Close.
-
#message_too_large? ⇒ Boolean
True if the channel was closed because a message exceeded the configured max size.
-
#unknown_delivery_tag? ⇒ Boolean
True if the channel was closed due to an unknown delivery tag (e.g. double ack).
Methods inherited from Method
encode_body, index, inherited, instantiate, method_id, methods, name, split_headers
Constructor Details
#initialize(reply_code, reply_text, class_id, method_id) ⇒ Close
Returns a new instance of Close.
804 805 806 807 808 809 |
# File 'lib/amq/protocol/client.rb', line 804 def initialize(reply_code, reply_text, class_id, method_id) @reply_code = reply_code @reply_text = reply_text @class_id = class_id @method_id = method_id end |
Instance Attribute Details
#class_id ⇒ Object (readonly)
Returns the value of attribute class_id.
803 804 805 |
# File 'lib/amq/protocol/client.rb', line 803 def class_id @class_id end |
#method_id ⇒ Object (readonly)
Returns the value of attribute method_id.
803 804 805 |
# File 'lib/amq/protocol/client.rb', line 803 def method_id @method_id end |
#reply_code ⇒ Object (readonly)
Returns the value of attribute reply_code.
803 804 805 |
# File 'lib/amq/protocol/client.rb', line 803 def reply_code @reply_code end |
#reply_text ⇒ Object (readonly)
Returns the value of attribute reply_text.
803 804 805 |
# File 'lib/amq/protocol/client.rb', line 803 def reply_text @reply_text end |
Class Method Details
.decode(data) ⇒ Object
788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
# File 'lib/amq/protocol/client.rb', line 788 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 reply_code = data[offset, 2].unpack(PACK_UINT16).first offset += 2 length = data[offset, 1].unpack(PACK_CHAR).first offset += 1 reply_text = data[offset, length] offset += length class_id = data[offset, 2].unpack(PACK_UINT16).first offset += 2 method_id = data[offset, 2].unpack(PACK_UINT16).first offset += 2 self.new(reply_code, reply_text, class_id, method_id) end |
.encode(channel, reply_code, reply_text, class_id, method_id) ⇒ Object
- u’reply_code = nil’, u’reply_text = EMPTY_STRING’, u’class_id = nil’, u’method_id = nil’
817 818 819 820 821 822 823 824 825 |
# File 'lib/amq/protocol/client.rb', line 817 def self.encode(channel, reply_code, reply_text, class_id, method_id) buffer = @packed_indexes.dup buffer << [reply_code].pack(PACK_UINT16) buffer << reply_text.to_s.bytesize.chr buffer << reply_text.to_s buffer << [class_id].pack(PACK_UINT16) buffer << [method_id].pack(PACK_UINT16) MethodFrame.new(buffer, channel) end |
.has_content? ⇒ Boolean
811 812 813 |
# File 'lib/amq/protocol/client.rb', line 811 def self.has_content? false end |
Instance Method Details
#delivery_ack_timeout? ⇒ Boolean
Returns true if the channel was closed due to a consumer delivery acknowledgement timeout.
8 9 10 |
# File 'lib/amq/protocol/channel_close.rb', line 8 def delivery_ack_timeout? reply_code == 406 && reply_text.match?(/delivery acknowledgement on channel \d+ timed out/) end |
#message_too_large? ⇒ Boolean
Returns true if the channel was closed because a message exceeded the configured max size.
18 19 20 |
# File 'lib/amq/protocol/channel_close.rb', line 18 def reply_code == 406 && reply_text.match?(/larger than configured max size/) end |
#unknown_delivery_tag? ⇒ Boolean
Returns true if the channel was closed due to an unknown delivery tag (e.g. double ack).
13 14 15 |
# File 'lib/amq/protocol/channel_close.rb', line 13 def unknown_delivery_tag? reply_code == 406 && reply_text.match?(/unknown delivery tag/) end |