bunny 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,171 @@
1
+ module AMQP
2
+ class Client
3
+ CONNECT_TIMEOUT = 1.0
4
+ RETRY_DELAY = 10.0
5
+
6
+ attr_reader :status, :host, :vhost, :port
7
+ attr_accessor :channel, :logging, :exchanges, :queues, :ticket
8
+
9
+ def initialize(opts = {})
10
+ @host = opts[:host] || 'localhost'
11
+ @port = opts[:port] || AMQP::PORT
12
+ @user = opts[:user] || 'guest'
13
+ @pass = opts[:pass] || 'guest'
14
+ @vhost = opts[:vhost] || '/'
15
+ @logging = opts[:logging] || false
16
+ @insist = opts[:insist]
17
+ @status = NOT_CONNECTED
18
+ end
19
+
20
+ def exchanges
21
+ @exchanges ||= {}
22
+ end
23
+
24
+ def queues
25
+ @queues ||= {}
26
+ end
27
+
28
+ def send_frame(*args)
29
+ args.each do |data|
30
+ data.ticket = ticket if ticket and data.respond_to?(:ticket=)
31
+ data = data.to_frame(channel) unless data.is_a?(Frame)
32
+ data.channel = channel
33
+
34
+ log :send, data
35
+ write(data.to_s)
36
+ end
37
+ nil
38
+ end
39
+
40
+ def next_frame
41
+ frame = Frame.parse(buffer)
42
+ log :received, frame
43
+ frame
44
+ end
45
+
46
+ def next_method
47
+ next_payload
48
+ end
49
+
50
+ def next_payload
51
+ frame = next_frame
52
+ frame and frame.payload
53
+ end
54
+
55
+ def close
56
+ send_frame(
57
+ Protocol::Channel::Close.new(:reply_code => 200, :reply_text => 'bye', :method_id => 0, :class_id => 0)
58
+ )
59
+ raise ProtocolError, "Error closing channel #{channel}" unless next_method.is_a?(Protocol::Channel::CloseOk)
60
+
61
+ self.channel = 0
62
+ send_frame(
63
+ Protocol::Connection::Close.new(:reply_code => 200, :reply_text => 'Goodbye', :class_id => 0, :method_id => 0)
64
+ )
65
+ raise ProtocolError, "Error closing connection" unless next_method.is_a?(Protocol::Connection::CloseOk)
66
+
67
+ close_socket
68
+ end
69
+
70
+ def read(*args)
71
+ send_command(:read, *args)
72
+ end
73
+
74
+ def write(*args)
75
+ send_command(:write, *args)
76
+ end
77
+
78
+ def start_session
79
+ @channel = 0
80
+ write(HEADER)
81
+ write([1, 1, VERSION_MAJOR, VERSION_MINOR].pack('C4'))
82
+ raise ProtocolError, 'Connection initiation failed' unless next_method.is_a?(Protocol::Connection::Start)
83
+
84
+ send_frame(
85
+ Protocol::Connection::StartOk.new(
86
+ {:platform => 'Ruby', :product => 'Bunny', :information => 'http://github.com/celldee/bunny', :version => VERSION},
87
+ 'AMQPLAIN',
88
+ {:LOGIN => @user, :PASSWORD => @pass},
89
+ 'en_US'
90
+ )
91
+ )
92
+
93
+ method = next_method
94
+ raise ProtocolError, "Connection failed - user: #{@user}, pass: #{@pass}" if method.nil?
95
+
96
+ if method.is_a?(Protocol::Connection::Tune)
97
+ send_frame(
98
+ Protocol::Connection::TuneOk.new( :channel_max => 0, :frame_max => 131072, :heartbeat => 0)
99
+ )
100
+ end
101
+
102
+ send_frame(
103
+ Protocol::Connection::Open.new(:virtual_host => @vhost, :capabilities => '', :insist => @insist)
104
+ )
105
+ raise ProtocolError, 'Cannot open connection' unless next_method.is_a?(Protocol::Connection::OpenOk)
106
+
107
+ @channel = 1
108
+ send_frame(Protocol::Channel::Open.new)
109
+ raise ProtocolError, "Cannot open channel #{channel}" unless next_method.is_a?(Protocol::Channel::OpenOk)
110
+
111
+ send_frame(
112
+ Protocol::Access::Request.new(:realm => '/data', :read => true, :write => true, :active => true, :passive => true)
113
+ )
114
+ method = next_method
115
+ raise ProtocolError, 'Access denied' unless method.is_a?(Protocol::Access::RequestOk)
116
+ self.ticket = method.ticket
117
+
118
+ # return status
119
+ status
120
+ end
121
+
122
+ private
123
+
124
+ def buffer
125
+ @buffer ||= Buffer.new(self)
126
+ end
127
+
128
+ def send_command(cmd, *args)
129
+ begin
130
+ socket.__send__(cmd, *args)
131
+ rescue Errno::EPIPE, IOError => e
132
+ raise ServerDown, e.message
133
+ end
134
+ end
135
+
136
+ def socket
137
+ return @socket if @socket and not @socket.closed?
138
+
139
+ begin
140
+ # Attempt to connect.
141
+ @socket = timeout(CONNECT_TIMEOUT) do
142
+ TCPSocket.new(host, port)
143
+ end
144
+
145
+ if Socket.constants.include? 'TCP_NODELAY'
146
+ @socket.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1
147
+ end
148
+ @status = CONNECTED
149
+ rescue SocketError, SystemCallError, IOError, Timeout::Error => e
150
+ raise ServerDown, e.message
151
+ end
152
+
153
+ @socket
154
+ end
155
+
156
+ def close_socket(reason=nil)
157
+ # Close the socket. The server is not considered dead.
158
+ @socket.close if @socket and not @socket.closed?
159
+ @socket = nil
160
+ @status = NOT_CONNECTED
161
+ end
162
+
163
+ def log(*args)
164
+ return unless logging
165
+ require 'pp'
166
+ pp args
167
+ puts
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,60 @@
1
+ module AMQP
2
+ class Frame #:nodoc: all
3
+ def initialize payload = nil, channel = 0
4
+ @channel, @payload = channel, payload
5
+ end
6
+ attr_accessor :channel, :payload
7
+
8
+ def id
9
+ self.class::ID
10
+ end
11
+
12
+ def to_binary
13
+ buf = Buffer.new
14
+ buf.write :octet, id
15
+ buf.write :short, channel
16
+ buf.write :longstr, payload
17
+ buf.write :octet, FOOTER
18
+ buf.rewind
19
+ buf
20
+ end
21
+
22
+ def to_s
23
+ to_binary.to_s
24
+ end
25
+
26
+ def == frame
27
+ [ :id, :channel, :payload ].inject(true) do |eql, field|
28
+ eql and __send__(field) == frame.__send__(field)
29
+ end
30
+ end
31
+
32
+ class Method
33
+ def initialize payload = nil, channel = 0
34
+ super
35
+ unless @payload.is_a? Protocol::Class::Method or @payload.nil?
36
+ @payload = Protocol.parse(@payload)
37
+ end
38
+ end
39
+ end
40
+
41
+ class Header
42
+ def initialize payload = nil, channel = 0
43
+ super
44
+ unless @payload.is_a? Protocol::Header or @payload.nil?
45
+ @payload = Protocol::Header.new(@payload)
46
+ end
47
+ end
48
+ end
49
+
50
+ class Body; end
51
+
52
+ def self.parse buf
53
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
54
+ buf.extract do
55
+ id, channel, payload, footer = buf.read(:octet, :short, :longstr, :octet)
56
+ Frame.types[id].new(payload, channel) if footer == FOOTER
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,158 @@
1
+ module AMQP
2
+ module Protocol
3
+ #:stopdoc:
4
+ class Class::Method
5
+ def initialize *args
6
+ opts = args.pop if args.last.is_a? Hash
7
+ opts ||= {}
8
+
9
+ @debug = 1 # XXX hack, p(obj) == '' if no instance vars are set
10
+
11
+ if args.size == 1 and args.first.is_a? Buffer
12
+ buf = args.shift
13
+ else
14
+ buf = nil
15
+ end
16
+
17
+ self.class.arguments.each do |type, name|
18
+ val = buf ? buf.read(type) :
19
+ args.shift || opts[name] || opts[name.to_s]
20
+ instance_variable_set("@#{name}", val)
21
+ end
22
+ end
23
+
24
+ def arguments
25
+ self.class.arguments.inject({}) do |hash, (type, name)|
26
+ hash.update name => instance_variable_get("@#{name}")
27
+ end
28
+ end
29
+
30
+ def to_binary
31
+ buf = Buffer.new
32
+ buf.write :short, self.class.parent.id
33
+ buf.write :short, self.class.id
34
+
35
+ bits = []
36
+
37
+ self.class.arguments.each do |type, name|
38
+ val = instance_variable_get("@#{name}")
39
+ if type == :bit
40
+ bits << (val || false)
41
+ else
42
+ unless bits.empty?
43
+ buf.write :bit, bits
44
+ bits = []
45
+ end
46
+ buf.write type, val
47
+ end
48
+ end
49
+
50
+ buf.write :bit, bits unless bits.empty?
51
+ buf.rewind
52
+
53
+ buf
54
+ end
55
+
56
+ def to_s
57
+ to_binary.to_s
58
+ end
59
+
60
+ def to_frame channel = 0
61
+ Frame::Method.new(self, channel)
62
+ end
63
+ end
64
+
65
+ #:startdoc:
66
+ #
67
+ # Contains a properties hash that holds some potentially interesting
68
+ # information.
69
+ # * :delivery_mode
70
+ # 1 equals transient.
71
+ # 2 equals persistent. Unconsumed persistent messages will survive
72
+ # a server restart when they are stored in a durable queue.
73
+ # * :redelivered
74
+ # True or False
75
+ # * :routing_key
76
+ # The routing string used for matching this message to this queue.
77
+ # * :priority
78
+ # An integer in the range of 0 to 9 inclusive.
79
+ # * :content_type
80
+ # Always "application/octet-stream" (byte stream)
81
+ # * :exchange
82
+ # The source exchange which published this message.
83
+ # * :message_count
84
+ # The number of unconsumed messages contained in the queue.
85
+ # * :delivery_tag
86
+ # A monotonically increasing integer. This number should not be trusted
87
+ # as a sequence number. There is no guarantee it won't get reset.
88
+ class Header
89
+ def initialize *args
90
+ opts = args.pop if args.last.is_a? Hash
91
+ opts ||= {}
92
+
93
+ first = args.shift
94
+
95
+ if first.is_a? ::Class and first.ancestors.include? Protocol::Class
96
+ @klass = first
97
+ @size = args.shift || 0
98
+ @weight = args.shift || 0
99
+ @properties = opts
100
+
101
+ elsif first.is_a? Buffer or first.is_a? String
102
+ buf = first
103
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
104
+
105
+ @klass = Protocol.classes[buf.read(:short)]
106
+ @weight = buf.read(:short)
107
+ @size = buf.read(:longlong)
108
+
109
+ props = buf.read(:properties, *klass.properties.map{|type,_| type })
110
+ @properties = Hash[*klass.properties.map{|_,name| name }.zip(props).reject{|k,v| v.nil? }.flatten]
111
+
112
+ else
113
+ raise ArgumentError, 'Invalid argument'
114
+ end
115
+
116
+ end
117
+ attr_accessor :klass, :size, :weight, :properties
118
+
119
+ def to_binary
120
+ buf = Buffer.new
121
+ buf.write :short, klass.id
122
+ buf.write :short, weight # XXX rabbitmq only supports weight == 0
123
+ buf.write :longlong, size
124
+ buf.write :properties, (klass.properties.map do |type, name|
125
+ [ type, properties[name] || properties[name.to_s] ]
126
+ end)
127
+ buf.rewind
128
+ buf
129
+ end
130
+
131
+ def to_s
132
+ to_binary.to_s
133
+ end
134
+
135
+ def to_frame channel = 0
136
+ Frame::Header.new(self, channel)
137
+ end
138
+
139
+ def == header
140
+ [ :klass, :size, :weight, :properties ].inject(true) do |eql, field|
141
+ eql and __send__(field) == header.__send__(field)
142
+ end
143
+ end
144
+
145
+ def method_missing meth, *args, &blk
146
+ @properties.has_key?(meth) || @klass.properties.find{|_,name| name == meth } ? @properties[meth] :
147
+ super
148
+ end
149
+ end
150
+
151
+ def self.parse buf
152
+ buf = Buffer.new(buf) unless buf.is_a? Buffer
153
+ class_id, method_id = buf.read(:short, :short)
154
+ classes[class_id].methods[method_id].new(buf)
155
+ end
156
+ #:stopdoc:
157
+ end
158
+ end
@@ -0,0 +1,832 @@
1
+
2
+ #:stopdoc:
3
+ # this file was autogenerated on Fri Apr 17 11:11:24 +0100 2009
4
+ # using amqp-0.8.json (mtime: Fri Apr 17 00:07:40 +0100 2009)
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 parent() 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.parent.methods[#{id}] = klass
121
+ klass.parent.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