amqp 0.8.0.rc2 → 0.8.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -3
- data/.travis.yml +5 -2
- data/.yardopts +2 -0
- data/CHANGELOG +17 -20
- data/Gemfile +7 -5
- data/README.textile +67 -29
- data/Rakefile +6 -0
- data/amqp.gemspec +5 -5
- data/docs/08Migration.textile +27 -0
- data/docs/Bindings.textile +27 -0
- data/docs/ConnectingToTheBroker.textile +277 -0
- data/docs/DocumentationGuidesIndex.textile +25 -0
- data/docs/Durability.textile +27 -0
- data/docs/ErrorHandling.textile +84 -0
- data/docs/Exchanges.textile +27 -0
- data/docs/GettingStarted.textile +585 -0
- data/docs/Queues.textile +27 -0
- data/docs/RabbitMQVersions.textile +12 -2
- data/docs/Routing.textile +27 -0
- data/docs/TLS.textile +27 -0
- data/docs/VendorSpecificExtensions.textile +11 -1
- data/examples/{various → channels}/open_channel_without_assignment.rb +0 -4
- data/examples/channels/prefetch_as_constructor_argument.rb +31 -0
- data/examples/channels/qos_aka_prefetch.rb +34 -0
- data/examples/channels/qos_aka_prefetch_without_callback.rb +32 -0
- data/examples/error_handling/channel_level_exception.rb +47 -0
- data/examples/error_handling/channel_level_exception_with_multiple_channels_involved.rb +54 -0
- data/examples/error_handling/connection_loss_handler.rb +39 -0
- data/examples/error_handling/global_channel_level_exception_handler.rb +65 -0
- data/examples/error_handling/handling_authentication_failure_with_a_callback.rb +33 -0
- data/examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb +30 -0
- data/examples/error_handling/tcp_connection_failure_with_a_callback.rb +28 -0
- data/examples/{various → exchanges}/declare_an_exchange_without_assignment.rb +0 -4
- data/examples/guides/getting_started/01_hello_world.rb +24 -0
- data/examples/guides/getting_started/02_hello_world_dslified.rb +23 -0
- data/examples/guides/getting_started/03_babblr.rb +33 -0
- data/examples/guides/getting_started/04_weathr.rb +56 -0
- data/examples/hello_world.rb +12 -13
- data/examples/hello_world_with_eventmachine_in_a_separate_thread.rb +37 -0
- data/examples/{various → legacy}/ack.rb +0 -0
- data/examples/{various → legacy}/callbacks.rb +0 -0
- data/examples/{various → legacy}/clock.rb +0 -0
- data/examples/{various → legacy}/hashtable.rb +0 -0
- data/examples/{various → legacy}/logger.rb +0 -0
- data/examples/{various → legacy}/multiclock.rb +0 -0
- data/examples/{various → legacy}/pingpong.rb +0 -2
- data/examples/{various → legacy}/primes-simple.rb +0 -0
- data/examples/{various → legacy}/primes.rb +0 -2
- data/examples/{various → legacy}/stocks.rb +0 -0
- data/examples/{various → queues}/automatic_binding_for_default_direct_exchange.rb +4 -0
- data/examples/{various → queues}/basic_get.rb +0 -2
- data/examples/{various → queues}/declare_a_queue_without_assignment.rb +0 -4
- data/examples/queues/declare_and_bind_a_server_named_queue.rb +43 -0
- data/examples/{various → queues}/queue_status.rb +3 -8
- data/examples/{various → routing}/pubsub.rb +0 -0
- data/examples/{various → routing}/weather_updates.rb +1 -1
- data/lib/amqp/channel.rb +231 -52
- data/lib/amqp/client.rb +6 -3
- data/lib/amqp/connection.rb +9 -10
- data/lib/amqp/deprecated/fork.rb +3 -3
- data/lib/amqp/deprecated/logger.rb +1 -0
- data/lib/amqp/deprecated/mq.rb +23 -1
- data/lib/amqp/deprecated/rpc.rb +1 -0
- data/lib/amqp/exceptions.rb +45 -3
- data/lib/amqp/exchange.rb +29 -35
- data/lib/amqp/ext/em.rb +0 -7
- data/lib/amqp/ext/emfork.rb +3 -2
- data/lib/amqp/header.rb +4 -0
- data/lib/amqp/queue.rb +96 -33
- data/lib/amqp/session.rb +140 -0
- data/lib/amqp/version.rb +6 -1
- data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +7 -7
- data/spec/integration/channel_level_exception_with_multiple_channels_spec.rb +69 -0
- data/spec/integration/declare_and_immediately_bind_a_server_named_queue_spec.rb +42 -0
- data/spec/integration/queue_declaration_spec.rb +8 -24
- data/spec/integration/queue_redeclaration_with_incompatible_attributes_spec.rb +43 -0
- data/spec/unit/amqp/connection_spec.rb +1 -1
- metadata +200 -182
- data/lib/amqp/basic_client.rb +0 -27
data/docs/Queues.textile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
h1. TBD
|
2
|
+
|
3
|
+
|
4
|
+
h2. About this guide
|
5
|
+
|
6
|
+
TBD
|
7
|
+
|
8
|
+
|
9
|
+
h2. Covered versions
|
10
|
+
|
11
|
+
This guide covers amqp gem v0.8.0 and later.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
h2. TBD
|
16
|
+
|
17
|
+
TBD
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
h2. Tell us what you think!
|
22
|
+
|
23
|
+
Please take a moment and tell us what you think about this guide on "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
|
24
|
+
what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
|
25
|
+
key to making documentation better.
|
26
|
+
|
27
|
+
If mailing list communication is not an option for you for some reason, you can "contact guides author directly":mailto:michael@novemberain.com?subject=amqp%20gem%20documentation
|
@@ -4,7 +4,7 @@ h2. Using recent versions on Debian and Ubuntu
|
|
4
4
|
|
5
5
|
Ubuntu (even 10.10) and Debian both "ship with old RabbitMQ version":http://packages.ubuntu.com/maverick/rabbitmq-server,
|
6
6
|
that only supports AMQP protocol 0.8. amqp gem 0.8.0 and later *will not work with RabbitMQ versions
|
7
|
-
before
|
7
|
+
before 2.0.0*.
|
8
8
|
|
9
9
|
We strongly recommend that you use "RabbitMQ apt repository":http://www.rabbitmq.com/debian.html#apt that has recent versions of RabbitMQ.
|
10
10
|
|
@@ -18,4 +18,14 @@ support, RabbitMQ 1.7.0 requires
|
|
18
18
|
* Erlang/OTP R13B or later
|
19
19
|
* Erlang SSL 3.10 or later
|
20
20
|
|
21
|
-
and recommends using Erlang R141B that ships with Erlang SSL 4.0.1.
|
21
|
+
and recommends using Erlang R141B that ships with Erlang SSL 4.0.1.
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
h2. Tell us what you think!
|
26
|
+
|
27
|
+
Please take a moment and tell us what you think about this guide on "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
|
28
|
+
what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
|
29
|
+
key to making documentation better.
|
30
|
+
|
31
|
+
If mailing list communication is not an option for you for some reason, you can "contact guides author directly":mailto:michael@novemberain.com?subject=amqp%20gem%20documentation
|
@@ -0,0 +1,27 @@
|
|
1
|
+
h1. TBD
|
2
|
+
|
3
|
+
|
4
|
+
h2. About this guide
|
5
|
+
|
6
|
+
TBD
|
7
|
+
|
8
|
+
|
9
|
+
h2. Covered versions
|
10
|
+
|
11
|
+
This guide covers amqp gem v0.8.0 and later.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
h2. TBD
|
16
|
+
|
17
|
+
TBD
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
h2. Tell us what you think!
|
22
|
+
|
23
|
+
Please take a moment and tell us what you think about this guide on "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
|
24
|
+
what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
|
25
|
+
key to making documentation better.
|
26
|
+
|
27
|
+
If mailing list communication is not an option for you for some reason, you can "contact guides author directly":mailto:michael@novemberain.com?subject=amqp%20gem%20documentation
|
data/docs/TLS.textile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
h1. TBD
|
2
|
+
|
3
|
+
|
4
|
+
h2. About this guide
|
5
|
+
|
6
|
+
TBD
|
7
|
+
|
8
|
+
|
9
|
+
h2. Covered versions
|
10
|
+
|
11
|
+
This guide covers amqp gem v0.8.0 and later.
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
h2. TBD
|
16
|
+
|
17
|
+
TBD
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
h2. Tell us what you think!
|
22
|
+
|
23
|
+
Please take a moment and tell us what you think about this guide on "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
|
24
|
+
what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
|
25
|
+
key to making documentation better.
|
26
|
+
|
27
|
+
If mailing list communication is not an option for you for some reason, you can "contact guides author directly":mailto:michael@novemberain.com?subject=amqp%20gem%20documentation
|
@@ -29,4 +29,14 @@ h3. Example of using publisher confirmations
|
|
29
29
|
|
30
30
|
h3. Documentation
|
31
31
|
|
32
|
-
RabbitMQ extensions documentation is part of "amq-client gem documentation":http://rubydoc.info/github/ruby-amqp/amq-client/master/frames
|
32
|
+
RabbitMQ extensions documentation is part of "amq-client gem documentation":http://rubydoc.info/github/ruby-amqp/amq-client/master/frames
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
h2. Tell us what you think!
|
37
|
+
|
38
|
+
Please take a moment and tell us what you think about this guide on "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
|
39
|
+
what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
|
40
|
+
key to making documentation better.
|
41
|
+
|
42
|
+
If mailing list communication is not an option for you for some reason, you can "contact guides author directly":mailto:michael@novemberain.com?subject=amqp%20gem%20documentation
|
@@ -20,10 +20,6 @@ AMQP.start(:host => 'localhost') do |connection|
|
|
20
20
|
show_stopper = Proc.new do
|
21
21
|
$stdout.puts "Stopping..."
|
22
22
|
|
23
|
-
# queue.purge :nowait => true
|
24
|
-
|
25
|
-
# now change this to just EM.stop and it
|
26
|
-
# unbinds instantly
|
27
23
|
connection.close {
|
28
24
|
EM.stop { exit }
|
29
25
|
}
|
@@ -0,0 +1,31 @@
|
|
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
|
+
|
12
|
+
puts "=> Channel#prefetch"
|
13
|
+
puts
|
14
|
+
AMQP.start(:host => 'localhost') do |connection|
|
15
|
+
ch = AMQP::Channel.new(connection, AMQP::Channel.next_channel_id, :prefetch => 1)
|
16
|
+
ch.on_error do |ex|
|
17
|
+
raise "Oops! there has been a channel-level exception"
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
show_stopper = Proc.new do
|
22
|
+
$stdout.puts "Stopping..."
|
23
|
+
|
24
|
+
connection.close {
|
25
|
+
EM.stop { exit }
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
Signal.trap "INT", show_stopper
|
30
|
+
EM.add_timer(1, show_stopper)
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
|
12
|
+
puts "=> Channel#prefetch"
|
13
|
+
puts
|
14
|
+
AMQP.start(:host => 'localhost') do |connection|
|
15
|
+
ch = AMQP::Channel.new
|
16
|
+
ch.on_error do |ex|
|
17
|
+
raise "Oops! there has been a channel-level exception"
|
18
|
+
end
|
19
|
+
ch.prefetch(1, false) do |_|
|
20
|
+
puts "qos callback has fired"
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
show_stopper = Proc.new do
|
25
|
+
$stdout.puts "Stopping..."
|
26
|
+
|
27
|
+
connection.close {
|
28
|
+
EM.stop { exit }
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
Signal.trap "INT", show_stopper
|
33
|
+
EM.add_timer(1, show_stopper)
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
|
12
|
+
puts "=> Channel#prefetch"
|
13
|
+
puts
|
14
|
+
AMQP.start(:host => 'localhost') do |connection|
|
15
|
+
ch = AMQP::Channel.new
|
16
|
+
ch.on_error do |ex|
|
17
|
+
raise "Oops! there has been a channel-level exception"
|
18
|
+
end
|
19
|
+
ch.prefetch(1, false)
|
20
|
+
|
21
|
+
|
22
|
+
show_stopper = Proc.new do
|
23
|
+
$stdout.puts "Stopping..."
|
24
|
+
|
25
|
+
connection.close {
|
26
|
+
EM.stop { exit }
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
Signal.trap "INT", show_stopper
|
31
|
+
EM.add_timer(1, show_stopper)
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
12
|
+
puts "=> Queue redeclaration with different attributes results in a channel exception that is handled"
|
13
|
+
puts
|
14
|
+
AMQP.start("amqp://guest:guest@dev.rabbitmq.com:5672/") do |connection, open_ok|
|
15
|
+
AMQP::Channel.new do |channel, open_ok|
|
16
|
+
puts "Channel ##{channel.id} is now open!"
|
17
|
+
|
18
|
+
channel.on_error do |ch, close|
|
19
|
+
puts "Handling channel-level exception"
|
20
|
+
end
|
21
|
+
|
22
|
+
EventMachine.add_timer(0.4) do
|
23
|
+
# these two definitions result in a race condition. For sake of this example,
|
24
|
+
# however, it does not matter. Whatever definition succeeds first, 2nd one will
|
25
|
+
# cause a channel-level exception (because attributes are not identical)
|
26
|
+
AMQP::Queue.new(channel, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => false) do |queue|
|
27
|
+
puts "#{queue.name} is ready to go"
|
28
|
+
end
|
29
|
+
|
30
|
+
AMQP::Queue.new(channel, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => true) do |queue|
|
31
|
+
puts "#{queue.name} is ready to go"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
show_stopper = Proc.new do
|
38
|
+
$stdout.puts "Stopping..."
|
39
|
+
|
40
|
+
connection.close {
|
41
|
+
EM.stop { exit }
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
Signal.trap "INT", show_stopper
|
46
|
+
EM.add_timer(2, show_stopper)
|
47
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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
|
+
|
12
|
+
puts "=> Queue redeclaration with different attributes results in a channel exception that is handled"
|
13
|
+
puts
|
14
|
+
AMQP.start("amqp://guest:guest@dev.rabbitmq.com:5672/") do |connection, open_ok|
|
15
|
+
ch1 = AMQP::Channel.new(connection) do |ch, open_ok|
|
16
|
+
puts "Channel ##{ch.id} is now open!"
|
17
|
+
end
|
18
|
+
ch1.on_error do |ch, close|
|
19
|
+
raise "Handling channel-level exception on channel with id of #{ch.id} (ch1)"
|
20
|
+
end
|
21
|
+
|
22
|
+
ch2 = AMQP::Channel.new(connection) do |ch, open_ok|
|
23
|
+
puts "Channel ##{ch.id} is now open!"
|
24
|
+
end
|
25
|
+
ch2.on_error do |ch, close|
|
26
|
+
puts "Handling channel-level exception on channel with id of #{ch.id} (ch2)"
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
EventMachine.add_timer(0.2) do
|
31
|
+
AMQP::Queue.new(ch1, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => false) do |queue|
|
32
|
+
puts "#{queue.name} is ready to go"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
EventMachine.add_timer(0.6) do
|
37
|
+
AMQP::Queue.new(ch2, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => true) do |queue|
|
38
|
+
puts "#{queue.name} is ready to go"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
show_stopper = Proc.new do
|
45
|
+
$stdout.puts "Stopping..."
|
46
|
+
|
47
|
+
connection.close {
|
48
|
+
EM.stop { exit }
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
Signal.trap "INT", show_stopper
|
53
|
+
EM.add_timer(2, show_stopper)
|
54
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
|
12
|
+
puts "=> Connection loss is detected and handled"
|
13
|
+
puts
|
14
|
+
AMQP.start(:port => 5672,
|
15
|
+
:vhost => "/amq_client_testbed",
|
16
|
+
:user => "amq_client_gem",
|
17
|
+
:password => "amq_client_gem_password",
|
18
|
+
:timeout => 0.3,
|
19
|
+
:on_tcp_connection_failure => Proc.new { |settings| puts "Failed to connect, this was NOT expected"; EM.stop }) do |connection, open_ok|
|
20
|
+
connection.on_tcp_connection_loss do |cl, settings|
|
21
|
+
puts "tcp_connection_loss handler kicks in"
|
22
|
+
cl.reconnect(false, 1)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
show_stopper = Proc.new do
|
27
|
+
$stdout.puts "Stopping..."
|
28
|
+
|
29
|
+
connection.close {
|
30
|
+
EM.stop { exit }
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
puts "Connected, authenticated. To really exercise this example, shut AMQP broker down for a few seconds. If you don't it will exit gracefully in 30 seconds."
|
35
|
+
|
36
|
+
Signal.trap "TERM", show_stopper
|
37
|
+
Signal.trap "INT", show_stopper
|
38
|
+
EM.add_timer(30, show_stopper)
|
39
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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
|
+
|
12
|
+
puts "=> Queue redeclaration with different attributes results in a channel exception that is handled by a global callback we carry from 0.7.x days"
|
13
|
+
puts
|
14
|
+
|
15
|
+
puts <<-MSG
|
16
|
+
WARNING!! ACHTUNG!! AVIS!! AVISO!! Poorly designed API use ahead!!
|
17
|
+
|
18
|
+
Please never ever use global error handler demonstrated below!
|
19
|
+
It is a brilliant decision from early days of the library and we have to carry it
|
20
|
+
along for backwards compatibility.
|
21
|
+
|
22
|
+
Global state is programming is usually a pain. Global error handling is a
|
23
|
+
true Hell.
|
24
|
+
|
25
|
+
You have been warned.
|
26
|
+
MSG
|
27
|
+
|
28
|
+
puts
|
29
|
+
puts
|
30
|
+
|
31
|
+
AMQP.start("amqp://guest:guest@dev.rabbitmq.com:5672/") do |connection, open_ok|
|
32
|
+
AMQP::Channel.new do |channel, open_ok|
|
33
|
+
puts "Channel ##{channel.id} is now open!"
|
34
|
+
|
35
|
+
channel.on_error do |ch, close|
|
36
|
+
puts "Handling channel-level exception at instance level"
|
37
|
+
end
|
38
|
+
|
39
|
+
AMQP::Channel.on_error do |ch, close|
|
40
|
+
puts "Handling channel-level exception at GLOBAL level. Jeez."
|
41
|
+
end
|
42
|
+
|
43
|
+
EventMachine.add_timer(0.4) do
|
44
|
+
q1 = AMQP::Queue.new(channel, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => false) do |queue|
|
45
|
+
puts "#{queue.name} is ready to go"
|
46
|
+
end
|
47
|
+
|
48
|
+
q2 = AMQP::Queue.new(channel, "amqpgem.examples.channel_exception", :auto_delete => true, :durable => true) do |queue|
|
49
|
+
puts "#{queue.name} is ready to go"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
show_stopper = Proc.new do
|
56
|
+
$stdout.puts "Stopping..."
|
57
|
+
|
58
|
+
connection.close {
|
59
|
+
EM.stop { exit }
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
Signal.trap "INT", show_stopper
|
64
|
+
EM.add_timer(2, show_stopper)
|
65
|
+
end
|