Module: Qrack::Protocol
- Included in:
- Qrack
- Defined in:
- lib/qrack/protocol/spec08.rb,
lib/qrack/protocol/spec08.rb,
lib/qrack/protocol/protocol08.rb
Defined Under Namespace
Classes: Access, Basic, Channel, Class, Connection, Dtx, Exchange, File, Header, Queue, Stream, Test, Tunnel, Tx
Constant Summary
collapse
"AMQP".freeze
- VERSION_MAJOR =
8
- VERSION_MINOR =
0
- REVISION =
0
- PORT =
5672
- RESPONSES =
{
200 => :REPLY_SUCCESS,
310 => :NOT_DELIVERED,
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,
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/spec08.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})
Protocol.classes[#{id}] = klass
Protocol.classes[klass::NAME] = klass
end
]
end
end
|
.classes ⇒ Object
111
|
# File 'lib/qrack/protocol/spec08.rb', line 111
def self.classes() @classes ||= {} end
|
.parse(buf) ⇒ Object
127
128
129
130
131
|
# File 'lib/qrack/protocol/protocol08.rb', line 127
def self.parse buf
buf = Transport::Buffer.new(buf) unless buf.is_a? Transport::Buffer
class_id, method_id = buf.read(:short, :short)
classes[class_id].methods[method_id].new(buf)
end
|