amqp 0.9.10 → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -3
- data/CHANGELOG +4 -0
- data/Gemfile +1 -0
- data/README.md +72 -81
- data/amqp.gemspec +14 -5
- data/docs/08Migration.textile +0 -4
- data/docs/AMQP091ModelExplained.textile +0 -5
- data/docs/Bindings.textile +0 -4
- data/docs/Clustering.textile +0 -4
- data/docs/ConnectingToTheBroker.textile +1 -5
- data/docs/ConnectionEncryptionWithTLS.textile +0 -4
- data/docs/DocumentationGuidesIndex.textile +0 -4
- data/docs/Durability.textile +0 -4
- data/docs/ErrorHandling.textile +40 -106
- data/docs/Exchanges.textile +0 -4
- data/docs/GettingStarted.textile +6 -10
- data/docs/PatternsAndUseCases.textile +1 -4
- data/docs/Queues.textile +0 -4
- data/docs/RabbitMQVersions.textile +0 -4
- data/docs/RunningTests.textile +0 -4
- data/docs/TestingWithEventedSpec.textile +0 -4
- data/docs/Troubleshooting.textile +0 -4
- data/docs/VendorSpecificExtensions.textile +0 -4
- data/examples/error_handling/hello_world_producer.rb +1 -1
- data/examples/issues/issue_121.rb +23 -0
- data/examples/patterns/request_reply/client.rb +2 -1
- data/examples/patterns/request_reply/server.rb +1 -0
- data/examples/publishing/returned_messages.rb +1 -1
- data/lib/amqp.rb +0 -7
- data/lib/amqp/channel.rb +15 -33
- data/lib/amqp/client.rb +2 -2
- data/lib/amqp/compatibility/ruby187_patchlevel_check.rb +4 -4
- data/lib/amqp/connection.rb +0 -1
- data/lib/amqp/consumer.rb +2 -2
- data/lib/amqp/exceptions.rb +1 -10
- data/lib/amqp/exchange.rb +5 -5
- data/lib/amqp/queue.rb +23 -47
- data/lib/amqp/session.rb +4 -4
- data/lib/amqp/version.rb +1 -1
- data/spec/integration/basic_get_spec.rb +24 -80
- data/spec/integration/basic_return_spec.rb +3 -3
- data/spec/integration/channel_level_exception_with_multiple_channels_spec.rb +1 -0
- data/spec/integration/exchange_declaration_spec.rb +102 -71
- data/spec/integration/extensions/rabbitmq/publisher_confirmations_spec.rb +17 -1
- data/spec/integration/fanout_exchange_routing_spec.rb +1 -1
- data/spec/integration/immediate_messages_spec.rb +59 -0
- data/spec/integration/multiple_consumers_per_queue_spec.rb +101 -39
- data/spec/integration/queue_redeclaration_with_incompatible_attributes_spec.rb +12 -25
- data/spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb +1 -1
- data/spec/integration/reply_queue_communication_spec.rb +2 -1
- data/spec/integration/store_and_forward_spec.rb +9 -6
- data/spec/integration/topic_subscription_spec.rb +4 -5
- data/spec/spec_helper.rb +2 -8
- data/spec/unit/amqp/connection_spec.rb +1 -3
- metadata +112 -116
- data/examples/deprecated/default_thread_local_channel_instance.rb +0 -34
- data/examples/legacy/ack.rb +0 -70
- data/examples/legacy/callbacks.rb +0 -45
- data/examples/legacy/clock.rb +0 -74
- data/examples/legacy/hashtable.rb +0 -60
- data/examples/legacy/logger.rb +0 -92
- data/examples/legacy/multiclock.rb +0 -56
- data/examples/legacy/pingpong.rb +0 -51
- data/examples/legacy/primes-simple.rb +0 -29
- data/examples/legacy/primes.rb +0 -74
- data/examples/legacy/stocks.rb +0 -59
- data/lib/amqp/deprecated/fork.rb +0 -17
- data/lib/amqp/deprecated/logger.rb +0 -100
- data/lib/amqp/deprecated/mq.rb +0 -22
- data/lib/amqp/deprecated/rpc.rb +0 -169
- data/lib/amqp/ext/em.rb +0 -3
- data/lib/amqp/ext/emfork.rb +0 -72
- data/lib/amqp/logger.rb +0 -19
- data/lib/amqp/rpc.rb +0 -20
- data/lib/mq.rb +0 -35
- data/lib/mq/logger.rb +0 -4
- data/lib/mq/rpc.rb +0 -4
- data/spec/integration/remove_individual_binding_spec.rb +0 -51
metadata
CHANGED
@@ -1,101 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 2787483469
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- pre
|
11
|
+
- 1
|
12
|
+
version: 1.0.0.pre1
|
6
13
|
platform: ruby
|
7
|
-
authors:
|
14
|
+
authors:
|
8
15
|
- Aman Gupta
|
9
16
|
- Jakub Stastny aka botanicus
|
10
17
|
- Michael S. Klishin
|
11
|
-
autorequire:
|
18
|
+
autorequire:
|
12
19
|
bindir: bin
|
13
20
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
21
|
+
|
22
|
+
date: 2012-06-22 00:00:00 Z
|
23
|
+
dependencies:
|
24
|
+
- !ruby/object:Gem::Dependency
|
17
25
|
name: eventmachine
|
18
|
-
|
19
|
-
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: !binary |-
|
23
|
-
MA==
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
28
|
none: false
|
25
|
-
|
26
|
-
requirements:
|
29
|
+
requirements:
|
27
30
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
hash: 3
|
33
|
+
segments:
|
34
|
+
- 0
|
35
|
+
version: "0"
|
33
36
|
type: :runtime
|
34
|
-
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
35
39
|
name: amq-client
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.12
|
41
|
-
none: false
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.9.12
|
47
|
-
none: false
|
48
40
|
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 2787483469
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 0
|
50
|
+
- 0
|
51
|
+
- pre
|
52
|
+
- 1
|
53
|
+
version: 1.0.0.pre1
|
49
54
|
type: :runtime
|
50
|
-
|
55
|
+
version_requirements: *id002
|
56
|
+
- !ruby/object:Gem::Dependency
|
51
57
|
name: amq-protocol
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 1.2.0
|
57
|
-
none: false
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 1.2.0
|
63
|
-
none: false
|
64
58
|
prerelease: false
|
59
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ~>
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 2787483469
|
65
|
+
segments:
|
66
|
+
- 1
|
67
|
+
- 0
|
68
|
+
- 0
|
69
|
+
- pre
|
70
|
+
- 1
|
71
|
+
version: 1.0.0.pre1
|
65
72
|
type: :runtime
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
-
|
71
|
-
c3Rhc3RueUAxMDFpZGVhcy5jeg==
|
73
|
+
version_requirements: *id003
|
74
|
+
description: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included.
|
75
|
+
email:
|
76
|
+
- michael@novemberain.com
|
77
|
+
- stastny@101ideas.cz
|
72
78
|
executables: []
|
79
|
+
|
73
80
|
extensions: []
|
74
|
-
|
81
|
+
|
82
|
+
extra_rdoc_files:
|
75
83
|
- README.md
|
76
|
-
- docs/08Migration.textile
|
77
|
-
- docs/AMQP091ModelExplained.textile
|
78
|
-
- docs/Bindings.textile
|
79
|
-
- docs/Clustering.textile
|
80
|
-
- docs/ConnectingToTheBroker.textile
|
81
|
-
- docs/ConnectionEncryptionWithTLS.textile
|
82
|
-
- docs/DocumentationGuidesIndex.textile
|
83
84
|
- docs/Durability.textile
|
84
|
-
- docs/ErrorHandling.textile
|
85
85
|
- docs/Exchanges.textile
|
86
|
-
- docs/GettingStarted.textile
|
87
86
|
- docs/PatternsAndUseCases.textile
|
88
|
-
- docs/
|
89
|
-
- docs/
|
87
|
+
- docs/ConnectingToTheBroker.textile
|
88
|
+
- docs/ConnectionEncryptionWithTLS.textile
|
90
89
|
- docs/RunningTests.textile
|
91
|
-
- docs/
|
90
|
+
- docs/DocumentationGuidesIndex.textile
|
92
91
|
- docs/Troubleshooting.textile
|
92
|
+
- docs/RabbitMQVersions.textile
|
93
|
+
- docs/Queues.textile
|
94
|
+
- docs/08Migration.textile
|
93
95
|
- docs/VendorSpecificExtensions.textile
|
94
|
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
96
|
+
- docs/AMQP091ModelExplained.textile
|
97
|
+
- docs/Bindings.textile
|
98
|
+
- docs/GettingStarted.textile
|
99
|
+
- docs/ErrorHandling.textile
|
100
|
+
- docs/Clustering.textile
|
101
|
+
- docs/TestingWithEventedSpec.textile
|
102
|
+
files:
|
103
|
+
- .gitignore
|
104
|
+
- .rspec
|
105
|
+
- .travis.yml
|
106
|
+
- .yardopts
|
99
107
|
- CHANGELOG
|
100
108
|
- Gemfile
|
101
109
|
- README.md
|
@@ -140,7 +148,6 @@ files:
|
|
140
148
|
- examples/channels/qos_aka_prefetch.rb
|
141
149
|
- examples/channels/qos_aka_prefetch_without_callback.rb
|
142
150
|
- examples/connection/connect_and_immediately_disconnect.rb
|
143
|
-
- examples/deprecated/default_thread_local_channel_instance.rb
|
144
151
|
- examples/error_handling/automatic_recovery_of_channel_and_queues.rb
|
145
152
|
- examples/error_handling/automatically_recovering_hello_world_consumer.rb
|
146
153
|
- examples/error_handling/automatically_recovering_hello_world_consumer_that_uses_a_server_named_queue.rb
|
@@ -194,21 +201,12 @@ files:
|
|
194
201
|
- examples/inspecting_server_information.rb
|
195
202
|
- examples/issues/amq_client_issue_7.rb
|
196
203
|
- examples/issues/amq_protocol_issue_14.rb
|
204
|
+
- examples/issues/issue_121.rb
|
197
205
|
- examples/issues/issue_75.rb
|
198
206
|
- examples/issues/issue_79.rb
|
199
207
|
- examples/issues/issue_80.rb
|
200
208
|
- examples/issues/issue_93.rb
|
201
209
|
- examples/issues/issue_94.rb
|
202
|
-
- examples/legacy/ack.rb
|
203
|
-
- examples/legacy/callbacks.rb
|
204
|
-
- examples/legacy/clock.rb
|
205
|
-
- examples/legacy/hashtable.rb
|
206
|
-
- examples/legacy/logger.rb
|
207
|
-
- examples/legacy/multiclock.rb
|
208
|
-
- examples/legacy/pingpong.rb
|
209
|
-
- examples/legacy/primes-simple.rb
|
210
|
-
- examples/legacy/primes.rb
|
211
|
-
- examples/legacy/stocks.rb
|
212
210
|
- examples/patterns/command/consumer.rb
|
213
211
|
- examples/patterns/command/producer.rb
|
214
212
|
- examples/patterns/event/consumer.rb
|
@@ -265,28 +263,17 @@ files:
|
|
265
263
|
- lib/amqp/compatibility/ruby187_patchlevel_check.rb
|
266
264
|
- lib/amqp/connection.rb
|
267
265
|
- lib/amqp/consumer.rb
|
268
|
-
- lib/amqp/deprecated/fork.rb
|
269
|
-
- lib/amqp/deprecated/logger.rb
|
270
|
-
- lib/amqp/deprecated/mq.rb
|
271
|
-
- lib/amqp/deprecated/rpc.rb
|
272
266
|
- lib/amqp/exceptions.rb
|
273
267
|
- lib/amqp/exchange.rb
|
274
|
-
- lib/amqp/ext/em.rb
|
275
|
-
- lib/amqp/ext/emfork.rb
|
276
268
|
- lib/amqp/extensions/rabbitmq.rb
|
277
269
|
- lib/amqp/header.rb
|
278
270
|
- lib/amqp/int_allocator.rb
|
279
271
|
- lib/amqp/integration/rails.rb
|
280
|
-
- lib/amqp/logger.rb
|
281
272
|
- lib/amqp/queue.rb
|
282
|
-
- lib/amqp/rpc.rb
|
283
273
|
- lib/amqp/session.rb
|
284
274
|
- lib/amqp/utilities/event_loop_helper.rb
|
285
275
|
- lib/amqp/utilities/server_type.rb
|
286
276
|
- lib/amqp/version.rb
|
287
|
-
- lib/mq.rb
|
288
|
-
- lib/mq/logger.rb
|
289
|
-
- lib/mq/rpc.rb
|
290
277
|
- spec/integration/authentication_spec.rb
|
291
278
|
- spec/integration/automatic_binding_for_default_direct_exchange_spec.rb
|
292
279
|
- spec/integration/automatic_recovery_predicate_spec.rb
|
@@ -304,6 +291,7 @@ files:
|
|
304
291
|
- spec/integration/fanout_exchange_routing_spec.rb
|
305
292
|
- spec/integration/headers_exchange_routing_spec.rb
|
306
293
|
- spec/integration/hello_world_spec.rb
|
294
|
+
- spec/integration/immediate_messages_spec.rb
|
307
295
|
- spec/integration/mandatory_messages_spec.rb
|
308
296
|
- spec/integration/message_acknowledgement_spec.rb
|
309
297
|
- spec/integration/message_metadata_access_spec.rb
|
@@ -319,7 +307,6 @@ files:
|
|
319
307
|
- spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb
|
320
308
|
- spec/integration/regressions/empty_message_body_spec.rb
|
321
309
|
- spec/integration/regressions/issue66_spec.rb
|
322
|
-
- spec/integration/remove_individual_binding_spec.rb
|
323
310
|
- spec/integration/reply_queue_communication_spec.rb
|
324
311
|
- spec/integration/store_and_forward_spec.rb
|
325
312
|
- spec/integration/stress/publishing_of_messages_with_incrementing_sizes_spec.rb
|
@@ -332,32 +319,41 @@ files:
|
|
332
319
|
- spec/unit/amqp/client_spec.rb
|
333
320
|
- spec/unit/amqp/connection_spec.rb
|
334
321
|
- spec/unit/amqp/int_allocator_spec.rb
|
335
|
-
homepage: http://
|
336
|
-
licenses:
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
322
|
+
homepage: http://github.com/ruby-amqp/amqp
|
323
|
+
licenses:
|
324
|
+
- Ruby
|
325
|
+
post_install_message: "[\e[32mVersion 1.0.0\e[0m] [API] All public API bits deprecated in 0.8.0 are COMPLETELY REMOVED\n"
|
326
|
+
rdoc_options:
|
327
|
+
- --include=examples --main README.md
|
328
|
+
require_paths:
|
341
329
|
- lib
|
342
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
343
|
-
requirements:
|
344
|
-
- - ">="
|
345
|
-
- !ruby/object:Gem::Version
|
346
|
-
version: !binary |-
|
347
|
-
MA==
|
330
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
348
331
|
none: false
|
349
|
-
|
350
|
-
requirements:
|
332
|
+
requirements:
|
351
333
|
- - ">="
|
352
|
-
- !ruby/object:Gem::Version
|
353
|
-
|
354
|
-
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
hash: 3
|
336
|
+
segments:
|
337
|
+
- 0
|
338
|
+
version: "0"
|
339
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
355
340
|
none: false
|
341
|
+
requirements:
|
342
|
+
- - ">"
|
343
|
+
- !ruby/object:Gem::Version
|
344
|
+
hash: 25
|
345
|
+
segments:
|
346
|
+
- 1
|
347
|
+
- 3
|
348
|
+
- 1
|
349
|
+
version: 1.3.1
|
356
350
|
requirements: []
|
351
|
+
|
357
352
|
rubyforge_project: amqp
|
358
|
-
rubygems_version: 1.8.
|
359
|
-
signing_key:
|
353
|
+
rubygems_version: 1.8.15
|
354
|
+
signing_key:
|
360
355
|
specification_version: 3
|
361
|
-
summary: Widely used, feature-rich asynchronous
|
356
|
+
summary: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included
|
362
357
|
test_files: []
|
363
|
-
|
358
|
+
|
359
|
+
has_rdoc:
|
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require "bundler"
|
5
|
-
Bundler.setup
|
6
|
-
|
7
|
-
$:.unshift(File.expand_path("../../../lib", __FILE__))
|
8
|
-
|
9
|
-
require 'amqp'
|
10
|
-
|
11
|
-
# CODE BELOW IS USING DEPRECATED METHODS. PLEASE CONSIDER NOT USING THEM IF YOU CAN.
|
12
|
-
#
|
13
|
-
# The reason why these methods work at all is to make 0.6.x => 0.8.x migration easier so
|
14
|
-
# people won't be stuck with AMQP (the protocol) 0.8 forever and can benefit from more
|
15
|
-
# advanced AMQP 0.9.1 features.
|
16
|
-
#
|
17
|
-
|
18
|
-
EventMachine.run do
|
19
|
-
connection = AMQP.connect(:host => '127.0.0.1')
|
20
|
-
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
|
21
|
-
|
22
|
-
queue = AMQP::Channel.queue("amqpgem.examples.hello_world", :auto_delete => true)
|
23
|
-
exchange = MQ.direct("")
|
24
|
-
|
25
|
-
queue.subscribe do |payload|
|
26
|
-
puts "Received a message: #{payload}. Disconnecting..."
|
27
|
-
|
28
|
-
connection.close {
|
29
|
-
EM.stop { exit }
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
exchange.publish "Hello, world!", :routing_key => queue.name
|
34
|
-
end
|
data/examples/legacy/ack.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require "bundler"
|
5
|
-
Bundler.setup
|
6
|
-
|
7
|
-
$:.unshift(File.expand_path("../../../lib", __FILE__))
|
8
|
-
require 'amqp'
|
9
|
-
|
10
|
-
|
11
|
-
AMQP.start do |connection|
|
12
|
-
puts "Connected!"
|
13
|
-
channel = AMQP::Channel.new(connection)
|
14
|
-
e = channel.fanout("amqp-gem.examples.ack")
|
15
|
-
q = channel.queue('amqp-gem.examples.q1').bind(e) { puts "Bound #{e.name} to the queue" }
|
16
|
-
|
17
|
-
q.status do |message_count, consumer_count|
|
18
|
-
puts "Queue #{q.name} has #{message_count} messages and #{consumer_count} consumers"
|
19
|
-
end
|
20
|
-
|
21
|
-
i = 0
|
22
|
-
|
23
|
-
# Stopping after the second item was acked will keep the 3rd item in the queue
|
24
|
-
q.subscribe(:ack => true) do |h, m|
|
25
|
-
puts "Got a message"
|
26
|
-
|
27
|
-
if AMQP.closing?
|
28
|
-
puts "#{m} (ignored, redelivered later)"
|
29
|
-
else
|
30
|
-
puts m
|
31
|
-
h.ack
|
32
|
-
end
|
33
|
-
end # channel.queue
|
34
|
-
|
35
|
-
|
36
|
-
10.times do |i|
|
37
|
-
puts "Publishing message ##{i}"
|
38
|
-
e.publish("Totally rad #{i}")
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
show_stopper = Proc.new {
|
43
|
-
q.status do |message_count, consumer_count|
|
44
|
-
puts "Queue #{q.name} has #{message_count} messages and #{consumer_count} consumers"
|
45
|
-
end
|
46
|
-
|
47
|
-
q.unbind(e) do
|
48
|
-
puts "Unbound #{q.name} from #{e.name}"
|
49
|
-
|
50
|
-
e.delete do
|
51
|
-
puts "Just deleted #{e.name}"
|
52
|
-
end
|
53
|
-
|
54
|
-
q.delete do
|
55
|
-
puts "Just deleted #{q.name}"
|
56
|
-
AMQP.stop do
|
57
|
-
puts "About to stop EM reactor"
|
58
|
-
EM.stop
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
}
|
63
|
-
|
64
|
-
EM.add_timer(3, show_stopper)
|
65
|
-
|
66
|
-
# For ack to work appropriately you must shutdown AMQP gracefully,
|
67
|
-
# otherwise all items in your queue will be returned
|
68
|
-
Signal.trap('INT', show_stopper)
|
69
|
-
Signal.trap('TERM', show_stopper)
|
70
|
-
end # AMQP.start
|
@@ -1,45 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require "bundler"
|
5
|
-
Bundler.setup
|
6
|
-
|
7
|
-
$:.unshift File.expand_path("../../lib", __FILE__)
|
8
|
-
require "amqp"
|
9
|
-
|
10
|
-
AMQP.start(:host => "localhost") do |connection|
|
11
|
-
|
12
|
-
# Send Connection.Close on Ctrl+C
|
13
|
-
trap(:INT) do
|
14
|
-
unless connection.closing?
|
15
|
-
connection.close { exit! }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
@counter = 0
|
20
|
-
amq = AMQP::Channel.new
|
21
|
-
|
22
|
-
amq.prefetch(64, false) do
|
23
|
-
puts "basic.qos callback has fired"
|
24
|
-
end
|
25
|
-
|
26
|
-
amq.recover do
|
27
|
-
puts "basic.recover callback has fired"
|
28
|
-
end
|
29
|
-
|
30
|
-
10.times do
|
31
|
-
amq.queue("") do |queue|
|
32
|
-
puts "Queue #{queue.name} is now declared."
|
33
|
-
puts "All queues: #{amq.queues.map { |q| q.name }.join(', ')}"
|
34
|
-
|
35
|
-
@counter += 1
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
EM.add_timer(0.3) do
|
40
|
-
connection.disconnect do
|
41
|
-
puts "AMQP connection is now closed."
|
42
|
-
EM.stop
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|