Module: Qrack::Protocol09
- Included in:
- Qrack
- Defined in:
- lib/qrack/protocol/spec09.rb,
lib/qrack/protocol/spec09.rb,
lib/qrack/protocol/protocol09.rb
Defined Under Namespace
Classes: Basic, Channel, Class, Connection, Exchange, Header, Queue, Tx
Constant Summary
collapse
"AMQP".freeze
- VERSION_MAJOR =
0
- VERSION_MINOR =
9
- REVISION =
1
- PORT =
5672
- RESPONSES =
{
200 => :REPLY_SUCCESS,
311 => :CONTENT_TOO_LARGE,
312 => :NO_ROUTE,
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
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/qrack/protocol/spec09.rb', line 113
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
|
.classes ⇒ Object
111
|
# File 'lib/qrack/protocol/spec09.rb', line 111
def self.classes() @classes ||= {} end
|
.parse(buf) ⇒ Object
128
129
130
131
132
|
# File 'lib/qrack/protocol/protocol09.rb', line 128
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
|