bunny 0.6.0 → 0.6.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/bunny.gemspec +3 -1
- data/lib/bunny.rb +2 -2
- data/lib/bunny/exchange08.rb +1 -1
- data/lib/bunny/exchange09.rb +4 -4
- data/lib/bunny/queue09.rb +8 -8
- data/lib/bunny/subscription09.rb +1 -1
- data/lib/qrack/client.rb +19 -4
- data/lib/qrack/protocol/spec08.rb +5 -3
- data/lib/qrack/protocol/spec09.rb +43 -43
- data/lib/qrack/transport/buffer08.rb +6 -6
- data/lib/qrack/transport/buffer09.rb +6 -6
- data/lib/qrack/transport/frame08.rb +43 -41
- data/lib/qrack/transport/frame09.rb +1 -1
- metadata +23 -9
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Bunny: A synchronous Ruby AMQP client
|
2
2
|
|
3
|
-
*GitHub* *repo*: http://github.com/
|
3
|
+
*GitHub* *repo*: http://github.com/ruby-amqp/bunny
|
4
4
|
|
5
5
|
*Rubyforge*: http://rubyforge.org/projects/bunny-amqp
|
6
6
|
|
@@ -22,7 +22,7 @@ You can use Bunny to -
|
|
22
22
|
* Create and delete queues
|
23
23
|
* Publish and consume messages
|
24
24
|
|
25
|
-
Bunny is known to work with RabbitMQ versions 1.5.4
|
25
|
+
Bunny is known to work with RabbitMQ versions 1.5.4 and above with version 0-8 of the AMQP specification.
|
26
26
|
|
27
27
|
=== INSTALL:
|
28
28
|
|
data/bunny.gemspec
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require File.expand_path("../lib/bunny/version", __FILE__)
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{bunny}
|
3
|
-
s.version =
|
5
|
+
s.version = Bunny::VERSION.dup
|
4
6
|
s.authors = ["Chris Duncan"]
|
5
7
|
s.date = %q{2009-10-05}
|
6
8
|
s.description = %q{Another synchronous Ruby AMQP client}
|
data/lib/bunny.rb
CHANGED
@@ -5,6 +5,8 @@ $:.unshift File.expand_path(File.dirname(__FILE__))
|
|
5
5
|
require file
|
6
6
|
end
|
7
7
|
|
8
|
+
require "bunny/version"
|
9
|
+
|
8
10
|
module Bunny
|
9
11
|
|
10
12
|
class ConnectionError < StandardError; end
|
@@ -16,8 +18,6 @@ module Bunny
|
|
16
18
|
class UnsubscribeError < StandardError; end
|
17
19
|
class AcknowledgementError < StandardError; end
|
18
20
|
|
19
|
-
VERSION = '0.6.0'
|
20
|
-
|
21
21
|
# Returns the Bunny version number
|
22
22
|
|
23
23
|
def self.version
|
data/lib/bunny/exchange08.rb
CHANGED
data/lib/bunny/exchange09.rb
CHANGED
@@ -60,7 +60,7 @@ specification that applies to your target broker/server.
|
|
60
60
|
client.send_frame(
|
61
61
|
Qrack::Protocol09::Exchange::Declare.new(
|
62
62
|
{ :exchange => name, :type => type, :nowait => false,
|
63
|
-
:
|
63
|
+
:deprecated_ticket => 0, :deprecated_auto_delete => false, :deprecated_internal => false }.merge(opts)
|
64
64
|
)
|
65
65
|
)
|
66
66
|
|
@@ -97,7 +97,7 @@ if successful. If an error occurs raises _Bunny_::_ProtocolError_.
|
|
97
97
|
opts.delete(:nowait)
|
98
98
|
|
99
99
|
client.send_frame(
|
100
|
-
Qrack::Protocol09::Exchange::Delete.new({ :exchange => name, :nowait => false, :
|
100
|
+
Qrack::Protocol09::Exchange::Delete.new({ :exchange => name, :nowait => false, :deprecated_ticket => 0 }.merge(opts))
|
101
101
|
)
|
102
102
|
|
103
103
|
method = client.next_method
|
@@ -156,12 +156,12 @@ nil
|
|
156
156
|
:routing_key => routing_key,
|
157
157
|
:mandatory => mandatory,
|
158
158
|
:immediate => immediate,
|
159
|
-
:
|
159
|
+
:deprecated_ticket => 0 }
|
160
160
|
)
|
161
161
|
data = data.to_s
|
162
162
|
out << Qrack::Protocol09::Header.new(
|
163
163
|
Qrack::Protocol09::Basic,
|
164
|
-
data.
|
164
|
+
data.bytesize, {
|
165
165
|
:content_type => 'application/octet-stream',
|
166
166
|
:delivery_mode => delivery_mode,
|
167
167
|
:priority => 0
|
data/lib/bunny/queue09.rb
CHANGED
@@ -27,7 +27,7 @@ Queues must be attached to at least one exchange in order to receive messages fr
|
|
27
27
|
:durable => false,
|
28
28
|
:exclusive => true,
|
29
29
|
:auto_delete => true,
|
30
|
-
:
|
30
|
+
:deprecated_ticket => 0
|
31
31
|
}.merge(opts)
|
32
32
|
end
|
33
33
|
|
@@ -36,7 +36,7 @@ Queues must be attached to at least one exchange in order to receive messages fr
|
|
36
36
|
opts.delete(:nowait)
|
37
37
|
|
38
38
|
client.send_frame(
|
39
|
-
Qrack::Protocol09::Queue::Declare.new({ :queue => name || '', :nowait => false, :
|
39
|
+
Qrack::Protocol09::Queue::Declare.new({ :queue => name || '', :nowait => false, :deprecated_ticket => 0 }.merge(opts))
|
40
40
|
)
|
41
41
|
|
42
42
|
method = client.next_method
|
@@ -109,7 +109,7 @@ bound to the direct exchange '' by default. If error occurs, a _Bunny_::_Protoco
|
|
109
109
|
:exchange => exchange,
|
110
110
|
:routing_key => opts.delete(:key),
|
111
111
|
:nowait => false,
|
112
|
-
:
|
112
|
+
:deprecated_ticket => 0 }.merge(opts))
|
113
113
|
)
|
114
114
|
|
115
115
|
method = client.next_method
|
@@ -150,7 +150,7 @@ from queues if successful. If an error occurs raises _Bunny_::_ProtocolError_.
|
|
150
150
|
opts.delete(:nowait)
|
151
151
|
|
152
152
|
client.send_frame(
|
153
|
-
Qrack::Protocol09::Queue::Delete.new({ :queue => name, :nowait => false, :
|
153
|
+
Qrack::Protocol09::Queue::Delete.new({ :queue => name, :nowait => false, :deprecated_ticket => 0 }.merge(opts))
|
154
154
|
)
|
155
155
|
|
156
156
|
method = client.next_method
|
@@ -202,7 +202,7 @@ will be nil.
|
|
202
202
|
:consumer_tag => name,
|
203
203
|
:no_ack => !ack,
|
204
204
|
:nowait => true,
|
205
|
-
:
|
205
|
+
:deprecated_ticket => 0 }.merge(opts))
|
206
206
|
)
|
207
207
|
|
208
208
|
method = client.next_method
|
@@ -259,7 +259,7 @@ without any formal "undo" mechanism. If an error occurs raises _Bunny_::_Protoco
|
|
259
259
|
opts.delete(:nowait)
|
260
260
|
|
261
261
|
client.send_frame(
|
262
|
-
Qrack::Protocol09::Queue::Purge.new({ :queue => name, :nowait => false, :
|
262
|
+
Qrack::Protocol09::Queue::Purge.new({ :queue => name, :nowait => false, :deprecated_ticket => 0 }.merge(opts))
|
263
263
|
)
|
264
264
|
|
265
265
|
method = client.next_method
|
@@ -281,7 +281,7 @@ Returns hash {:message_count, :consumer_count}.
|
|
281
281
|
|
282
282
|
def status
|
283
283
|
client.send_frame(
|
284
|
-
Qrack::Protocol09::Queue::Declare.new({ :queue => name, :passive => true, :
|
284
|
+
Qrack::Protocol09::Queue::Declare.new({ :queue => name, :passive => true, :deprecated_ticket => 0 })
|
285
285
|
)
|
286
286
|
method = client.next_method
|
287
287
|
{:message_count => method.message_count, :consumer_count => method.consumer_count}
|
@@ -325,7 +325,7 @@ Removes a queue binding from an exchange. If error occurs, a _Bunny_::_ProtocolE
|
|
325
325
|
:exchange => exchange,
|
326
326
|
:routing_key => opts.delete(:key),
|
327
327
|
:nowait => false,
|
328
|
-
:
|
328
|
+
:deprecated_ticket => 0 }.merge(opts)
|
329
329
|
)
|
330
330
|
)
|
331
331
|
|
data/lib/bunny/subscription09.rb
CHANGED
@@ -63,7 +63,7 @@ my_queue.subscribe(:message_max => 10, :ack => true) {|msg| puts msg[:payload]}
|
|
63
63
|
|
64
64
|
def setup_consumer
|
65
65
|
client.send_frame(
|
66
|
-
Qrack::Protocol09::Basic::Consume.new({ :
|
66
|
+
Qrack::Protocol09::Basic::Consume.new({ :deprecated_ticket => 0,
|
67
67
|
:queue => queue.name,
|
68
68
|
:consumer_tag => consumer_tag,
|
69
69
|
:no_ack => !ack,
|
data/lib/qrack/client.rb
CHANGED
@@ -61,9 +61,15 @@ _Bunny_::_ProtocolError_ is raised. If successful, _Client_._status_ is set to <
|
|
61
61
|
# Close connection to AMQP server
|
62
62
|
close_connection
|
63
63
|
|
64
|
+
# Clear the channels
|
65
|
+
@channels = []
|
66
|
+
|
67
|
+
# Create channel 0
|
68
|
+
@channel = create_channel()
|
69
|
+
|
64
70
|
# Close TCP Socket
|
65
|
-
|
66
|
-
|
71
|
+
close_socket
|
72
|
+
end
|
67
73
|
|
68
74
|
alias stop close
|
69
75
|
|
@@ -87,7 +93,13 @@ _Bunny_::_ProtocolError_ is raised. If successful, _Client_._status_ is set to <
|
|
87
93
|
alias next_method next_payload
|
88
94
|
|
89
95
|
def read(*args)
|
90
|
-
|
96
|
+
begin
|
97
|
+
send_command(:read, *args)
|
98
|
+
# Got a SIGINT while waiting; give any traps a chance to run
|
99
|
+
rescue Errno::EINTR
|
100
|
+
retry
|
101
|
+
end
|
102
|
+
|
91
103
|
end
|
92
104
|
|
93
105
|
=begin rdoc
|
@@ -166,6 +178,9 @@ a hash <tt>{:reply_code, :reply_text, :exchange, :routing_key}</tt>.
|
|
166
178
|
raise Bunny::ConnectionError, 'No connection - socket has not been created' if !@socket
|
167
179
|
@socket.__send__(cmd, *args)
|
168
180
|
rescue Errno::EPIPE, IOError => e
|
181
|
+
# Ensure we close the socket when we are down to prevent further
|
182
|
+
# attempts to write to a closed socket
|
183
|
+
close_socket
|
169
184
|
raise Bunny::ServerDownError, e.message
|
170
185
|
end
|
171
186
|
end
|
@@ -179,7 +194,7 @@ a hash <tt>{:reply_code, :reply_text, :exchange, :routing_key}</tt>.
|
|
179
194
|
TCPSocket.new(host, port)
|
180
195
|
end
|
181
196
|
|
182
|
-
if Socket.constants.include?
|
197
|
+
if Socket.constants.include?('TCP_NODELAY') || Socket.constants.include?(:TCP_NODELAY)
|
183
198
|
@socket.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1
|
184
199
|
end
|
185
200
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
#:stopdoc:
|
3
|
-
# this file was autogenerated on
|
4
|
-
# using amqp-0.8.
|
3
|
+
# this file was autogenerated on 2009-12-13 13:40:20 +0000
|
4
|
+
# using amqp-0.8.json (mtime: 2009-12-13 13:34:07 +0000)
|
5
5
|
#
|
6
6
|
# DO NOT EDIT! (edit ext/qparser.rb and config.yml instead, and run 'ruby qparser.rb')
|
7
7
|
|
@@ -12,17 +12,19 @@ module Qrack
|
|
12
12
|
VERSION_MINOR = 0
|
13
13
|
REVISION = 0
|
14
14
|
PORT = 5672
|
15
|
-
SSL_PORT = 5671
|
16
15
|
|
17
16
|
RESPONSES = {
|
18
17
|
200 => :REPLY_SUCCESS,
|
19
18
|
310 => :NOT_DELIVERED,
|
20
19
|
311 => :CONTENT_TOO_LARGE,
|
20
|
+
312 => :NO_ROUTE,
|
21
|
+
313 => :NO_CONSUMERS,
|
21
22
|
320 => :CONNECTION_FORCED,
|
22
23
|
402 => :INVALID_PATH,
|
23
24
|
403 => :ACCESS_REFUSED,
|
24
25
|
404 => :NOT_FOUND,
|
25
26
|
405 => :RESOURCE_LOCKED,
|
27
|
+
406 => :PRECONDITION_FAILED,
|
26
28
|
502 => :SYNTAX_ERROR,
|
27
29
|
503 => :COMMAND_INVALID,
|
28
30
|
504 => :CHANNEL_ERROR,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
#:stopdoc:
|
3
|
-
# this file was autogenerated on
|
4
|
-
# using amqp-0.9.1.
|
3
|
+
# this file was autogenerated on 2009-12-13 13:38:22 +0000
|
4
|
+
# using amqp-0.9.1.json (mtime: 2009-12-13 13:34:07 +0000)
|
5
5
|
#
|
6
6
|
# DO NOT EDIT! (edit ext/qparser.rb and config.yml instead, and run 'ruby qparser.rb')
|
7
7
|
|
@@ -12,11 +12,11 @@ module Qrack
|
|
12
12
|
VERSION_MINOR = 9
|
13
13
|
REVISION = 1
|
14
14
|
PORT = 5672
|
15
|
-
SSL_PORT = 5671
|
16
15
|
|
17
16
|
RESPONSES = {
|
18
17
|
200 => :REPLY_SUCCESS,
|
19
18
|
311 => :CONTENT_TOO_LARGE,
|
19
|
+
312 => :NO_ROUTE,
|
20
20
|
313 => :NO_CONSUMERS,
|
21
21
|
320 => :CONNECTION_FORCED,
|
22
22
|
402 => :INVALID_PATH,
|
@@ -183,12 +183,12 @@ module Qrack
|
|
183
183
|
|
184
184
|
class Open
|
185
185
|
shortstr :virtual_host
|
186
|
-
shortstr :
|
187
|
-
bit :
|
186
|
+
shortstr :deprecated_capabilities
|
187
|
+
bit :deprecated_insist
|
188
188
|
end
|
189
189
|
|
190
190
|
class OpenOk
|
191
|
-
shortstr :
|
191
|
+
shortstr :deprecated_known_hosts
|
192
192
|
end
|
193
193
|
|
194
194
|
class Close
|
@@ -214,11 +214,11 @@ module Qrack
|
|
214
214
|
|
215
215
|
|
216
216
|
class Open
|
217
|
-
shortstr :
|
217
|
+
shortstr :deprecated_out_of_band
|
218
218
|
end
|
219
219
|
|
220
220
|
class OpenOk
|
221
|
-
longstr :
|
221
|
+
longstr :deprecated_channel_id
|
222
222
|
end
|
223
223
|
|
224
224
|
class Flow
|
@@ -250,14 +250,14 @@ module Qrack
|
|
250
250
|
|
251
251
|
|
252
252
|
class Declare
|
253
|
-
short :
|
253
|
+
short :deprecated_ticket
|
254
254
|
shortstr :exchange
|
255
255
|
shortstr :type
|
256
256
|
bit :passive
|
257
257
|
bit :durable
|
258
|
-
bit :
|
259
|
-
bit :
|
260
|
-
bit :
|
258
|
+
bit :deprecated_auto_delete
|
259
|
+
bit :deprecated_internal
|
260
|
+
bit :nowait
|
261
261
|
table :arguments
|
262
262
|
end
|
263
263
|
|
@@ -265,10 +265,10 @@ module Qrack
|
|
265
265
|
end
|
266
266
|
|
267
267
|
class Delete
|
268
|
-
short :
|
268
|
+
short :deprecated_ticket
|
269
269
|
shortstr :exchange
|
270
270
|
bit :if_unused
|
271
|
-
bit :
|
271
|
+
bit :nowait
|
272
272
|
end
|
273
273
|
|
274
274
|
class DeleteOk
|
@@ -282,22 +282,22 @@ module Qrack
|
|
282
282
|
class DeclareOk < Method( 11, :declare_ok ); end
|
283
283
|
class Bind < Method( 20, :bind ); end
|
284
284
|
class BindOk < Method( 21, :bind_ok ); end
|
285
|
-
class Unbind < Method( 50, :unbind ); end
|
286
|
-
class UnbindOk < Method( 51, :unbind_ok ); end
|
287
285
|
class Purge < Method( 30, :purge ); end
|
288
286
|
class PurgeOk < Method( 31, :purge_ok ); end
|
289
287
|
class Delete < Method( 40, :delete ); end
|
290
288
|
class DeleteOk < Method( 41, :delete_ok ); end
|
289
|
+
class Unbind < Method( 50, :unbind ); end
|
290
|
+
class UnbindOk < Method( 51, :unbind_ok ); end
|
291
291
|
|
292
292
|
|
293
293
|
class Declare
|
294
|
-
short :
|
294
|
+
short :deprecated_ticket
|
295
295
|
shortstr :queue
|
296
296
|
bit :passive
|
297
297
|
bit :durable
|
298
298
|
bit :exclusive
|
299
299
|
bit :auto_delete
|
300
|
-
bit :
|
300
|
+
bit :nowait
|
301
301
|
table :arguments
|
302
302
|
end
|
303
303
|
|
@@ -308,32 +308,21 @@ module Qrack
|
|
308
308
|
end
|
309
309
|
|
310
310
|
class Bind
|
311
|
-
short :
|
311
|
+
short :deprecated_ticket
|
312
312
|
shortstr :queue
|
313
313
|
shortstr :exchange
|
314
314
|
shortstr :routing_key
|
315
|
-
bit :
|
315
|
+
bit :nowait
|
316
316
|
table :arguments
|
317
317
|
end
|
318
318
|
|
319
319
|
class BindOk
|
320
320
|
end
|
321
321
|
|
322
|
-
class Unbind
|
323
|
-
short :reserved_1
|
324
|
-
shortstr :queue
|
325
|
-
shortstr :exchange
|
326
|
-
shortstr :routing_key
|
327
|
-
table :arguments
|
328
|
-
end
|
329
|
-
|
330
|
-
class UnbindOk
|
331
|
-
end
|
332
|
-
|
333
322
|
class Purge
|
334
|
-
short :
|
323
|
+
short :deprecated_ticket
|
335
324
|
shortstr :queue
|
336
|
-
bit :
|
325
|
+
bit :nowait
|
337
326
|
end
|
338
327
|
|
339
328
|
class PurgeOk
|
@@ -341,17 +330,28 @@ module Qrack
|
|
341
330
|
end
|
342
331
|
|
343
332
|
class Delete
|
344
|
-
short :
|
333
|
+
short :deprecated_ticket
|
345
334
|
shortstr :queue
|
346
335
|
bit :if_unused
|
347
336
|
bit :if_empty
|
348
|
-
bit :
|
337
|
+
bit :nowait
|
349
338
|
end
|
350
339
|
|
351
340
|
class DeleteOk
|
352
341
|
long :message_count
|
353
342
|
end
|
354
343
|
|
344
|
+
class Unbind
|
345
|
+
short :deprecated_ticket
|
346
|
+
shortstr :queue
|
347
|
+
shortstr :exchange
|
348
|
+
shortstr :routing_key
|
349
|
+
table :arguments
|
350
|
+
end
|
351
|
+
|
352
|
+
class UnbindOk
|
353
|
+
end
|
354
|
+
|
355
355
|
end
|
356
356
|
|
357
357
|
class Basic
|
@@ -368,7 +368,7 @@ module Qrack
|
|
368
368
|
shortstr :type
|
369
369
|
shortstr :user_id
|
370
370
|
shortstr :app_id
|
371
|
-
shortstr :
|
371
|
+
shortstr :deprecated_cluster_id
|
372
372
|
|
373
373
|
class Qos < Method( 10, :qos ); end
|
374
374
|
class QosOk < Method( 11, :qos_ok ); end
|
@@ -399,14 +399,14 @@ module Qrack
|
|
399
399
|
end
|
400
400
|
|
401
401
|
class Consume
|
402
|
-
short :
|
402
|
+
short :deprecated_ticket
|
403
403
|
shortstr :queue
|
404
404
|
shortstr :consumer_tag
|
405
405
|
bit :no_local
|
406
406
|
bit :no_ack
|
407
407
|
bit :exclusive
|
408
|
-
bit :
|
409
|
-
table :
|
408
|
+
bit :nowait
|
409
|
+
table :filter
|
410
410
|
end
|
411
411
|
|
412
412
|
class ConsumeOk
|
@@ -415,7 +415,7 @@ module Qrack
|
|
415
415
|
|
416
416
|
class Cancel
|
417
417
|
shortstr :consumer_tag
|
418
|
-
bit :
|
418
|
+
bit :nowait
|
419
419
|
end
|
420
420
|
|
421
421
|
class CancelOk
|
@@ -423,7 +423,7 @@ module Qrack
|
|
423
423
|
end
|
424
424
|
|
425
425
|
class Publish
|
426
|
-
short :
|
426
|
+
short :deprecated_ticket
|
427
427
|
shortstr :exchange
|
428
428
|
shortstr :routing_key
|
429
429
|
bit :mandatory
|
@@ -446,7 +446,7 @@ module Qrack
|
|
446
446
|
end
|
447
447
|
|
448
448
|
class Get
|
449
|
-
short :
|
449
|
+
short :deprecated_ticket
|
450
450
|
shortstr :queue
|
451
451
|
bit :no_ack
|
452
452
|
end
|
@@ -460,7 +460,7 @@ module Qrack
|
|
460
460
|
end
|
461
461
|
|
462
462
|
class GetEmpty
|
463
|
-
shortstr :
|
463
|
+
shortstr :deprecated_cluster_id
|
464
464
|
end
|
465
465
|
|
466
466
|
class Ack
|
@@ -31,7 +31,7 @@ module Qrack
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def length
|
34
|
-
@data.
|
34
|
+
@data.bytesize
|
35
35
|
end
|
36
36
|
|
37
37
|
def empty?
|
@@ -154,13 +154,13 @@ module Qrack
|
|
154
154
|
_write([upper, lower], 'NN')
|
155
155
|
when :shortstr
|
156
156
|
data = (data || '').to_s
|
157
|
-
_write([data.
|
157
|
+
_write([data.bytesize, data], 'Ca*')
|
158
158
|
when :longstr
|
159
159
|
if data.is_a? Hash
|
160
160
|
write(:table, data)
|
161
161
|
else
|
162
162
|
data = (data || '').to_s
|
163
|
-
_write([data.
|
163
|
+
_write([data.bytesize, data], 'Na*')
|
164
164
|
end
|
165
165
|
when :timestamp
|
166
166
|
write(:longlong, data.to_i)
|
@@ -179,7 +179,7 @@ module Qrack
|
|
179
179
|
when Float
|
180
180
|
table.write(:octet, 68) # 'D'
|
181
181
|
# XXX there's gotta be a better way to do this..
|
182
|
-
exp = value.to_s.split('.').last.
|
182
|
+
exp = value.to_s.split('.').last.bytesize
|
183
183
|
num = value * 10**exp
|
184
184
|
table.write(:octet, exp)
|
185
185
|
table.write(:long, num)
|
@@ -269,8 +269,8 @@ module Qrack
|
|
269
269
|
def _write data, pack = nil
|
270
270
|
data = [*data].pack(pack) if pack
|
271
271
|
@data[@pos,0] = data
|
272
|
-
@pos += data.
|
272
|
+
@pos += data.bytesize
|
273
273
|
end
|
274
274
|
end
|
275
275
|
end
|
276
|
-
end
|
276
|
+
end
|
@@ -31,7 +31,7 @@ module Qrack
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def length
|
34
|
-
@data.
|
34
|
+
@data.bytesize
|
35
35
|
end
|
36
36
|
|
37
37
|
def empty?
|
@@ -154,13 +154,13 @@ module Qrack
|
|
154
154
|
_write([upper, lower], 'NN')
|
155
155
|
when :shortstr
|
156
156
|
data = (data || '').to_s
|
157
|
-
_write([data.
|
157
|
+
_write([data.bytesize, data], 'Ca*')
|
158
158
|
when :longstr
|
159
159
|
if data.is_a? Hash
|
160
160
|
write(:table, data)
|
161
161
|
else
|
162
162
|
data = (data || '').to_s
|
163
|
-
_write([data.
|
163
|
+
_write([data.bytesize, data], 'Na*')
|
164
164
|
end
|
165
165
|
when :timestamp
|
166
166
|
write(:longlong, data.to_i)
|
@@ -179,7 +179,7 @@ module Qrack
|
|
179
179
|
when Float
|
180
180
|
table.write(:octet, 68) # 'D'
|
181
181
|
# XXX there's gotta be a better way to do this..
|
182
|
-
exp = value.to_s.split('.').last.
|
182
|
+
exp = value.to_s.split('.').last.bytesize
|
183
183
|
num = value * 10**exp
|
184
184
|
table.write(:octet, exp)
|
185
185
|
table.write(:long, num)
|
@@ -269,8 +269,8 @@ module Qrack
|
|
269
269
|
def _write data, pack = nil
|
270
270
|
data = [*data].pack(pack) if pack
|
271
271
|
@data[@pos,0] = data
|
272
|
-
@pos += data.
|
272
|
+
@pos += data.bytesize
|
273
273
|
end
|
274
274
|
end
|
275
275
|
end
|
276
|
-
end
|
276
|
+
end
|
@@ -1,24 +1,26 @@
|
|
1
1
|
|
2
2
|
#:stopdoc:
|
3
|
-
# this file was autogenerated on
|
3
|
+
# this file was autogenerated on 2009-12-13 13:40:20 +0000
|
4
4
|
#
|
5
5
|
# DO NOT EDIT! (edit ext/qparser.rb and config.yml instead, and run 'ruby qparser.rb')
|
6
6
|
|
7
7
|
module Qrack
|
8
8
|
module Transport
|
9
9
|
class Frame
|
10
|
-
|
10
|
+
|
11
11
|
FOOTER = 206
|
12
|
-
|
12
|
+
ID = 0
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
@types = {
|
15
|
+
1 => 'Method',
|
16
|
+
2 => 'Header',
|
17
|
+
3 => 'Body',
|
18
|
+
4 => 'OobMethod',
|
19
|
+
5 => 'OobHeader',
|
20
|
+
6 => 'OobBody',
|
21
|
+
7 => 'Trace',
|
22
|
+
8 => 'Heartbeat',
|
23
|
+
}
|
22
24
|
|
23
25
|
attr_accessor :channel, :payload
|
24
26
|
|
@@ -26,10 +28,10 @@ module Qrack
|
|
26
28
|
@channel, @payload = channel, payload
|
27
29
|
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def id
|
32
|
+
self.class::ID
|
33
|
+
end
|
34
|
+
|
33
35
|
def to_binary
|
34
36
|
buf = Transport::Buffer.new
|
35
37
|
buf.write :octet, id
|
@@ -50,7 +52,7 @@ module Qrack
|
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
|
-
|
55
|
+
def self.parse buf
|
54
56
|
buf = Transport::Buffer.new(buf) unless buf.is_a? Transport::Buffer
|
55
57
|
buf.extract do
|
56
58
|
id, channel, payload, footer = buf.read(:octet, :short, :longstr, :octet)
|
@@ -62,8 +64,8 @@ module Qrack
|
|
62
64
|
|
63
65
|
class Method < Frame
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
ID = 1
|
68
|
+
|
67
69
|
def initialize payload = nil, channel = 0
|
68
70
|
super
|
69
71
|
unless @payload.is_a? Protocol::Class::Method or @payload.nil?
|
@@ -73,9 +75,9 @@ module Qrack
|
|
73
75
|
end
|
74
76
|
|
75
77
|
class Header < Frame
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
|
79
|
+
ID = 2
|
80
|
+
|
79
81
|
def initialize payload = nil, channel = 0
|
80
82
|
super
|
81
83
|
unless @payload.is_a? Protocol::Header or @payload.nil?
|
@@ -84,29 +86,29 @@ module Qrack
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
class Body < Frame
|
90
|
+
ID = 3
|
91
|
+
end
|
92
|
+
|
93
|
+
class OobMethod < Frame
|
94
|
+
ID = 4
|
95
|
+
end
|
96
|
+
|
95
97
|
class OobHeader < Frame
|
96
|
-
|
97
|
-
|
98
|
-
|
98
|
+
ID = 5
|
99
|
+
end
|
100
|
+
|
99
101
|
class OobBody < Frame
|
100
|
-
|
101
|
-
|
102
|
-
|
102
|
+
ID = 6
|
103
|
+
end
|
104
|
+
|
103
105
|
class Trace < Frame
|
104
|
-
|
105
|
-
|
106
|
-
|
106
|
+
ID = 7
|
107
|
+
end
|
108
|
+
|
107
109
|
class Heartbeat < Frame
|
108
|
-
|
109
|
-
|
110
|
+
ID = 8
|
111
|
+
end
|
110
112
|
|
111
113
|
end
|
112
|
-
end
|
114
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 15424111
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 3
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 0.6.3.rc1
|
5
13
|
platform: ruby
|
6
14
|
authors:
|
7
15
|
- Chris Duncan
|
@@ -9,8 +17,7 @@ autorequire:
|
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
19
|
|
12
|
-
date: 2009-10-05 00:00:00
|
13
|
-
default_executable:
|
20
|
+
date: 2009-10-05 00:00:00 Z
|
14
21
|
dependencies: []
|
15
22
|
|
16
23
|
description: Another synchronous Ruby AMQP client
|
@@ -73,7 +80,6 @@ files:
|
|
73
80
|
- spec/spec_09/exchange_spec.rb
|
74
81
|
- spec/spec_09/queue_spec.rb
|
75
82
|
- spec/spec_09/connection_spec.rb
|
76
|
-
has_rdoc: true
|
77
83
|
homepage: http://github.com/celldee/bunny/tree/master
|
78
84
|
licenses: []
|
79
85
|
|
@@ -84,21 +90,29 @@ rdoc_options:
|
|
84
90
|
require_paths:
|
85
91
|
- lib
|
86
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
87
94
|
requirements:
|
88
95
|
- - ">="
|
89
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
90
100
|
version: "0"
|
91
|
-
version:
|
92
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
93
103
|
requirements:
|
94
|
-
- - "
|
104
|
+
- - ">"
|
95
105
|
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
|
106
|
+
hash: 25
|
107
|
+
segments:
|
108
|
+
- 1
|
109
|
+
- 3
|
110
|
+
- 1
|
111
|
+
version: 1.3.1
|
98
112
|
requirements: []
|
99
113
|
|
100
114
|
rubyforge_project: bunny-amqp
|
101
|
-
rubygems_version: 1.
|
115
|
+
rubygems_version: 1.8.5
|
102
116
|
signing_key:
|
103
117
|
specification_version: 3
|
104
118
|
summary: A synchronous Ruby AMQP client that enables interaction with AMQP-compliant brokers/servers.
|