Method: AMQ::Protocol::Frame.encode_to_array
- Defined in:
- lib/amq/protocol/frame.rb
.encode_to_array(type, payload, channel) ⇒ Object
The channel number is 0 for all frames which are global to the connection and 1-65535 for frames that refer to specific channels.
21 22 23 24 25 26 27 28 29 |
# File 'lib/amq/protocol/frame.rb', line 21 def self.encode_to_array(type, payload, channel) raise RuntimeError.new("Channel has to be 0 or an integer in range 1..65535 but was #{channel.inspect}") unless CHANNEL_RANGE.include?(channel) raise RuntimeError.new("Payload can't be nil") if payload.nil? components = [] components << [find_type(type), channel, payload.bytesize].pack(PACK_CHAR_UINT16_UINT32) components << encoded_payload(payload) components << FINAL_OCTET components end |