maxlapshin-carrot 0.6.0
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.
- data/README.markdown +34 -0
- data/VERSION.yml +4 -0
- data/lib/amqp/buffer.rb +401 -0
- data/lib/amqp/exchange.rb +51 -0
- data/lib/amqp/frame.rb +121 -0
- data/lib/amqp/header.rb +27 -0
- data/lib/amqp/protocol.rb +209 -0
- data/lib/amqp/queue.rb +94 -0
- data/lib/amqp/server.rb +184 -0
- data/lib/amqp/spec.rb +820 -0
- data/lib/carrot.rb +91 -0
- data/lib/examples/simple_pop.rb +13 -0
- data/test/carrot_test.rb +8 -0
- data/test/test_helper.rb +18 -0
- metadata +69 -0
data/lib/amqp/server.rb
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'thread'
|
3
|
+
require 'timeout'
|
4
|
+
|
5
|
+
module Carrot::AMQP
|
6
|
+
class Server
|
7
|
+
CONNECT_TIMEOUT = 1.0
|
8
|
+
RETRY_DELAY = 10.0
|
9
|
+
DEFAULT_PORT = 5672
|
10
|
+
|
11
|
+
attr_reader :host, :port, :status
|
12
|
+
attr_accessor :channel, :ticket
|
13
|
+
|
14
|
+
class ServerDown < StandardError; end
|
15
|
+
class ProtocolError < StandardError; end
|
16
|
+
|
17
|
+
def initialize(opts = {})
|
18
|
+
@host = opts[:host] || 'localhost'
|
19
|
+
@port = opts[:port] || DEFAULT_PORT
|
20
|
+
@user = opts[:user] || 'guest'
|
21
|
+
@pass = opts[:pass] || 'guest'
|
22
|
+
@vhost = opts[:vhost] || '/'
|
23
|
+
@insist = opts[:insist]
|
24
|
+
@status = 'NOT CONNECTED'
|
25
|
+
|
26
|
+
@multithread = opts[:multithread]
|
27
|
+
start_session
|
28
|
+
end
|
29
|
+
|
30
|
+
def send_frame(*args)
|
31
|
+
args.each do |data|
|
32
|
+
data.ticket = ticket if ticket and data.respond_to?(:ticket=)
|
33
|
+
data = data.to_frame(channel) unless data.is_a?(Frame)
|
34
|
+
data.channel = channel
|
35
|
+
|
36
|
+
log :send, data
|
37
|
+
write(data.to_s)
|
38
|
+
end
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def next_frame
|
43
|
+
frame = Frame.parse(buffer)
|
44
|
+
log :received, frame
|
45
|
+
frame
|
46
|
+
end
|
47
|
+
|
48
|
+
def next_method
|
49
|
+
next_payload
|
50
|
+
end
|
51
|
+
|
52
|
+
def next_payload
|
53
|
+
frame = next_frame
|
54
|
+
frame and frame.payload
|
55
|
+
end
|
56
|
+
|
57
|
+
def close
|
58
|
+
send_frame(
|
59
|
+
Protocol::Channel::Close.new(:reply_code => 200, :reply_text => 'bye', :method_id => 0, :class_id => 0)
|
60
|
+
)
|
61
|
+
puts "Error closing channel #{channel}" unless next_method.is_a?(Protocol::Channel::CloseOk)
|
62
|
+
|
63
|
+
self.channel = 0
|
64
|
+
send_frame(
|
65
|
+
Protocol::Connection::Close.new(:reply_code => 200, :reply_text => 'Goodbye', :class_id => 0, :method_id => 0)
|
66
|
+
)
|
67
|
+
puts "Error closing connection" unless next_method.is_a?(Protocol::Connection::CloseOk)
|
68
|
+
|
69
|
+
close_socket
|
70
|
+
end
|
71
|
+
|
72
|
+
def read(*args)
|
73
|
+
send_command(:read, *args)
|
74
|
+
end
|
75
|
+
|
76
|
+
def write(*args)
|
77
|
+
send_command(:write, *args)
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def buffer
|
83
|
+
@buffer ||= Buffer.new(self)
|
84
|
+
end
|
85
|
+
|
86
|
+
def send_command(cmd, *args)
|
87
|
+
begin
|
88
|
+
socket.__send__(cmd, *args)
|
89
|
+
rescue Errno::EPIPE, IOError => e
|
90
|
+
raise ServerDown, e.message
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def socket
|
95
|
+
return @socket if @socket and not @socket.closed?
|
96
|
+
|
97
|
+
begin
|
98
|
+
# Attempt to connect.
|
99
|
+
mutex.lock if multithread?
|
100
|
+
@socket = timeout(CONNECT_TIMEOUT) do
|
101
|
+
TCPSocket.new(host, port)
|
102
|
+
end
|
103
|
+
|
104
|
+
if Socket.constants.include? 'TCP_NODELAY'
|
105
|
+
@socket.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1
|
106
|
+
end
|
107
|
+
@status = 'CONNECTED'
|
108
|
+
rescue SocketError, SystemCallError, IOError, Timeout::Error => e
|
109
|
+
raise ServerDown, e.message
|
110
|
+
ensure
|
111
|
+
mutex.unlock if multithread?
|
112
|
+
end
|
113
|
+
|
114
|
+
@socket
|
115
|
+
end
|
116
|
+
|
117
|
+
def start_session
|
118
|
+
@channel = 0
|
119
|
+
write(HEADER)
|
120
|
+
write([1, 1, VERSION_MAJOR, VERSION_MINOR].pack('C4'))
|
121
|
+
raise ProtocolError, 'bad start connection' unless next_method.is_a?(Protocol::Connection::Start)
|
122
|
+
|
123
|
+
send_frame(
|
124
|
+
Protocol::Connection::StartOk.new(
|
125
|
+
{:platform => 'Ruby', :product => 'Carrot', :information => 'http://github.com/famosagle/carrot', :version => VERSION},
|
126
|
+
'AMQPLAIN',
|
127
|
+
{:LOGIN => @user, :PASSWORD => @pass},
|
128
|
+
'en_US'
|
129
|
+
)
|
130
|
+
)
|
131
|
+
|
132
|
+
method = next_method
|
133
|
+
raise ProtocolError, "Bad AMQP Credentials. user: #{@user}, pass: #{@pass}" if method.nil?
|
134
|
+
|
135
|
+
if method.is_a?(Protocol::Connection::Tune)
|
136
|
+
send_frame(
|
137
|
+
Protocol::Connection::TuneOk.new( :channel_max => 0, :frame_max => 131072, :heartbeat => 0)
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
141
|
+
send_frame(
|
142
|
+
Protocol::Connection::Open.new(:virtual_host => @vhost, :capabilities => '', :insist => @insist)
|
143
|
+
)
|
144
|
+
raise ProtocolError, 'bad open connection' unless next_method.is_a?(Protocol::Connection::OpenOk)
|
145
|
+
|
146
|
+
@channel = 1
|
147
|
+
send_frame(Protocol::Channel::Open.new)
|
148
|
+
raise ProtocolError, "cannot open channel #{channel}" unless next_method.is_a?(Protocol::Channel::OpenOk)
|
149
|
+
|
150
|
+
send_frame(
|
151
|
+
Protocol::Access::Request.new(:realm => '/data', :read => true, :write => true, :active => true, :passive => true)
|
152
|
+
)
|
153
|
+
method = next_method
|
154
|
+
raise ProtocolError, 'access denied' unless method.is_a?(Protocol::Access::RequestOk)
|
155
|
+
self.ticket = method.ticket
|
156
|
+
end
|
157
|
+
|
158
|
+
def multithread?
|
159
|
+
@multithread
|
160
|
+
end
|
161
|
+
|
162
|
+
def close_socket(reason=nil)
|
163
|
+
# Close the socket. The server is not considered dead.
|
164
|
+
mutex.lock if multithread?
|
165
|
+
@socket.close if @socket and not @socket.closed?
|
166
|
+
@socket = nil
|
167
|
+
@status = "NOT CONNECTED"
|
168
|
+
ensure
|
169
|
+
mutex.unlock if multithread?
|
170
|
+
end
|
171
|
+
|
172
|
+
def mutex
|
173
|
+
@mutex ||= Mutex.new
|
174
|
+
end
|
175
|
+
|
176
|
+
def log(*args)
|
177
|
+
return unless Carrot.logging?
|
178
|
+
require 'pp'
|
179
|
+
pp args
|
180
|
+
puts
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
data/lib/amqp/spec.rb
ADDED
@@ -0,0 +1,820 @@
|
|
1
|
+
module Carrot::AMQP
|
2
|
+
class Frame
|
3
|
+
def self.types
|
4
|
+
@types ||= {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.Frame id
|
8
|
+
(@_base_frames ||= {})[id] ||= Class.new(Frame) do
|
9
|
+
class_eval %[
|
10
|
+
def self.inherited klass
|
11
|
+
klass.const_set(:ID, #{id})
|
12
|
+
Frame.types[#{id}] = klass
|
13
|
+
end
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Method < Frame( 1 ); end
|
19
|
+
class Header < Frame( 2 ); end
|
20
|
+
class Body < Frame( 3 ); end
|
21
|
+
class OobMethod < Frame( 4 ); end
|
22
|
+
class OobHeader < Frame( 5 ); end
|
23
|
+
class OobBody < Frame( 6 ); end
|
24
|
+
class Trace < Frame( 7 ); end
|
25
|
+
class Heartbeat < Frame( 8 ); end
|
26
|
+
|
27
|
+
FOOTER = 206
|
28
|
+
end
|
29
|
+
|
30
|
+
RESPONSES = {
|
31
|
+
200 => :REPLY_SUCCESS,
|
32
|
+
310 => :NOT_DELIVERED,
|
33
|
+
311 => :CONTENT_TOO_LARGE,
|
34
|
+
312 => :NO_ROUTE,
|
35
|
+
313 => :NO_CONSUMERS,
|
36
|
+
403 => :ACCESS_REFUSED,
|
37
|
+
404 => :NOT_FOUND,
|
38
|
+
405 => :RESOURCE_LOCKED,
|
39
|
+
406 => :PRECONDITION_FAILED,
|
40
|
+
320 => :CONNECTION_FORCED,
|
41
|
+
402 => :INVALID_PATH,
|
42
|
+
}
|
43
|
+
|
44
|
+
FIELDS = [
|
45
|
+
:bit,
|
46
|
+
:long,
|
47
|
+
:longlong,
|
48
|
+
:longstr,
|
49
|
+
:octet,
|
50
|
+
:short,
|
51
|
+
:shortstr,
|
52
|
+
:table,
|
53
|
+
:timestamp,
|
54
|
+
]
|
55
|
+
|
56
|
+
module Protocol
|
57
|
+
class Class
|
58
|
+
class << self
|
59
|
+
FIELDS.each do |f|
|
60
|
+
class_eval %[
|
61
|
+
def #{f} name
|
62
|
+
properties << [ :#{f}, name ] unless properties.include?([:#{f}, name])
|
63
|
+
attr_accessor name
|
64
|
+
end
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
def properties() @properties ||= [] end
|
69
|
+
|
70
|
+
def id() self::ID end
|
71
|
+
def name() self::NAME end
|
72
|
+
end
|
73
|
+
|
74
|
+
class Method
|
75
|
+
class << self
|
76
|
+
FIELDS.each do |f|
|
77
|
+
class_eval %[
|
78
|
+
def #{f} name
|
79
|
+
arguments << [ :#{f}, name ] unless arguments.include?([:#{f}, name])
|
80
|
+
attr_accessor name
|
81
|
+
end
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def arguments() @arguments ||= [] end
|
86
|
+
|
87
|
+
def parent() Protocol.const_get(self.to_s[/Protocol::(.+?)::/,1]) end
|
88
|
+
def id() self::ID end
|
89
|
+
def name() self::NAME end
|
90
|
+
end
|
91
|
+
|
92
|
+
def == b
|
93
|
+
self.class.arguments.inject(true) do |eql, (type, name)|
|
94
|
+
eql and __send__("#{name}") == b.__send__("#{name}")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.methods() @methods ||= {} end
|
100
|
+
|
101
|
+
def self.Method(id, name)
|
102
|
+
@_base_methods ||= {}
|
103
|
+
@_base_methods[id] ||= ::Class.new(Method) do
|
104
|
+
class_eval %[
|
105
|
+
def self.inherited klass
|
106
|
+
klass.const_set(:ID, #{id})
|
107
|
+
klass.const_set(:NAME, :#{name.to_s})
|
108
|
+
klass.parent.methods[#{id}] = klass
|
109
|
+
klass.parent.methods[klass::NAME] = klass
|
110
|
+
end
|
111
|
+
]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.classes() @classes ||= {} end
|
117
|
+
|
118
|
+
def self.Class(id, name)
|
119
|
+
@_base_classes ||= {}
|
120
|
+
@_base_classes[id] ||= ::Class.new(Class) do
|
121
|
+
class_eval %[
|
122
|
+
def self.inherited klass
|
123
|
+
klass.const_set(:ID, #{id})
|
124
|
+
klass.const_set(:NAME, :#{name.to_s})
|
125
|
+
Protocol.classes[#{id}] = klass
|
126
|
+
Protocol.classes[klass::NAME] = klass
|
127
|
+
end
|
128
|
+
]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
module Carrot::AMQP
|
135
|
+
module Protocol
|
136
|
+
class Connection < Class( 10, :connection ); end
|
137
|
+
class Channel < Class( 20, :channel ); end
|
138
|
+
class Access < Class( 30, :access ); end
|
139
|
+
class Exchange < Class( 40, :exchange ); end
|
140
|
+
class Queue < Class( 50, :queue ); end
|
141
|
+
class Basic < Class( 60, :basic ); end
|
142
|
+
class File < Class( 70, :file ); end
|
143
|
+
class Stream < Class( 80, :stream ); end
|
144
|
+
class Tx < Class( 90, :tx ); end
|
145
|
+
class Dtx < Class( 100, :dtx ); end
|
146
|
+
class Tunnel < Class( 110, :tunnel ); end
|
147
|
+
class Test < Class( 120, :test ); end
|
148
|
+
|
149
|
+
class Connection
|
150
|
+
|
151
|
+
class Start < Method( 10, :start ); end
|
152
|
+
class StartOk < Method( 11, :start_ok ); end
|
153
|
+
class Secure < Method( 20, :secure ); end
|
154
|
+
class SecureOk < Method( 21, :secure_ok ); end
|
155
|
+
class Tune < Method( 30, :tune ); end
|
156
|
+
class TuneOk < Method( 31, :tune_ok ); end
|
157
|
+
class Open < Method( 40, :open ); end
|
158
|
+
class OpenOk < Method( 41, :open_ok ); end
|
159
|
+
class Redirect < Method( 50, :redirect ); end
|
160
|
+
class Close < Method( 60, :close ); end
|
161
|
+
class CloseOk < Method( 61, :close_ok ); end
|
162
|
+
|
163
|
+
class Start
|
164
|
+
octet :version_major
|
165
|
+
octet :version_minor
|
166
|
+
table :server_properties
|
167
|
+
longstr :mechanisms
|
168
|
+
longstr :locales
|
169
|
+
end
|
170
|
+
|
171
|
+
class StartOk
|
172
|
+
table :client_properties
|
173
|
+
shortstr :mechanism
|
174
|
+
longstr :response
|
175
|
+
shortstr :locale
|
176
|
+
end
|
177
|
+
|
178
|
+
class Secure
|
179
|
+
longstr :challenge
|
180
|
+
end
|
181
|
+
|
182
|
+
class SecureOk
|
183
|
+
longstr :response
|
184
|
+
end
|
185
|
+
|
186
|
+
class Tune
|
187
|
+
short :channel_max
|
188
|
+
long :frame_max
|
189
|
+
short :heartbeat
|
190
|
+
end
|
191
|
+
|
192
|
+
class TuneOk
|
193
|
+
short :channel_max
|
194
|
+
long :frame_max
|
195
|
+
short :heartbeat
|
196
|
+
end
|
197
|
+
|
198
|
+
class Open
|
199
|
+
shortstr :virtual_host
|
200
|
+
shortstr :capabilities
|
201
|
+
bit :insist
|
202
|
+
end
|
203
|
+
|
204
|
+
class OpenOk
|
205
|
+
shortstr :known_hosts
|
206
|
+
end
|
207
|
+
|
208
|
+
class Redirect
|
209
|
+
shortstr :host
|
210
|
+
shortstr :known_hosts
|
211
|
+
end
|
212
|
+
|
213
|
+
class Close
|
214
|
+
short :reply_code
|
215
|
+
shortstr :reply_text
|
216
|
+
short :class_id
|
217
|
+
short :method_id
|
218
|
+
end
|
219
|
+
|
220
|
+
class CloseOk
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
class Channel
|
226
|
+
|
227
|
+
class Open < Method( 10, :open ); end
|
228
|
+
class OpenOk < Method( 11, :open_ok ); end
|
229
|
+
class Flow < Method( 20, :flow ); end
|
230
|
+
class FlowOk < Method( 21, :flow_ok ); end
|
231
|
+
class Alert < Method( 30, :alert ); end
|
232
|
+
class Close < Method( 40, :close ); end
|
233
|
+
class CloseOk < Method( 41, :close_ok ); end
|
234
|
+
|
235
|
+
class Open
|
236
|
+
shortstr :out_of_band
|
237
|
+
end
|
238
|
+
|
239
|
+
class OpenOk
|
240
|
+
end
|
241
|
+
|
242
|
+
class Flow
|
243
|
+
bit :active
|
244
|
+
end
|
245
|
+
|
246
|
+
class FlowOk
|
247
|
+
bit :active
|
248
|
+
end
|
249
|
+
|
250
|
+
class Alert
|
251
|
+
short :reply_code
|
252
|
+
shortstr :reply_text
|
253
|
+
table :details
|
254
|
+
end
|
255
|
+
|
256
|
+
class Close
|
257
|
+
short :reply_code
|
258
|
+
shortstr :reply_text
|
259
|
+
short :class_id
|
260
|
+
short :method_id
|
261
|
+
end
|
262
|
+
|
263
|
+
class CloseOk
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
|
268
|
+
class Access
|
269
|
+
|
270
|
+
class Request < Method( 10, :request ); end
|
271
|
+
class RequestOk < Method( 11, :request_ok ); end
|
272
|
+
|
273
|
+
class Request
|
274
|
+
shortstr :realm
|
275
|
+
bit :exclusive
|
276
|
+
bit :passive
|
277
|
+
bit :active
|
278
|
+
bit :write
|
279
|
+
bit :read
|
280
|
+
end
|
281
|
+
|
282
|
+
class RequestOk
|
283
|
+
short :ticket
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
class Exchange
|
289
|
+
|
290
|
+
class Declare < Method( 10, :declare ); end
|
291
|
+
class DeclareOk < Method( 11, :declare_ok ); end
|
292
|
+
class Delete < Method( 20, :delete ); end
|
293
|
+
class DeleteOk < Method( 21, :delete_ok ); end
|
294
|
+
|
295
|
+
class Declare
|
296
|
+
short :ticket
|
297
|
+
shortstr :exchange
|
298
|
+
shortstr :type
|
299
|
+
bit :passive
|
300
|
+
bit :durable
|
301
|
+
bit :auto_delete
|
302
|
+
bit :internal
|
303
|
+
bit :nowait
|
304
|
+
table :arguments
|
305
|
+
end
|
306
|
+
|
307
|
+
class DeclareOk
|
308
|
+
end
|
309
|
+
|
310
|
+
class Delete
|
311
|
+
short :ticket
|
312
|
+
shortstr :exchange
|
313
|
+
bit :if_unused
|
314
|
+
bit :nowait
|
315
|
+
end
|
316
|
+
|
317
|
+
class DeleteOk
|
318
|
+
end
|
319
|
+
|
320
|
+
end
|
321
|
+
|
322
|
+
class Queue
|
323
|
+
|
324
|
+
class Declare < Method( 10, :declare ); end
|
325
|
+
class DeclareOk < Method( 11, :declare_ok ); end
|
326
|
+
class Bind < Method( 20, :bind ); end
|
327
|
+
class BindOk < Method( 21, :bind_ok ); end
|
328
|
+
class Purge < Method( 30, :purge ); end
|
329
|
+
class PurgeOk < Method( 31, :purge_ok ); end
|
330
|
+
class Delete < Method( 40, :delete ); end
|
331
|
+
class DeleteOk < Method( 41, :delete_ok ); end
|
332
|
+
class Unbind < Method( 50, :unbind ); end
|
333
|
+
class UnbindOk < Method( 51, :unbind_ok ); end
|
334
|
+
|
335
|
+
class Declare
|
336
|
+
short :ticket
|
337
|
+
shortstr :queue
|
338
|
+
bit :passive
|
339
|
+
bit :durable
|
340
|
+
bit :exclusive
|
341
|
+
bit :auto_delete
|
342
|
+
bit :nowait
|
343
|
+
table :arguments
|
344
|
+
end
|
345
|
+
|
346
|
+
class DeclareOk
|
347
|
+
shortstr :queue
|
348
|
+
long :message_count
|
349
|
+
long :consumer_count
|
350
|
+
end
|
351
|
+
|
352
|
+
class Bind
|
353
|
+
short :ticket
|
354
|
+
shortstr :queue
|
355
|
+
shortstr :exchange
|
356
|
+
shortstr :routing_key
|
357
|
+
bit :nowait
|
358
|
+
table :arguments
|
359
|
+
end
|
360
|
+
|
361
|
+
class BindOk
|
362
|
+
end
|
363
|
+
|
364
|
+
class Purge
|
365
|
+
short :ticket
|
366
|
+
shortstr :queue
|
367
|
+
bit :nowait
|
368
|
+
end
|
369
|
+
|
370
|
+
class PurgeOk
|
371
|
+
long :message_count
|
372
|
+
end
|
373
|
+
|
374
|
+
class Delete
|
375
|
+
short :ticket
|
376
|
+
shortstr :queue
|
377
|
+
bit :if_unused
|
378
|
+
bit :if_empty
|
379
|
+
bit :nowait
|
380
|
+
end
|
381
|
+
|
382
|
+
class DeleteOk
|
383
|
+
long :message_count
|
384
|
+
end
|
385
|
+
|
386
|
+
class Unbind
|
387
|
+
short :ticket
|
388
|
+
shortstr :queue
|
389
|
+
shortstr :exchange
|
390
|
+
shortstr :routing_key
|
391
|
+
table :arguments
|
392
|
+
end
|
393
|
+
|
394
|
+
class UnbindOk
|
395
|
+
end
|
396
|
+
|
397
|
+
end
|
398
|
+
|
399
|
+
class Basic
|
400
|
+
shortstr :content_type
|
401
|
+
shortstr :content_encoding
|
402
|
+
table :headers
|
403
|
+
octet :delivery_mode
|
404
|
+
octet :priority
|
405
|
+
shortstr :correlation_id
|
406
|
+
shortstr :reply_to
|
407
|
+
shortstr :expiration
|
408
|
+
shortstr :message_id
|
409
|
+
timestamp :timestamp
|
410
|
+
shortstr :type
|
411
|
+
shortstr :user_id
|
412
|
+
shortstr :app_id
|
413
|
+
shortstr :cluster_id
|
414
|
+
|
415
|
+
class Qos < Method( 10, :qos ); end
|
416
|
+
class QosOk < Method( 11, :qos_ok ); end
|
417
|
+
class Consume < Method( 20, :consume ); end
|
418
|
+
class ConsumeOk < Method( 21, :consume_ok ); end
|
419
|
+
class Cancel < Method( 30, :cancel ); end
|
420
|
+
class CancelOk < Method( 31, :cancel_ok ); end
|
421
|
+
class Publish < Method( 40, :publish ); end
|
422
|
+
class Return < Method( 50, :return ); end
|
423
|
+
class Deliver < Method( 60, :deliver ); end
|
424
|
+
class Get < Method( 70, :get ); end
|
425
|
+
class GetOk < Method( 71, :get_ok ); end
|
426
|
+
class GetEmpty < Method( 72, :get_empty ); end
|
427
|
+
class Ack < Method( 80, :ack ); end
|
428
|
+
class Reject < Method( 90, :reject ); end
|
429
|
+
class Recover < Method( 100, :recover ); end
|
430
|
+
|
431
|
+
class Qos
|
432
|
+
long :prefetch_size
|
433
|
+
short :prefetch_count
|
434
|
+
bit :global
|
435
|
+
end
|
436
|
+
|
437
|
+
class QosOk
|
438
|
+
end
|
439
|
+
|
440
|
+
class Consume
|
441
|
+
short :ticket
|
442
|
+
shortstr :queue
|
443
|
+
shortstr :consumer_tag
|
444
|
+
bit :no_local
|
445
|
+
bit :no_ack
|
446
|
+
bit :exclusive
|
447
|
+
bit :nowait
|
448
|
+
end
|
449
|
+
|
450
|
+
class ConsumeOk
|
451
|
+
shortstr :consumer_tag
|
452
|
+
end
|
453
|
+
|
454
|
+
class Cancel
|
455
|
+
shortstr :consumer_tag
|
456
|
+
bit :nowait
|
457
|
+
end
|
458
|
+
|
459
|
+
class CancelOk
|
460
|
+
shortstr :consumer_tag
|
461
|
+
end
|
462
|
+
|
463
|
+
class Publish
|
464
|
+
short :ticket
|
465
|
+
shortstr :exchange
|
466
|
+
shortstr :routing_key
|
467
|
+
bit :mandatory
|
468
|
+
bit :immediate
|
469
|
+
end
|
470
|
+
|
471
|
+
class Return
|
472
|
+
short :reply_code
|
473
|
+
shortstr :reply_text
|
474
|
+
shortstr :exchange
|
475
|
+
shortstr :routing_key
|
476
|
+
end
|
477
|
+
|
478
|
+
class Deliver
|
479
|
+
shortstr :consumer_tag
|
480
|
+
longlong :delivery_tag
|
481
|
+
bit :redelivered
|
482
|
+
shortstr :exchange
|
483
|
+
shortstr :routing_key
|
484
|
+
end
|
485
|
+
|
486
|
+
class Get
|
487
|
+
short :ticket
|
488
|
+
shortstr :queue
|
489
|
+
bit :no_ack
|
490
|
+
end
|
491
|
+
|
492
|
+
class GetOk
|
493
|
+
longlong :delivery_tag
|
494
|
+
bit :redelivered
|
495
|
+
shortstr :exchange
|
496
|
+
shortstr :routing_key
|
497
|
+
long :message_count
|
498
|
+
end
|
499
|
+
|
500
|
+
class GetEmpty
|
501
|
+
shortstr :cluster_id
|
502
|
+
end
|
503
|
+
|
504
|
+
class Ack
|
505
|
+
longlong :delivery_tag
|
506
|
+
bit :multiple
|
507
|
+
end
|
508
|
+
|
509
|
+
class Reject
|
510
|
+
longlong :delivery_tag
|
511
|
+
bit :requeue
|
512
|
+
end
|
513
|
+
|
514
|
+
class Recover
|
515
|
+
bit :requeue
|
516
|
+
end
|
517
|
+
|
518
|
+
end
|
519
|
+
|
520
|
+
class File
|
521
|
+
shortstr :content_type
|
522
|
+
shortstr :content_encoding
|
523
|
+
table :headers
|
524
|
+
octet :priority
|
525
|
+
shortstr :reply_to
|
526
|
+
shortstr :message_id
|
527
|
+
shortstr :filename
|
528
|
+
timestamp :timestamp
|
529
|
+
shortstr :cluster_id
|
530
|
+
|
531
|
+
class Qos < Method( 10, :qos ); end
|
532
|
+
class QosOk < Method( 11, :qos_ok ); end
|
533
|
+
class Consume < Method( 20, :consume ); end
|
534
|
+
class ConsumeOk < Method( 21, :consume_ok ); end
|
535
|
+
class Cancel < Method( 30, :cancel ); end
|
536
|
+
class CancelOk < Method( 31, :cancel_ok ); end
|
537
|
+
class Open < Method( 40, :open ); end
|
538
|
+
class OpenOk < Method( 41, :open_ok ); end
|
539
|
+
class Stage < Method( 50, :stage ); end
|
540
|
+
class Publish < Method( 60, :publish ); end
|
541
|
+
class Return < Method( 70, :return ); end
|
542
|
+
class Deliver < Method( 80, :deliver ); end
|
543
|
+
class Ack < Method( 90, :ack ); end
|
544
|
+
class Reject < Method( 100, :reject ); end
|
545
|
+
|
546
|
+
class Qos
|
547
|
+
long :prefetch_size
|
548
|
+
short :prefetch_count
|
549
|
+
bit :global
|
550
|
+
end
|
551
|
+
|
552
|
+
class QosOk
|
553
|
+
end
|
554
|
+
|
555
|
+
class Consume
|
556
|
+
short :ticket
|
557
|
+
shortstr :queue
|
558
|
+
shortstr :consumer_tag
|
559
|
+
bit :no_local
|
560
|
+
bit :no_ack
|
561
|
+
bit :exclusive
|
562
|
+
bit :nowait
|
563
|
+
end
|
564
|
+
|
565
|
+
class ConsumeOk
|
566
|
+
shortstr :consumer_tag
|
567
|
+
end
|
568
|
+
|
569
|
+
class Cancel
|
570
|
+
shortstr :consumer_tag
|
571
|
+
bit :nowait
|
572
|
+
end
|
573
|
+
|
574
|
+
class CancelOk
|
575
|
+
shortstr :consumer_tag
|
576
|
+
end
|
577
|
+
|
578
|
+
class Open
|
579
|
+
shortstr :identifier
|
580
|
+
longlong :content_size
|
581
|
+
end
|
582
|
+
|
583
|
+
class OpenOk
|
584
|
+
longlong :staged_size
|
585
|
+
end
|
586
|
+
|
587
|
+
class Stage
|
588
|
+
end
|
589
|
+
|
590
|
+
class Publish
|
591
|
+
short :ticket
|
592
|
+
shortstr :exchange
|
593
|
+
shortstr :routing_key
|
594
|
+
bit :mandatory
|
595
|
+
bit :immediate
|
596
|
+
shortstr :identifier
|
597
|
+
end
|
598
|
+
|
599
|
+
class Return
|
600
|
+
short :reply_code
|
601
|
+
shortstr :reply_text
|
602
|
+
shortstr :exchange
|
603
|
+
shortstr :routing_key
|
604
|
+
end
|
605
|
+
|
606
|
+
class Deliver
|
607
|
+
shortstr :consumer_tag
|
608
|
+
longlong :delivery_tag
|
609
|
+
bit :redelivered
|
610
|
+
shortstr :exchange
|
611
|
+
shortstr :routing_key
|
612
|
+
shortstr :identifier
|
613
|
+
end
|
614
|
+
|
615
|
+
class Ack
|
616
|
+
longlong :delivery_tag
|
617
|
+
bit :multiple
|
618
|
+
end
|
619
|
+
|
620
|
+
class Reject
|
621
|
+
longlong :delivery_tag
|
622
|
+
bit :requeue
|
623
|
+
end
|
624
|
+
|
625
|
+
end
|
626
|
+
|
627
|
+
class Stream
|
628
|
+
shortstr :content_type
|
629
|
+
shortstr :content_encoding
|
630
|
+
table :headers
|
631
|
+
octet :priority
|
632
|
+
timestamp :timestamp
|
633
|
+
|
634
|
+
class Qos < Method( 10, :qos ); end
|
635
|
+
class QosOk < Method( 11, :qos_ok ); end
|
636
|
+
class Consume < Method( 20, :consume ); end
|
637
|
+
class ConsumeOk < Method( 21, :consume_ok ); end
|
638
|
+
class Cancel < Method( 30, :cancel ); end
|
639
|
+
class CancelOk < Method( 31, :cancel_ok ); end
|
640
|
+
class Publish < Method( 40, :publish ); end
|
641
|
+
class Return < Method( 50, :return ); end
|
642
|
+
class Deliver < Method( 60, :deliver ); end
|
643
|
+
|
644
|
+
class Qos
|
645
|
+
long :prefetch_size
|
646
|
+
short :prefetch_count
|
647
|
+
long :consume_rate
|
648
|
+
bit :global
|
649
|
+
end
|
650
|
+
|
651
|
+
class QosOk
|
652
|
+
end
|
653
|
+
|
654
|
+
class Consume
|
655
|
+
short :ticket
|
656
|
+
shortstr :queue
|
657
|
+
shortstr :consumer_tag
|
658
|
+
bit :no_local
|
659
|
+
bit :exclusive
|
660
|
+
bit :nowait
|
661
|
+
end
|
662
|
+
|
663
|
+
class ConsumeOk
|
664
|
+
shortstr :consumer_tag
|
665
|
+
end
|
666
|
+
|
667
|
+
class Cancel
|
668
|
+
shortstr :consumer_tag
|
669
|
+
bit :nowait
|
670
|
+
end
|
671
|
+
|
672
|
+
class CancelOk
|
673
|
+
shortstr :consumer_tag
|
674
|
+
end
|
675
|
+
|
676
|
+
class Publish
|
677
|
+
short :ticket
|
678
|
+
shortstr :exchange
|
679
|
+
shortstr :routing_key
|
680
|
+
bit :mandatory
|
681
|
+
bit :immediate
|
682
|
+
end
|
683
|
+
|
684
|
+
class Return
|
685
|
+
short :reply_code
|
686
|
+
shortstr :reply_text
|
687
|
+
shortstr :exchange
|
688
|
+
shortstr :routing_key
|
689
|
+
end
|
690
|
+
|
691
|
+
class Deliver
|
692
|
+
shortstr :consumer_tag
|
693
|
+
longlong :delivery_tag
|
694
|
+
shortstr :exchange
|
695
|
+
shortstr :queue
|
696
|
+
end
|
697
|
+
|
698
|
+
end
|
699
|
+
|
700
|
+
class Tx
|
701
|
+
|
702
|
+
class Select < Method( 10, :select ); end
|
703
|
+
class SelectOk < Method( 11, :select_ok ); end
|
704
|
+
class Commit < Method( 20, :commit ); end
|
705
|
+
class CommitOk < Method( 21, :commit_ok ); end
|
706
|
+
class Rollback < Method( 30, :rollback ); end
|
707
|
+
class RollbackOk < Method( 31, :rollback_ok ); end
|
708
|
+
|
709
|
+
class Select
|
710
|
+
end
|
711
|
+
|
712
|
+
class SelectOk
|
713
|
+
end
|
714
|
+
|
715
|
+
class Commit
|
716
|
+
end
|
717
|
+
|
718
|
+
class CommitOk
|
719
|
+
end
|
720
|
+
|
721
|
+
class Rollback
|
722
|
+
end
|
723
|
+
|
724
|
+
class RollbackOk
|
725
|
+
end
|
726
|
+
|
727
|
+
end
|
728
|
+
|
729
|
+
class Dtx
|
730
|
+
|
731
|
+
class Select < Method( 10, :select ); end
|
732
|
+
class SelectOk < Method( 11, :select_ok ); end
|
733
|
+
class Start < Method( 20, :start ); end
|
734
|
+
class StartOk < Method( 21, :start_ok ); end
|
735
|
+
|
736
|
+
class Select
|
737
|
+
end
|
738
|
+
|
739
|
+
class SelectOk
|
740
|
+
end
|
741
|
+
|
742
|
+
class Start
|
743
|
+
shortstr :dtx_identifier
|
744
|
+
end
|
745
|
+
|
746
|
+
class StartOk
|
747
|
+
end
|
748
|
+
|
749
|
+
end
|
750
|
+
|
751
|
+
class Tunnel
|
752
|
+
table :headers
|
753
|
+
shortstr :proxy_name
|
754
|
+
shortstr :data_name
|
755
|
+
octet :durable
|
756
|
+
octet :broadcast
|
757
|
+
|
758
|
+
class Request < Method( 10, :request ); end
|
759
|
+
|
760
|
+
class Request
|
761
|
+
table :meta_data
|
762
|
+
end
|
763
|
+
|
764
|
+
end
|
765
|
+
|
766
|
+
class Test
|
767
|
+
|
768
|
+
class Integer < Method( 10, :integer ); end
|
769
|
+
class IntegerOk < Method( 11, :integer_ok ); end
|
770
|
+
class String < Method( 20, :string ); end
|
771
|
+
class StringOk < Method( 21, :string_ok ); end
|
772
|
+
class Table < Method( 30, :table ); end
|
773
|
+
class TableOk < Method( 31, :table_ok ); end
|
774
|
+
class Content < Method( 40, :content ); end
|
775
|
+
class ContentOk < Method( 41, :content_ok ); end
|
776
|
+
|
777
|
+
class Integer
|
778
|
+
octet :integer_1
|
779
|
+
short :integer_2
|
780
|
+
long :integer_3
|
781
|
+
longlong :integer_4
|
782
|
+
octet :operation
|
783
|
+
end
|
784
|
+
|
785
|
+
class IntegerOk
|
786
|
+
longlong :result
|
787
|
+
end
|
788
|
+
|
789
|
+
class String
|
790
|
+
shortstr :string_1
|
791
|
+
longstr :string_2
|
792
|
+
octet :operation
|
793
|
+
end
|
794
|
+
|
795
|
+
class StringOk
|
796
|
+
longstr :result
|
797
|
+
end
|
798
|
+
|
799
|
+
class Table
|
800
|
+
table :table
|
801
|
+
octet :integer_op
|
802
|
+
octet :string_op
|
803
|
+
end
|
804
|
+
|
805
|
+
class TableOk
|
806
|
+
longlong :integer_result
|
807
|
+
longstr :string_result
|
808
|
+
end
|
809
|
+
|
810
|
+
class Content
|
811
|
+
end
|
812
|
+
|
813
|
+
class ContentOk
|
814
|
+
long :content_checksum
|
815
|
+
end
|
816
|
+
|
817
|
+
end
|
818
|
+
|
819
|
+
end
|
820
|
+
end
|