right_amqp 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,124 @@
1
+ require File.expand_path('../spec', __FILE__)
2
+ require File.expand_path('../buffer', __FILE__)
3
+ require File.expand_path('../protocol', __FILE__)
4
+
5
+ module AMQP
6
+ class Frame #:nodoc: all
7
+ def initialize payload = nil, channel = 0
8
+ @channel, @payload = channel, payload
9
+ end
10
+ attr_accessor :channel, :payload
11
+
12
+ def id
13
+ self.class::ID
14
+ end
15
+
16
+ def to_binary
17
+ buf = Buffer.new
18
+ buf.write :octet, id
19
+ buf.write :short, channel
20
+ buf.write :longstr, payload
21
+ buf.write :octet, FOOTER
22
+ buf.rewind
23
+ buf
24
+ end
25
+
26
+ def to_s
27
+ to_binary.to_s
28
+ end
29
+
30
+ def == frame
31
+ [ :id, :channel, :payload ].inject(true) do |eql, field|
32
+ eql and __send__(field) == frame.__send__(field)
33
+ end
34
+ end
35
+
36
+ class Invalid < StandardError; end
37
+
38
+ class Method
39
+ def initialize payload = nil, channel = 0
40
+ super
41
+ unless @payload.is_a? Protocol::Class::Method or @payload.nil?
42
+ @payload = Protocol.parse(@payload)
43
+ end
44
+ end
45
+ end
46
+
47
+ class Header
48
+ def initialize payload = nil, channel = 0
49
+ super
50
+ unless @payload.is_a? Protocol::Header or @payload.nil?
51
+ @payload = Protocol::Header.new(@payload)
52
+ end
53
+ end
54
+ end
55
+
56
+ class Body; end
57
+
58
+ def self.parse buf
59
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
60
+ buf.extract do
61
+ id, channel, payload, footer = buf.read(:octet, :short, :longstr, :octet)
62
+ Frame.types[id].new(payload, channel) if footer == FOOTER
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ if $0 =~ /bacon/ or $0 == __FILE__
69
+ require 'bacon'
70
+ include AMQP
71
+
72
+ describe Frame do
73
+ should 'handle basic frame types' do
74
+ Frame::Method.new.id.should == 1
75
+ Frame::Header.new.id.should == 2
76
+ Frame::Body.new.id.should == 3
77
+ end
78
+
79
+ should 'convert method frames to binary' do
80
+ meth = Protocol::Connection::Secure.new :challenge => 'secret'
81
+
82
+ frame = Frame::Method.new(meth)
83
+ frame.to_binary.should.be.kind_of? Buffer
84
+ frame.to_s.should == [ 1, 0, meth.to_s.length, meth.to_s, 206 ].pack('CnNa*C')
85
+ end
86
+
87
+ should 'convert binary to method frames' do
88
+ orig = Frame::Method.new Protocol::Connection::Secure.new(:challenge => 'secret')
89
+
90
+ copy = Frame.parse(orig.to_binary)
91
+ copy.should == orig
92
+ end
93
+
94
+ should 'ignore partial frames until ready' do
95
+ frame = Frame::Method.new Protocol::Connection::Secure.new(:challenge => 'secret')
96
+ data = frame.to_s
97
+
98
+ buf = Buffer.new
99
+ Frame.parse(buf).should == nil
100
+
101
+ buf << data[0..5]
102
+ Frame.parse(buf).should == nil
103
+
104
+ buf << data[6..-1]
105
+ Frame.parse(buf).should == frame
106
+
107
+ Frame.parse(buf).should == nil
108
+ end
109
+
110
+ should 'convert header frames to binary' do
111
+ head = Protocol::Header.new(Protocol::Basic, :priority => 1)
112
+
113
+ frame = Frame::Header.new(head)
114
+ frame.to_s.should == [ 2, 0, head.to_s.length, head.to_s, 206 ].pack('CnNa*C')
115
+ end
116
+
117
+ should 'convert binary to header frame' do
118
+ orig = Frame::Header.new Protocol::Header.new(Protocol::Basic, :priority => 1)
119
+
120
+ copy = Frame.parse(orig.to_binary)
121
+ copy.should == orig
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,212 @@
1
+ require File.expand_path('../spec', __FILE__)
2
+ require File.expand_path('../buffer', __FILE__)
3
+
4
+ module AMQP
5
+ module Protocol
6
+ #:stopdoc:
7
+ class Class::Method
8
+ def initialize *args
9
+ opts = args.pop if args.last.is_a? Hash
10
+ opts ||= {}
11
+
12
+ @debug = 1 # XXX hack, p(obj) == '' if no instance vars are set
13
+
14
+ if args.size == 1 and args.first.is_a? Buffer
15
+ buf = args.shift
16
+ else
17
+ buf = nil
18
+ end
19
+
20
+ self.class.arguments.each do |type, name|
21
+ val = buf ? buf.read(type) :
22
+ args.shift || opts[name] || opts[name.to_s]
23
+ instance_variable_set("@#{name}", val)
24
+ end
25
+ end
26
+
27
+ def arguments
28
+ self.class.arguments.inject({}) do |hash, (type, name)|
29
+ hash.update name => instance_variable_get("@#{name}")
30
+ end
31
+ end
32
+
33
+ def to_binary
34
+ buf = Buffer.new
35
+ buf.write :short, self.class.section.id
36
+ buf.write :short, self.class.id
37
+
38
+ bits = []
39
+
40
+ self.class.arguments.each do |type, name|
41
+ val = instance_variable_get("@#{name}")
42
+ if type == :bit
43
+ bits << (val || false)
44
+ else
45
+ unless bits.empty?
46
+ buf.write :bit, bits
47
+ bits = []
48
+ end
49
+ buf.write type, val
50
+ end
51
+ end
52
+
53
+ buf.write :bit, bits unless bits.empty?
54
+ buf.rewind
55
+
56
+ buf
57
+ end
58
+
59
+ def to_s
60
+ to_binary.to_s
61
+ end
62
+
63
+ def to_frame channel = 0
64
+ Frame::Method.new(self, channel)
65
+ end
66
+ end
67
+
68
+ #:startdoc:
69
+ #
70
+ # Contains a properties hash that holds some potentially interesting
71
+ # information.
72
+ # * :delivery_mode
73
+ # 1 equals transient.
74
+ # 2 equals persistent. Unconsumed persistent messages will survive
75
+ # a server restart when they are stored in a durable queue.
76
+ # * :redelivered
77
+ # True or False
78
+ # * :routing_key
79
+ # The routing string used for matching this message to this queue.
80
+ # * :priority
81
+ # An integer in the range of 0 to 9 inclusive.
82
+ # * :content_type
83
+ # Always "application/octet-stream" (byte stream)
84
+ # * :exchange
85
+ # The source exchange which published this message.
86
+ # * :message_count
87
+ # The number of unconsumed messages contained in the queue.
88
+ # * :delivery_tag
89
+ # A monotonically increasing integer. This number should not be trusted
90
+ # as a sequence number. There is no guarantee it won't get reset.
91
+ class Header
92
+ def initialize *args
93
+ opts = args.pop if args.last.is_a? Hash
94
+ opts ||= {}
95
+
96
+ first = args.shift
97
+
98
+ if first.is_a? ::Class and first.ancestors.include? Protocol::Class
99
+ @klass = first
100
+ @size = args.shift || 0
101
+ @weight = args.shift || 0
102
+ @properties = opts
103
+
104
+ elsif first.is_a? Buffer or first.is_a? String
105
+ buf = first
106
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
107
+
108
+ @klass = Protocol.classes[buf.read(:short)]
109
+ @weight = buf.read(:short)
110
+ @size = buf.read(:longlong)
111
+
112
+ props = buf.read(:properties, *klass.properties.map{|type,_| type })
113
+ @properties = Hash[*klass.properties.map{|_,name| name }.zip(props).reject{|k,v| v.nil? }.flatten]
114
+
115
+ else
116
+ raise ArgumentError, 'Invalid argument'
117
+ end
118
+
119
+ end
120
+ attr_accessor :klass, :size, :weight, :properties
121
+
122
+ def to_binary
123
+ buf = Buffer.new
124
+ buf.write :short, klass.id
125
+ buf.write :short, weight # XXX rabbitmq only supports weight == 0
126
+ buf.write :longlong, size
127
+ buf.write :properties, (klass.properties.map do |type, name|
128
+ [ type, properties[name] || properties[name.to_s] ]
129
+ end)
130
+ buf.rewind
131
+ buf
132
+ end
133
+
134
+ def to_s
135
+ to_binary.to_s
136
+ end
137
+
138
+ def to_frame channel = 0
139
+ Frame::Header.new(self, channel)
140
+ end
141
+
142
+ def == header
143
+ [ :klass, :size, :weight, :properties ].inject(true) do |eql, field|
144
+ eql and __send__(field) == header.__send__(field)
145
+ end
146
+ end
147
+
148
+ def method_missing meth, *args, &blk
149
+ @properties.has_key?(meth) || @klass.properties.find{|_,name| name == meth } ? @properties[meth] :
150
+ super
151
+ end
152
+ end
153
+
154
+ def self.parse buf
155
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
156
+ class_id, method_id = buf.read(:short, :short)
157
+ classes[class_id].methods[method_id].new(buf)
158
+ end
159
+ #:stopdoc:
160
+ end
161
+ end
162
+
163
+ if $0 =~ /bacon/ or $0 == __FILE__
164
+ require 'bacon'
165
+ include AMQP
166
+
167
+ describe Protocol do
168
+ should 'instantiate methods with arguments' do
169
+ meth = Protocol::Connection::StartOk.new nil, 'PLAIN', nil, 'en_US'
170
+ meth.locale.should == 'en_US'
171
+ end
172
+
173
+ should 'instantiate methods with named parameters' do
174
+ meth = Protocol::Connection::StartOk.new :locale => 'en_US',
175
+ :mechanism => 'PLAIN'
176
+ meth.locale.should == 'en_US'
177
+ end
178
+
179
+ should 'convert methods to binary' do
180
+ meth = Protocol::Connection::Secure.new :challenge => 'secret'
181
+ meth.to_binary.should.be.kind_of? Buffer
182
+
183
+ meth.to_s.should == [ 10, 20, 6, 'secret' ].pack('nnNa*')
184
+ end
185
+
186
+ should 'convert binary to method' do
187
+ orig = Protocol::Connection::Secure.new :challenge => 'secret'
188
+ copy = Protocol.parse orig.to_binary
189
+ orig.should == copy
190
+ end
191
+
192
+ should 'convert headers to binary' do
193
+ head = Protocol::Header.new Protocol::Basic,
194
+ size = 5,
195
+ weight = 0,
196
+ :content_type => 'text/json',
197
+ :delivery_mode => 1,
198
+ :priority => 1
199
+ head.to_s.should == [ 60, weight, 0, size, 0b1001_1000_0000_0000, 9, 'text/json', 1, 1 ].pack('nnNNnCa*CC')
200
+ end
201
+
202
+ should 'convert binary to header' do
203
+ orig = Protocol::Header.new Protocol::Basic,
204
+ size = 5,
205
+ weight = 0,
206
+ :content_type => 'text/json',
207
+ :delivery_mode => 1,
208
+ :priority => 1
209
+ Protocol::Header.new(orig.to_binary).should == orig
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,99 @@
1
+ require File.expand_path('../frame', __FILE__)
2
+
3
+ module AMQP
4
+ module Server
5
+ def post_init
6
+ @buf = ''
7
+ @channels = {}
8
+ @started = false
9
+ end
10
+
11
+ def receive_data data
12
+ @buf << data
13
+
14
+ unless @started
15
+ if @buf.size >= 8
16
+ if @buf.slice!(0,8) == "AMQP\001\001\b\000"
17
+ send Protocol::Connection::Start.new(
18
+ 8,
19
+ 0,
20
+ {
21
+ :information => 'Licensed under the Ruby license. See http://github.com/tmm1/amqp',
22
+ :copyright => 'Copyright (c) 2008-2009 Aman Gupta',
23
+ :platform => 'Ruby/EventMachine',
24
+ :version => '0.6.1',
25
+ :product => 'SquirrelMQ'
26
+ },
27
+ 'PLAIN AMQPLAIN',
28
+ 'en_US'
29
+ )
30
+ else
31
+ close_connection
32
+ return
33
+ end
34
+ @started = true
35
+ else
36
+ return
37
+ end
38
+ end
39
+
40
+ while frame = Frame.parse(@buf)
41
+ process_frame frame
42
+ end
43
+ end
44
+
45
+ def process_frame frame
46
+ channel = frame.channel
47
+
48
+ case method = frame.payload
49
+ when Protocol::Connection::StartOk
50
+ @user = method.response[:LOGIN]
51
+ @pass = method.response[:PASSWORD]
52
+ send Protocol::Connection::Tune.new(0, 131072, 0)
53
+
54
+ when Protocol::Connection::TuneOk
55
+ # mnnk
56
+
57
+ when Protocol::Connection::Open
58
+ @vhost = method.virtual_host
59
+ send Protocol::Connection::OpenOk.new('localhost')
60
+
61
+ when Protocol::Channel::Open
62
+ @channels[channel] = []
63
+ send Protocol::Channel::OpenOk.new, :channel => channel
64
+
65
+ when Protocol::Access::Request
66
+ send Protocol::Access::RequestOk.new(101)
67
+ end
68
+ end
69
+
70
+ def send data, opts = {}
71
+ channel = opts[:channel] ||= 0
72
+ data = data.to_frame(channel) unless data.is_a? Frame
73
+ data.channel = channel
74
+
75
+ log 'send', data
76
+ send_data data.to_s
77
+ end
78
+
79
+ def self.start host = 'localhost', port = 5672
80
+ EM.start_server host, port, self
81
+ end
82
+
83
+ private
84
+
85
+ def log *args
86
+ require 'pp'
87
+ pp args
88
+ puts
89
+ end
90
+ end
91
+ end
92
+
93
+ if __FILE__ == $0
94
+ require 'rubygems'
95
+ require 'eventmachine'
96
+ EM.run{
97
+ AMQP::Server.start
98
+ }
99
+ end
@@ -0,0 +1,832 @@
1
+
2
+ #:stopdoc:
3
+ # this file was autogenerated on Mon Jan 23 15:55:36 -0800 2012
4
+ # using amqp-0.8.json (mtime: Mon Jan 23 15:30:40 -0800 2012)
5
+ #
6
+ # DO NOT EDIT! (edit protocol/codegen.rb instead, and run `rake codegen`)
7
+
8
+ module AMQP
9
+ HEADER = "AMQP".freeze
10
+ VERSION_MAJOR = 8
11
+ VERSION_MINOR = 0
12
+ PORT = 5672
13
+
14
+ class Frame
15
+ def self.types
16
+ @types ||= {}
17
+ end
18
+
19
+ def self.Frame id
20
+ (@_base_frames ||= {})[id] ||= Class.new(Frame) do
21
+ class_eval %[
22
+ def self.inherited klass
23
+ klass.const_set(:ID, #{id})
24
+ Frame.types[#{id}] = klass
25
+ end
26
+ ]
27
+ end
28
+ end
29
+
30
+ class Method < Frame( 1 ); end
31
+ class Header < Frame( 2 ); end
32
+ class Body < Frame( 3 ); end
33
+ class OobMethod < Frame( 4 ); end
34
+ class OobHeader < Frame( 5 ); end
35
+ class OobBody < Frame( 6 ); end
36
+ class Trace < Frame( 7 ); end
37
+ class Heartbeat < Frame( 8 ); end
38
+
39
+ FOOTER = 206
40
+ end
41
+
42
+ RESPONSES = {
43
+ 200 => :REPLY_SUCCESS,
44
+ 310 => :NOT_DELIVERED,
45
+ 311 => :CONTENT_TOO_LARGE,
46
+ 312 => :NO_ROUTE,
47
+ 313 => :NO_CONSUMERS,
48
+ 403 => :ACCESS_REFUSED,
49
+ 404 => :NOT_FOUND,
50
+ 405 => :RESOURCE_LOCKED,
51
+ 406 => :PRECONDITION_FAILED,
52
+ 320 => :CONNECTION_FORCED,
53
+ 402 => :INVALID_PATH,
54
+ }
55
+
56
+ FIELDS = [
57
+ :bit,
58
+ :long,
59
+ :longlong,
60
+ :longstr,
61
+ :octet,
62
+ :short,
63
+ :shortstr,
64
+ :table,
65
+ :timestamp,
66
+ ]
67
+
68
+ module Protocol
69
+ class Class
70
+ class << self
71
+ FIELDS.each do |f|
72
+ class_eval %[
73
+ def #{f} name
74
+ properties << [ :#{f}, name ] unless properties.include?([:#{f}, name])
75
+ attr_accessor name
76
+ end
77
+ ]
78
+ end
79
+
80
+ def properties() @properties ||= [] end
81
+
82
+ def id() self::ID end
83
+ def name() self::NAME end
84
+ end
85
+
86
+ class Method
87
+ class << self
88
+ FIELDS.each do |f|
89
+ class_eval %[
90
+ def #{f} name
91
+ arguments << [ :#{f}, name ] unless arguments.include?([:#{f}, name])
92
+ attr_accessor name
93
+ end
94
+ ]
95
+ end
96
+
97
+ def arguments() @arguments ||= [] end
98
+
99
+ def section() Protocol.const_get(self.to_s[/Protocol::(.+?)::/,1]) end
100
+ def id() self::ID end
101
+ def name() self::NAME end
102
+ end
103
+
104
+ def == b
105
+ self.class.arguments.inject(true) do |eql, (type, name)|
106
+ eql and __send__("#{name}") == b.__send__("#{name}")
107
+ end
108
+ end
109
+ end
110
+
111
+ def self.methods() @methods ||= {} end
112
+
113
+ def self.Method(id, name)
114
+ @_base_methods ||= {}
115
+ @_base_methods[id] ||= ::Class.new(Method) do
116
+ class_eval %[
117
+ def self.inherited klass
118
+ klass.const_set(:ID, #{id})
119
+ klass.const_set(:NAME, :#{name.to_s})
120
+ klass.section.methods[#{id}] = klass
121
+ klass.section.methods[klass::NAME] = klass
122
+ end
123
+ ]
124
+ end
125
+ end
126
+ end
127
+
128
+ def self.classes() @classes ||= {} end
129
+
130
+ def self.Class(id, name)
131
+ @_base_classes ||= {}
132
+ @_base_classes[id] ||= ::Class.new(Class) do
133
+ class_eval %[
134
+ def self.inherited klass
135
+ klass.const_set(:ID, #{id})
136
+ klass.const_set(:NAME, :#{name.to_s})
137
+ Protocol.classes[#{id}] = klass
138
+ Protocol.classes[klass::NAME] = klass
139
+ end
140
+ ]
141
+ end
142
+ end
143
+ end
144
+ end
145
+
146
+ module AMQP
147
+ module Protocol
148
+ class Connection < Class( 10, :connection ); end
149
+ class Channel < Class( 20, :channel ); end
150
+ class Access < Class( 30, :access ); end
151
+ class Exchange < Class( 40, :exchange ); end
152
+ class Queue < Class( 50, :queue ); end
153
+ class Basic < Class( 60, :basic ); end
154
+ class File < Class( 70, :file ); end
155
+ class Stream < Class( 80, :stream ); end
156
+ class Tx < Class( 90, :tx ); end
157
+ class Dtx < Class( 100, :dtx ); end
158
+ class Tunnel < Class( 110, :tunnel ); end
159
+ class Test < Class( 120, :test ); end
160
+
161
+ class Connection
162
+
163
+ class Start < Method( 10, :start ); end
164
+ class StartOk < Method( 11, :start_ok ); end
165
+ class Secure < Method( 20, :secure ); end
166
+ class SecureOk < Method( 21, :secure_ok ); end
167
+ class Tune < Method( 30, :tune ); end
168
+ class TuneOk < Method( 31, :tune_ok ); end
169
+ class Open < Method( 40, :open ); end
170
+ class OpenOk < Method( 41, :open_ok ); end
171
+ class Redirect < Method( 50, :redirect ); end
172
+ class Close < Method( 60, :close ); end
173
+ class CloseOk < Method( 61, :close_ok ); end
174
+
175
+ class Start
176
+ octet :version_major
177
+ octet :version_minor
178
+ table :server_properties
179
+ longstr :mechanisms
180
+ longstr :locales
181
+ end
182
+
183
+ class StartOk
184
+ table :client_properties
185
+ shortstr :mechanism
186
+ longstr :response
187
+ shortstr :locale
188
+ end
189
+
190
+ class Secure
191
+ longstr :challenge
192
+ end
193
+
194
+ class SecureOk
195
+ longstr :response
196
+ end
197
+
198
+ class Tune
199
+ short :channel_max
200
+ long :frame_max
201
+ short :heartbeat
202
+ end
203
+
204
+ class TuneOk
205
+ short :channel_max
206
+ long :frame_max
207
+ short :heartbeat
208
+ end
209
+
210
+ class Open
211
+ shortstr :virtual_host
212
+ shortstr :capabilities
213
+ bit :insist
214
+ end
215
+
216
+ class OpenOk
217
+ shortstr :known_hosts
218
+ end
219
+
220
+ class Redirect
221
+ shortstr :host
222
+ shortstr :known_hosts
223
+ end
224
+
225
+ class Close
226
+ short :reply_code
227
+ shortstr :reply_text
228
+ short :class_id
229
+ short :method_id
230
+ end
231
+
232
+ class CloseOk
233
+ end
234
+
235
+ end
236
+
237
+ class Channel
238
+
239
+ class Open < Method( 10, :open ); end
240
+ class OpenOk < Method( 11, :open_ok ); end
241
+ class Flow < Method( 20, :flow ); end
242
+ class FlowOk < Method( 21, :flow_ok ); end
243
+ class Alert < Method( 30, :alert ); end
244
+ class Close < Method( 40, :close ); end
245
+ class CloseOk < Method( 41, :close_ok ); end
246
+
247
+ class Open
248
+ shortstr :out_of_band
249
+ end
250
+
251
+ class OpenOk
252
+ end
253
+
254
+ class Flow
255
+ bit :active
256
+ end
257
+
258
+ class FlowOk
259
+ bit :active
260
+ end
261
+
262
+ class Alert
263
+ short :reply_code
264
+ shortstr :reply_text
265
+ table :details
266
+ end
267
+
268
+ class Close
269
+ short :reply_code
270
+ shortstr :reply_text
271
+ short :class_id
272
+ short :method_id
273
+ end
274
+
275
+ class CloseOk
276
+ end
277
+
278
+ end
279
+
280
+ class Access
281
+
282
+ class Request < Method( 10, :request ); end
283
+ class RequestOk < Method( 11, :request_ok ); end
284
+
285
+ class Request
286
+ shortstr :realm
287
+ bit :exclusive
288
+ bit :passive
289
+ bit :active
290
+ bit :write
291
+ bit :read
292
+ end
293
+
294
+ class RequestOk
295
+ short :ticket
296
+ end
297
+
298
+ end
299
+
300
+ class Exchange
301
+
302
+ class Declare < Method( 10, :declare ); end
303
+ class DeclareOk < Method( 11, :declare_ok ); end
304
+ class Delete < Method( 20, :delete ); end
305
+ class DeleteOk < Method( 21, :delete_ok ); end
306
+
307
+ class Declare
308
+ short :ticket
309
+ shortstr :exchange
310
+ shortstr :type
311
+ bit :passive
312
+ bit :durable
313
+ bit :auto_delete
314
+ bit :internal
315
+ bit :nowait
316
+ table :arguments
317
+ end
318
+
319
+ class DeclareOk
320
+ end
321
+
322
+ class Delete
323
+ short :ticket
324
+ shortstr :exchange
325
+ bit :if_unused
326
+ bit :nowait
327
+ end
328
+
329
+ class DeleteOk
330
+ end
331
+
332
+ end
333
+
334
+ class Queue
335
+
336
+ class Declare < Method( 10, :declare ); end
337
+ class DeclareOk < Method( 11, :declare_ok ); end
338
+ class Bind < Method( 20, :bind ); end
339
+ class BindOk < Method( 21, :bind_ok ); end
340
+ class Purge < Method( 30, :purge ); end
341
+ class PurgeOk < Method( 31, :purge_ok ); end
342
+ class Delete < Method( 40, :delete ); end
343
+ class DeleteOk < Method( 41, :delete_ok ); end
344
+ class Unbind < Method( 50, :unbind ); end
345
+ class UnbindOk < Method( 51, :unbind_ok ); end
346
+
347
+ class Declare
348
+ short :ticket
349
+ shortstr :queue
350
+ bit :passive
351
+ bit :durable
352
+ bit :exclusive
353
+ bit :auto_delete
354
+ bit :nowait
355
+ table :arguments
356
+ end
357
+
358
+ class DeclareOk
359
+ shortstr :queue
360
+ long :message_count
361
+ long :consumer_count
362
+ end
363
+
364
+ class Bind
365
+ short :ticket
366
+ shortstr :queue
367
+ shortstr :exchange
368
+ shortstr :routing_key
369
+ bit :nowait
370
+ table :arguments
371
+ end
372
+
373
+ class BindOk
374
+ end
375
+
376
+ class Purge
377
+ short :ticket
378
+ shortstr :queue
379
+ bit :nowait
380
+ end
381
+
382
+ class PurgeOk
383
+ long :message_count
384
+ end
385
+
386
+ class Delete
387
+ short :ticket
388
+ shortstr :queue
389
+ bit :if_unused
390
+ bit :if_empty
391
+ bit :nowait
392
+ end
393
+
394
+ class DeleteOk
395
+ long :message_count
396
+ end
397
+
398
+ class Unbind
399
+ short :ticket
400
+ shortstr :queue
401
+ shortstr :exchange
402
+ shortstr :routing_key
403
+ table :arguments
404
+ end
405
+
406
+ class UnbindOk
407
+ end
408
+
409
+ end
410
+
411
+ class Basic
412
+ shortstr :content_type
413
+ shortstr :content_encoding
414
+ table :headers
415
+ octet :delivery_mode
416
+ octet :priority
417
+ shortstr :correlation_id
418
+ shortstr :reply_to
419
+ shortstr :expiration
420
+ shortstr :message_id
421
+ timestamp :timestamp
422
+ shortstr :type
423
+ shortstr :user_id
424
+ shortstr :app_id
425
+ shortstr :cluster_id
426
+
427
+ class Qos < Method( 10, :qos ); end
428
+ class QosOk < Method( 11, :qos_ok ); end
429
+ class Consume < Method( 20, :consume ); end
430
+ class ConsumeOk < Method( 21, :consume_ok ); end
431
+ class Cancel < Method( 30, :cancel ); end
432
+ class CancelOk < Method( 31, :cancel_ok ); end
433
+ class Publish < Method( 40, :publish ); end
434
+ class Return < Method( 50, :return ); end
435
+ class Deliver < Method( 60, :deliver ); end
436
+ class Get < Method( 70, :get ); end
437
+ class GetOk < Method( 71, :get_ok ); end
438
+ class GetEmpty < Method( 72, :get_empty ); end
439
+ class Ack < Method( 80, :ack ); end
440
+ class Reject < Method( 90, :reject ); end
441
+ class Recover < Method( 100, :recover ); end
442
+
443
+ class Qos
444
+ long :prefetch_size
445
+ short :prefetch_count
446
+ bit :global
447
+ end
448
+
449
+ class QosOk
450
+ end
451
+
452
+ class Consume
453
+ short :ticket
454
+ shortstr :queue
455
+ shortstr :consumer_tag
456
+ bit :no_local
457
+ bit :no_ack
458
+ bit :exclusive
459
+ bit :nowait
460
+ end
461
+
462
+ class ConsumeOk
463
+ shortstr :consumer_tag
464
+ end
465
+
466
+ class Cancel
467
+ shortstr :consumer_tag
468
+ bit :nowait
469
+ end
470
+
471
+ class CancelOk
472
+ shortstr :consumer_tag
473
+ end
474
+
475
+ class Publish
476
+ short :ticket
477
+ shortstr :exchange
478
+ shortstr :routing_key
479
+ bit :mandatory
480
+ bit :immediate
481
+ end
482
+
483
+ class Return
484
+ short :reply_code
485
+ shortstr :reply_text
486
+ shortstr :exchange
487
+ shortstr :routing_key
488
+ end
489
+
490
+ class Deliver
491
+ shortstr :consumer_tag
492
+ longlong :delivery_tag
493
+ bit :redelivered
494
+ shortstr :exchange
495
+ shortstr :routing_key
496
+ end
497
+
498
+ class Get
499
+ short :ticket
500
+ shortstr :queue
501
+ bit :no_ack
502
+ end
503
+
504
+ class GetOk
505
+ longlong :delivery_tag
506
+ bit :redelivered
507
+ shortstr :exchange
508
+ shortstr :routing_key
509
+ long :message_count
510
+ end
511
+
512
+ class GetEmpty
513
+ shortstr :cluster_id
514
+ end
515
+
516
+ class Ack
517
+ longlong :delivery_tag
518
+ bit :multiple
519
+ end
520
+
521
+ class Reject
522
+ longlong :delivery_tag
523
+ bit :requeue
524
+ end
525
+
526
+ class Recover
527
+ bit :requeue
528
+ end
529
+
530
+ end
531
+
532
+ class File
533
+ shortstr :content_type
534
+ shortstr :content_encoding
535
+ table :headers
536
+ octet :priority
537
+ shortstr :reply_to
538
+ shortstr :message_id
539
+ shortstr :filename
540
+ timestamp :timestamp
541
+ shortstr :cluster_id
542
+
543
+ class Qos < Method( 10, :qos ); end
544
+ class QosOk < Method( 11, :qos_ok ); end
545
+ class Consume < Method( 20, :consume ); end
546
+ class ConsumeOk < Method( 21, :consume_ok ); end
547
+ class Cancel < Method( 30, :cancel ); end
548
+ class CancelOk < Method( 31, :cancel_ok ); end
549
+ class Open < Method( 40, :open ); end
550
+ class OpenOk < Method( 41, :open_ok ); end
551
+ class Stage < Method( 50, :stage ); end
552
+ class Publish < Method( 60, :publish ); end
553
+ class Return < Method( 70, :return ); end
554
+ class Deliver < Method( 80, :deliver ); end
555
+ class Ack < Method( 90, :ack ); end
556
+ class Reject < Method( 100, :reject ); end
557
+
558
+ class Qos
559
+ long :prefetch_size
560
+ short :prefetch_count
561
+ bit :global
562
+ end
563
+
564
+ class QosOk
565
+ end
566
+
567
+ class Consume
568
+ short :ticket
569
+ shortstr :queue
570
+ shortstr :consumer_tag
571
+ bit :no_local
572
+ bit :no_ack
573
+ bit :exclusive
574
+ bit :nowait
575
+ end
576
+
577
+ class ConsumeOk
578
+ shortstr :consumer_tag
579
+ end
580
+
581
+ class Cancel
582
+ shortstr :consumer_tag
583
+ bit :nowait
584
+ end
585
+
586
+ class CancelOk
587
+ shortstr :consumer_tag
588
+ end
589
+
590
+ class Open
591
+ shortstr :identifier
592
+ longlong :content_size
593
+ end
594
+
595
+ class OpenOk
596
+ longlong :staged_size
597
+ end
598
+
599
+ class Stage
600
+ end
601
+
602
+ class Publish
603
+ short :ticket
604
+ shortstr :exchange
605
+ shortstr :routing_key
606
+ bit :mandatory
607
+ bit :immediate
608
+ shortstr :identifier
609
+ end
610
+
611
+ class Return
612
+ short :reply_code
613
+ shortstr :reply_text
614
+ shortstr :exchange
615
+ shortstr :routing_key
616
+ end
617
+
618
+ class Deliver
619
+ shortstr :consumer_tag
620
+ longlong :delivery_tag
621
+ bit :redelivered
622
+ shortstr :exchange
623
+ shortstr :routing_key
624
+ shortstr :identifier
625
+ end
626
+
627
+ class Ack
628
+ longlong :delivery_tag
629
+ bit :multiple
630
+ end
631
+
632
+ class Reject
633
+ longlong :delivery_tag
634
+ bit :requeue
635
+ end
636
+
637
+ end
638
+
639
+ class Stream
640
+ shortstr :content_type
641
+ shortstr :content_encoding
642
+ table :headers
643
+ octet :priority
644
+ timestamp :timestamp
645
+
646
+ class Qos < Method( 10, :qos ); end
647
+ class QosOk < Method( 11, :qos_ok ); end
648
+ class Consume < Method( 20, :consume ); end
649
+ class ConsumeOk < Method( 21, :consume_ok ); end
650
+ class Cancel < Method( 30, :cancel ); end
651
+ class CancelOk < Method( 31, :cancel_ok ); end
652
+ class Publish < Method( 40, :publish ); end
653
+ class Return < Method( 50, :return ); end
654
+ class Deliver < Method( 60, :deliver ); end
655
+
656
+ class Qos
657
+ long :prefetch_size
658
+ short :prefetch_count
659
+ long :consume_rate
660
+ bit :global
661
+ end
662
+
663
+ class QosOk
664
+ end
665
+
666
+ class Consume
667
+ short :ticket
668
+ shortstr :queue
669
+ shortstr :consumer_tag
670
+ bit :no_local
671
+ bit :exclusive
672
+ bit :nowait
673
+ end
674
+
675
+ class ConsumeOk
676
+ shortstr :consumer_tag
677
+ end
678
+
679
+ class Cancel
680
+ shortstr :consumer_tag
681
+ bit :nowait
682
+ end
683
+
684
+ class CancelOk
685
+ shortstr :consumer_tag
686
+ end
687
+
688
+ class Publish
689
+ short :ticket
690
+ shortstr :exchange
691
+ shortstr :routing_key
692
+ bit :mandatory
693
+ bit :immediate
694
+ end
695
+
696
+ class Return
697
+ short :reply_code
698
+ shortstr :reply_text
699
+ shortstr :exchange
700
+ shortstr :routing_key
701
+ end
702
+
703
+ class Deliver
704
+ shortstr :consumer_tag
705
+ longlong :delivery_tag
706
+ shortstr :exchange
707
+ shortstr :queue
708
+ end
709
+
710
+ end
711
+
712
+ class Tx
713
+
714
+ class Select < Method( 10, :select ); end
715
+ class SelectOk < Method( 11, :select_ok ); end
716
+ class Commit < Method( 20, :commit ); end
717
+ class CommitOk < Method( 21, :commit_ok ); end
718
+ class Rollback < Method( 30, :rollback ); end
719
+ class RollbackOk < Method( 31, :rollback_ok ); end
720
+
721
+ class Select
722
+ end
723
+
724
+ class SelectOk
725
+ end
726
+
727
+ class Commit
728
+ end
729
+
730
+ class CommitOk
731
+ end
732
+
733
+ class Rollback
734
+ end
735
+
736
+ class RollbackOk
737
+ end
738
+
739
+ end
740
+
741
+ class Dtx
742
+
743
+ class Select < Method( 10, :select ); end
744
+ class SelectOk < Method( 11, :select_ok ); end
745
+ class Start < Method( 20, :start ); end
746
+ class StartOk < Method( 21, :start_ok ); end
747
+
748
+ class Select
749
+ end
750
+
751
+ class SelectOk
752
+ end
753
+
754
+ class Start
755
+ shortstr :dtx_identifier
756
+ end
757
+
758
+ class StartOk
759
+ end
760
+
761
+ end
762
+
763
+ class Tunnel
764
+ table :headers
765
+ shortstr :proxy_name
766
+ shortstr :data_name
767
+ octet :durable
768
+ octet :broadcast
769
+
770
+ class Request < Method( 10, :request ); end
771
+
772
+ class Request
773
+ table :meta_data
774
+ end
775
+
776
+ end
777
+
778
+ class Test
779
+
780
+ class Integer < Method( 10, :integer ); end
781
+ class IntegerOk < Method( 11, :integer_ok ); end
782
+ class String < Method( 20, :string ); end
783
+ class StringOk < Method( 21, :string_ok ); end
784
+ class Table < Method( 30, :table ); end
785
+ class TableOk < Method( 31, :table_ok ); end
786
+ class Content < Method( 40, :content ); end
787
+ class ContentOk < Method( 41, :content_ok ); end
788
+
789
+ class Integer
790
+ octet :integer_1
791
+ short :integer_2
792
+ long :integer_3
793
+ longlong :integer_4
794
+ octet :operation
795
+ end
796
+
797
+ class IntegerOk
798
+ longlong :result
799
+ end
800
+
801
+ class String
802
+ shortstr :string_1
803
+ longstr :string_2
804
+ octet :operation
805
+ end
806
+
807
+ class StringOk
808
+ longstr :result
809
+ end
810
+
811
+ class Table
812
+ table :table
813
+ octet :integer_op
814
+ octet :string_op
815
+ end
816
+
817
+ class TableOk
818
+ longlong :integer_result
819
+ longstr :string_result
820
+ end
821
+
822
+ class Content
823
+ end
824
+
825
+ class ContentOk
826
+ long :content_checksum
827
+ end
828
+
829
+ end
830
+
831
+ end
832
+ end