Module: Qrack::Protocol09

Included in:
Qrack
Defined in:
lib/ext/bunny-0.6.0/lib/qrack/protocol/spec09.rb,
lib/ext/bunny-0.6.0/lib/qrack/protocol/spec09.rb,
lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol09.rb

Defined Under Namespace

Classes: Basic, Channel, Class, Connection, Exchange, Header, Queue, Tx

Constant Summary collapse

HEADER =
"AMQP".freeze
VERSION_MAJOR =
0
VERSION_MINOR =
9
REVISION =
1
PORT =
5672
SSL_PORT =
5671
RESPONSES =
{
  200 => :REPLY_SUCCESS,
  311 => :CONTENT_TOO_LARGE,
  313 => :NO_CONSUMERS,
  320 => :CONNECTION_FORCED,
  402 => :INVALID_PATH,
  403 => :ACCESS_REFUSED,
  404 => :NOT_FOUND,
  405 => :RESOURCE_LOCKED,
  406 => :PRECONDITION_FAILED,
  502 => :SYNTAX_ERROR,
  503 => :COMMAND_INVALID,
  504 => :CHANNEL_ERROR,
  505 => :UNEXPECTED_FRAME,
  506 => :RESOURCE_ERROR,
  530 => :NOT_ALLOWED,
  540 => :NOT_IMPLEMENTED,
  541 => :INTERNAL_ERROR,
}
FIELDS =
[
  :bit,
  :long,
  :longlong,
  :longstr,
  :octet,
  :short,
  :shortstr,
  :table,
  :timestamp,
]

Class Method Summary collapse

Class Method Details

.Class(id, name) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/spec09.rb', line 110

def self.Class(id, name)
  @_base_classes ||= {}
  @_base_classes[id] ||= ::Class.new(Class) do
    class_eval %[
      def self.inherited klass
        klass.const_set(:ID, #{id})
        klass.const_set(:NAME, :#{name.to_s})
        Protocol09.classes[#{id}] = klass
        Protocol09.classes[klass::NAME] = klass
      end
    ]
  end
end

.classesObject



108
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/spec09.rb', line 108

def self.classes() @classes ||= {} end

.parse(buf) ⇒ Object



126
127
128
129
130
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol09.rb', line 126

def self.parse buf
  buf = Transport09::Buffer.new(buf) unless buf.is_a? Transport09::Buffer
  class_id, method_id = buf.read(:short, :short)
  classes[class_id].methods[method_id].new(buf)
end