Parent

Class Index [+]

Quicksearch

AMQ::Protocol::Frame

Constants

TYPES
TYPES_REVERSE
TYPES_OPTIONS
CHANNEL_RANGE
FINAL_OCTET

Public Class Methods

__new__(original_type, *args) click to toggle source
Alias for: new
decode(*) click to toggle source
    # File lib/amq/protocol/frame.rb, line 36
36:       def self.decode(*)
37:         raise NotImplementedError.new You are supposed to redefine this method, because it's dependent on used IO adapter.This functionality is part of the https://github.com/ruby-amqp/amq-client library.
38:       end
decode_header(header) click to toggle source
    # File lib/amq/protocol/frame.rb, line 44
44:       def self.decode_header(header)
45:         raise EmptyResponseError if header == nil
46:         type_id, channel, size = header.unpack(PACK_CHAR_UINT16_UINT32)
47:         type = TYPES_REVERSE[type_id]
48:         raise FrameTypeError.new(TYPES_OPTIONS) unless type
49:         [type, channel, size]
50:       end
encode(type, payload, channel) click to toggle source

The channel number is 0 for all frames which are global to the connection and 1-65535 for frames that refer to specific channels.

    # File lib/amq/protocol/frame.rb, line 14
14:       def self.encode(type, payload, channel)
15:         raise RuntimeError.new("Channel has to be 0 or an integer in range 1..65535 but was #{channel.inspect}") unless CHANNEL_RANGE.include?(channel)
16:         raise RuntimeError.new("Payload can't be nil") if payload.nil?
17:         [find_type(type), channel, payload.bytesize].pack(PACK_CHAR_UINT16_UINT32) + payload.bytes.to_a.pack(SIMPLE_BYTE_PACK) + FINAL_OCTET
18:       end
find_type(type) click to toggle source
    # File lib/amq/protocol/frame.rb, line 30
30:       def self.find_type(type)
31:         type_id = if Symbol === type then TYPES[type] else type end
32:         raise FrameTypeError.new(TYPES_OPTIONS) if type == nil || !TYPES_REVERSE.has_key?(type_id)
33:         type_id
34:       end
new(original_type, *args) click to toggle source
    # File lib/amq/protocol/frame.rb, line 24
24:       def self.new(original_type, *args)
25:         type_id = find_type(original_type)
26:         klass = CLASSES[type_id]
27:         klass.new(*args)
28:       end
Also aliased as: __new__

Public Instance Methods

final?() click to toggle source
    # File lib/amq/protocol/frame.rb, line 52
52:       def final?
53:         true
54:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.