amqp 0.7.0 → 0.7.1

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.
Files changed (77) hide show
  1. data/.gitignore +3 -2
  2. data/CHANGELOG +25 -0
  3. data/Gemfile +4 -2
  4. data/README.md +2 -0
  5. data/{amqp.todo → TODO} +1 -3
  6. data/amqp.gemspec +3 -3
  7. data/bin/irb +2 -2
  8. data/bin/jenkins.sh +25 -0
  9. data/bin/set_test_suite_realms_up.sh +21 -0
  10. data/doc/EXAMPLE_01_PINGPONG +1 -1
  11. data/doc/EXAMPLE_02_CLOCK +1 -1
  12. data/doc/EXAMPLE_03_STOCKS +1 -1
  13. data/doc/EXAMPLE_04_MULTICLOCK +1 -1
  14. data/doc/EXAMPLE_05_ACK +1 -1
  15. data/doc/EXAMPLE_05_POP +1 -1
  16. data/doc/EXAMPLE_06_HASHTABLE +1 -1
  17. data/examples/{mq/ack.rb → ack.rb} +6 -6
  18. data/examples/{mq/automatic_binding_for_default_direct_exchange.rb → automatic_binding_for_default_direct_exchange.rb} +4 -4
  19. data/examples/{mq/callbacks.rb → callbacks.rb} +2 -2
  20. data/examples/{mq/clock.rb → clock.rb} +5 -5
  21. data/examples/{mq/hashtable.rb → hashtable.rb} +4 -4
  22. data/examples/{mq/internal.rb → internal.rb} +5 -5
  23. data/examples/{mq/logger.rb → logger.rb} +5 -5
  24. data/examples/{mq/multiclock.rb → multiclock.rb} +4 -4
  25. data/examples/{mq/pingpong.rb → pingpong.rb} +5 -5
  26. data/examples/{mq/pop.rb → pop.rb} +3 -3
  27. data/examples/{mq/primes-simple.rb → primes-simple.rb} +0 -0
  28. data/examples/{mq/primes.rb → primes.rb} +6 -6
  29. data/examples/{amqp/simple.rb → simple.rb} +1 -1
  30. data/examples/{mq/stocks.rb → stocks.rb} +5 -5
  31. data/lib/amqp.rb +8 -112
  32. data/lib/amqp/basic_client.rb +58 -0
  33. data/lib/amqp/channel.rb +937 -0
  34. data/lib/amqp/client.rb +72 -79
  35. data/lib/{mq → amqp}/collection.rb +12 -2
  36. data/lib/amqp/connection.rb +115 -0
  37. data/lib/amqp/exceptions.rb +18 -0
  38. data/lib/{mq → amqp}/exchange.rb +32 -34
  39. data/lib/{ext → amqp/ext}/em.rb +1 -1
  40. data/lib/{ext → amqp/ext}/emfork.rb +0 -0
  41. data/lib/amqp/frame.rb +3 -3
  42. data/lib/{mq → amqp}/header.rb +5 -11
  43. data/lib/{mq → amqp}/logger.rb +2 -2
  44. data/lib/amqp/protocol.rb +2 -2
  45. data/lib/{mq → amqp}/queue.rb +20 -17
  46. data/lib/{mq → amqp}/rpc.rb +20 -8
  47. data/lib/amqp/server.rb +1 -1
  48. data/lib/amqp/version.rb +1 -1
  49. data/lib/mq.rb +20 -964
  50. data/protocol/codegen.rb +1 -1
  51. data/research/api.rb +3 -3
  52. data/research/primes-forked.rb +5 -5
  53. data/research/primes-processes.rb +5 -5
  54. data/research/primes-threaded.rb +5 -5
  55. data/spec/integration/authentication_spec.rb +114 -0
  56. data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +13 -12
  57. data/spec/{unit/mq → integration}/channel_close_spec.rb +2 -2
  58. data/spec/{unit/mq → integration}/exchange_declaration_spec.rb +26 -14
  59. data/spec/{unit/mq → integration}/queue_declaration_spec.rb +4 -4
  60. data/spec/integration/queue_exclusivity_spec.rb +95 -0
  61. data/spec/integration/reply_queue_communication_spec.rb +63 -0
  62. data/spec/integration/store_and_forward_spec.rb +121 -0
  63. data/spec/integration/topic_subscription_spec.rb +193 -0
  64. data/spec/integration/workload_distribution_spec.rb +245 -0
  65. data/spec/spec_helper.rb +16 -32
  66. data/spec/unit/{mq/mq_basic_spec.rb → amqp/basic_spec.rb} +4 -4
  67. data/spec/unit/{mq → amqp}/collection_spec.rb +22 -7
  68. data/spec/unit/amqp/connection_spec.rb +116 -0
  69. data/spec/unit/amqp/frame_spec.rb +18 -18
  70. data/spec/unit/amqp/protocol_spec.rb +9 -11
  71. metadata +54 -49
  72. data/lib/ext/blankslate.rb +0 -9
  73. data/spec/mq_helper.rb +0 -70
  74. data/spec/unit/amqp/client_spec.rb +0 -472
  75. data/spec/unit/amqp/misc_spec.rb +0 -123
  76. data/spec/unit/mq/misc_spec.rb +0 -228
  77. data/spec/unit/mq/queue_spec.rb +0 -71
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- *.gem
1
+ /*.gem
2
2
  *.rbc
3
3
  ~*
4
4
  #*
@@ -7,4 +7,5 @@
7
7
  .bundle
8
8
  Gemfile.lock
9
9
 
10
- spec/amqp.yml
10
+ spec/amqp.yml
11
+ vendor/cache
data/CHANGELOG CHANGED
@@ -1,3 +1,28 @@
1
+ = Version 0.7.1
2
+
3
+ * [BUG] AMQP gem no longer conflicts with Builder 2.1.2 on Ruby 1.9.
4
+ All Ruby on Rails 3 users who run Ruby 1.9 are highly recommended
5
+ to upgrade!
6
+
7
+ * [API] AMQP::Exchange.default no longer caches exchange object between calls
8
+ because it may lead to very obscure issues when channel that exchange was
9
+ using is closed (due to connection loss, as part of test suite teardown
10
+ or in any other way).
11
+
12
+ * [API] AMQP::Exchange.default now accepts channel as a parameter.
13
+ * [API] AMQP::Exchange#channel
14
+ * [BUG] Basic.Return is not supported by amqp gem yet, but it should not result in obscure exceptions
15
+ * [API] AMQP::Exchange#publish now supports content type overriding.
16
+ * [API] Introduce AMQP::Exchange #durable?, #transient?, #auto_deleted? and #passive?
17
+ * [API] Introduce AMQP::Channel#open?
18
+ * [BUG] AMQP connection was considered established prematurely.
19
+ * [API] MQ.logging is removed; please use AMQP.logging from now on.
20
+ * [API] MQ::Queue class is deprecated; please use AMQP::Queue from now on.
21
+ * [API] MQ::Exchange class is deprecated; please use AMQP::Exchange from now on.
22
+ * [API] MQ class is deprecated; please use AMQP::Channel from now on.
23
+ * [API] require "mq" is deprecated; please use require "amqp" from now on.
24
+
25
+
1
26
  = Version 0.7
2
27
  * [BUG] Sync API for queues and exchanges, support for server-generated queues & exchange names (via semi-lazy collection).
3
28
  * [BUG] Sync API for MQ#close (Channel.Close) [issue #34].
data/Gemfile CHANGED
@@ -3,9 +3,11 @@
3
3
  source "http://gemcutter.org"
4
4
 
5
5
  gem "eventmachine"
6
- gem "json" if RUBY_VERSION < "1.9"
6
+ gem "json" if RUBY_VERSION < "1.9" || ARGV.first == "install"
7
+ gem "amq-client", :git => "git://github.com/ruby-amqp/amq-client.git", :branch => "master"
7
8
 
8
9
  group(:test) do
9
10
  gem "rspec", ">=2.0.0"
10
- gem "amqp-spec", ">=0.3.7"
11
+
12
+ gem "amqp-spec", :git => "git://github.com/ruby-amqp/amqp-spec.git", :branch => "master"
11
13
  end
data/README.md CHANGED
@@ -73,10 +73,12 @@ libraries that would block current thread (like [File::Tail](http://rubygems.org
73
73
  Links
74
74
  ==============================
75
75
 
76
+ * [RDoc](http://rubydoc.info/github/ruby-amqp/amqp/master/file/README.md)
76
77
  * Jabber chat [amqp-dev@conf.netlab.cz](xmpp://amqp-dev@conf.netlab.cz)
77
78
  * [AMQP gem mailing list](http://groups.google.com/group/ruby-amqp)
78
79
  * [AMQP gem at GitHub](http://github.com/amqp-dev/amqp)
79
80
  * [AMQP gem at Gemcutter](http://rubygems.org/gems/amqp)
81
+ * [Jenkins CI Server](http://jenkins.101ideas.cz/job/AMQP)
80
82
 
81
83
  Contributions
82
84
  ============================
@@ -1,8 +1,6 @@
1
1
  - breaks with header values that are nil
2
2
  - breaks with header values that are ruby objects (convert to strings?)
3
- - sending utf8 data in 1.9 breaks
4
3
 
5
- - generate amqp/spec.rb from original xml spec
6
4
  - add peek and pop to queues
7
5
  - use rabbitmq generated consumer tag from basic.consume-ok reply
8
6
 
@@ -29,4 +27,4 @@
29
27
  - handle connection.redirect during connect (for rabbitmq in distributed mode) [or just set insist to true]
30
28
 
31
29
  - add amq.queue('name').size{ |num| "#{num} messages in the queue" } (send declare passive, look at declare-ok response)
32
- - clean up MQ.default on disconnect
30
+ - clean up AMQP::Channel.default on disconnect
@@ -7,12 +7,12 @@ require File.expand_path("../lib/amqp/version", __FILE__)
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "amqp"
9
9
  s.version = AMQP::VERSION
10
- s.authors = ["Aman Gupta", "Jakub Stastny aka botanicus"]
10
+ s.authors = ["Aman Gupta", "Jakub Stastny aka botanicus", "Michael S. Klishin"]
11
11
  s.homepage = "http://github.com/ruby-amqp/amqp"
12
12
  s.summary = "AMQP client implementation in Ruby/EventMachine."
13
13
  s.description = "An implementation of the AMQP protocol in Ruby/EventMachine for writing clients to the RabbitMQ message broker."
14
14
  s.cert_chain = nil
15
- s.email = Base64.decode64("c3Rhc3RueUAxMDFpZGVhcy5jeg==\n")
15
+ s.email = ["bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=\n", "c3Rhc3RueUAxMDFpZGVhcy5jeg==\n"].map { |i| Base64.decode64(i) }
16
16
 
17
17
  # files
18
18
  s.files = `git ls-files`.split("\n")
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # RDoc
22
22
  s.has_rdoc = true
23
- s.rdoc_options = '--include=examples'
23
+ s.rdoc_options = '--include=examples --main README.md'
24
24
  s.extra_rdoc_files = ["README.md"] + Dir.glob("doc/*")
25
25
 
26
26
  # Dependencies
data/bin/irb CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
 
4
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+ $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
5
5
 
6
6
  require "irb"
7
- require "mq"
7
+ require "amqp"
8
8
 
9
9
  IRB.start(__FILE__)
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+
3
+ echo -e "\n\n==== Setup ===="
4
+ source /etc/profile
5
+ git fetch && git reset origin/master --hard
6
+
7
+ # FIXME: Jenkins user doesn't have permissions to run it.
8
+ # PATH=/usr/sbin:$PATH ./bin/set_test_suite_realms_up.sh
9
+ echo "~ NOT running ./bin/set_test_suite_realms_up.sh"
10
+
11
+ echo -e "\n\n==== Ruby 1.9.2 Head ===="
12
+ rvm use 1.9.2-head@ruby-amqp
13
+ gem install bundler --no-ri --no-rdoc
14
+ bundle install --local; echo
15
+ bundle exec rspec spec
16
+ return_status=$?
17
+
18
+ echo -e "\n\n==== Ruby 1.8.7 ===="
19
+ rvm use 1.8.7@ruby-amqp
20
+ gem install bundler --no-ri --no-rdoc
21
+ bundle install --local; echo
22
+ bundle exec rspec spec
23
+ return_status=$(expr $return_status + $?)
24
+
25
+ test $return_status -eq 0
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ # guest:guest has full access to /
4
+
5
+ rabbitmqctl add_vhost /
6
+ rabbitmqctl add_user guest guest
7
+ rabbitmqctl set_permissions -p / guest ".*" ".*" ".*"
8
+
9
+
10
+ # amqp_gem:amqp_gem_password has full access to /amqp_gem_testbed
11
+
12
+ rabbitmqctl add_vhost /amqp_gem_testbed
13
+ rabbitmqctl add_user amqp_gem amqp_gem_password
14
+ rabbitmqctl set_permissions -p /amqp_gem_testbed amqp_gem ".*" ".*" ".*"
15
+
16
+
17
+ # amqp_gem_reader:reader_password has read access to /amqp_gem_testbed
18
+
19
+ rabbitmqctl add_user amqp_gem_reader reader_password
20
+ rabbitmqctl clear_permissions -p /amqp_gem_testbed guest
21
+ rabbitmqctl set_permissions -p /amqp_gem_testbed amqp_gem_reader "^---$" "^---$" ".*"
@@ -1,2 +1,2 @@
1
1
  == Ping Pong Example
2
- :include: mq/pingpong.rb
2
+ :include: pingpong.rb
@@ -1,2 +1,2 @@
1
1
  == Clock Example
2
- :include: mq/clock.rb
2
+ :include: clock.rb
@@ -1,2 +1,2 @@
1
1
  == Stocks Example
2
- :include: mq/stocks.rb
2
+ :include: stocks.rb
@@ -1,2 +1,2 @@
1
1
  == Muti-format Clock Example
2
- :include: mq/multiclock.rb
2
+ :include: multiclock.rb
@@ -1,2 +1,2 @@
1
1
  == Ack Example
2
- :include: mq/ack.rb
2
+ :include: ack.rb
@@ -1,2 +1,2 @@
1
1
  == Pop Example
2
- :include: mq/pop.rb
2
+ :include: pop.rb
@@ -1,2 +1,2 @@
1
1
  == HashTable RPC Example
2
- :include: mq/hashtable.rb
2
+ :include: hashtable.rb
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
 
6
6
  # For ack to work appropriately you must shutdown AMQP gracefully,
7
7
  # otherwise all items in your queue will be returned
@@ -9,14 +9,14 @@ Signal.trap('INT') { AMQP.stop { EM.stop } }
9
9
  Signal.trap('TERM') { AMQP.stop { EM.stop } }
10
10
 
11
11
  AMQP.start(:host => 'localhost') do
12
- MQ.queue('awesome').publish('Totally rad 1')
13
- MQ.queue('awesome').publish('Totally rad 2')
14
- MQ.queue('awesome').publish('Totally rad 3')
12
+ AMQP::Channel.queue('awesome').publish('Totally rad 1')
13
+ AMQP::Channel.queue('awesome').publish('Totally rad 2')
14
+ AMQP::Channel.queue('awesome').publish('Totally rad 3')
15
15
 
16
16
  i = 0
17
17
 
18
18
  # Stopping after the second item was acked will keep the 3rd item in the queue
19
- MQ.queue('awesome').subscribe(:ack => true) do |h, m|
19
+ AMQP::Channel.queue('awesome').subscribe(:ack => true) do |h, m|
20
20
  if (i += 1) == 3
21
21
  puts 'Shutting down...'
22
22
  AMQP.stop { EM.stop }
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
4
 
5
- require 'mq'
5
+ require 'amqp'
6
6
 
7
7
  if RUBY_VERSION == "1.8.7"
8
8
  module ArrayExtensions
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  EM.run do
22
22
  connection = AMQP.connect
23
- mq = MQ.new(connection)
23
+ mq = AMQP::Channel.new(connection)
24
24
 
25
25
  show_stopper = Proc.new do
26
26
  $stdout.puts "Stopping..."
@@ -42,7 +42,7 @@ EM.run do
42
42
  queues = [queue1, queue2, queue3]
43
43
 
44
44
  # Rely on default direct exchange binding, see section 2.1.2.4 Automatic Mode in AMQP 0.9.1 spec.
45
- exchange = MQ::Exchange.default
45
+ exchange = AMQP::Channel::Exchange.default
46
46
 
47
47
  queue1.subscribe do |payload|
48
48
  puts "Got #{payload} for #{queue1.name}"
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  $:.unshift File.expand_path("../../../lib", __FILE__)
4
- require "mq"
4
+ require "amqp"
5
5
 
6
6
  AMQP.start(:host => "localhost") do |connection|
7
7
 
@@ -13,7 +13,7 @@ AMQP.start(:host => "localhost") do |connection|
13
13
  end
14
14
 
15
15
  @counter = 0
16
- amq = MQ.new
16
+ amq = AMQP::Channel.new
17
17
 
18
18
  3.times do
19
19
  amq.queue("") do |queue|
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
 
6
6
  AMQP.start(:host => 'localhost') do |connection|
7
7
 
@@ -18,7 +18,7 @@ AMQP.start(:host => 'localhost') do |connection|
18
18
 
19
19
  # AMQP.logging = true
20
20
 
21
- clock = MQ.new.fanout('clock')
21
+ clock = AMQP::Channel.new.fanout('clock')
22
22
  EM.add_periodic_timer(1) {
23
23
  puts
24
24
 
@@ -26,12 +26,12 @@ AMQP.start(:host => 'localhost') do |connection|
26
26
  clock.publish(Marshal.dump(time))
27
27
  }
28
28
 
29
- amq = MQ.new
29
+ amq = AMQP::Channel.new
30
30
  amq.queue('every second').bind(amq.fanout('clock')).subscribe { |time|
31
31
  log 'every second', :received, Marshal.load(time)
32
32
  }
33
33
 
34
- amq = MQ.new
34
+ amq = AMQP::Channel.new
35
35
  amq.queue('every 5 seconds').bind(amq.fanout('clock')).subscribe { |time|
36
36
  time = Marshal.load(time)
37
37
  log 'every 5 seconds', :received, time if time.strftime('%S').to_i % 5 == 0
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
 
6
6
  AMQP.start(:host => 'localhost') do |connection|
7
7
 
@@ -35,9 +35,9 @@ AMQP.start(:host => 'localhost') do |connection|
35
35
  end
36
36
  end
37
37
 
38
- server = MQ.new.rpc('hash table node', HashTable.new)
38
+ server = AMQP::Channel.new.rpc('hash table node', HashTable.new)
39
39
 
40
- client = MQ.new.rpc('hash table node')
40
+ client = AMQP::Channel.new.rpc('hash table node')
41
41
  client.set(:now, time = Time.now)
42
42
  client.get(:now) do |res|
43
43
  log 'client', :now => res, :eql? => res == time
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
  require 'pp'
6
6
 
7
7
  EM.run do
@@ -10,13 +10,13 @@ EM.run do
10
10
  connection = AMQP.connect(:host => 'localhost', :logging => false)
11
11
 
12
12
  # open a channel on the AMQP connection
13
- channel = MQ.new(connection)
13
+ channel = AMQP::Channel.new(connection)
14
14
 
15
15
  # declare a queue on the channel
16
- queue = MQ::Queue.new(channel, 'queue name')
16
+ queue = AMQP::Channel::Queue.new(channel, 'queue name')
17
17
 
18
18
  # create a fanout exchange
19
- exchange = MQ::Exchange.new(channel, :fanout, 'all queues')
19
+ exchange = AMQP::Channel::Exchange.new(channel, :fanout, 'all queues')
20
20
 
21
21
  # bind the queue to the exchange
22
22
  queue.bind(exchange)
@@ -1,15 +1,15 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
5
- require 'mq/logger'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
+ require 'amqp/logger'
6
6
 
7
- Logger = MQ::Logger
7
+ Logger = AMQP::Channel::Logger
8
8
 
9
9
  AMQP.start(:host => 'localhost') do
10
10
  if ARGV[0] == 'server'
11
11
 
12
- MQ.queue('logger').bind(MQ.fanout('logging', :durable => true)).subscribe { |msg|
12
+ AMQP::Channel.queue('logger').bind(AMQP::Channel.fanout('logging', :durable => true)).subscribe { |msg|
13
13
  msg = Marshal.load(msg)
14
14
  require 'pp'
15
15
  pp(msg)
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
  require 'time'
6
6
 
7
7
  AMQP.start(:host => 'localhost') do |connection|
@@ -19,7 +19,7 @@ AMQP.start(:host => 'localhost') do |connection|
19
19
 
20
20
  #AMQP.logging = true
21
21
 
22
- clock = MQ.new.headers('multiformat_clock')
22
+ clock = AMQP::Channel.new.headers('multiformat_clock')
23
23
  EM.add_periodic_timer(1) {
24
24
  puts
25
25
 
@@ -32,7 +32,7 @@ AMQP.start(:host => 'localhost') do |connection|
32
32
  }
33
33
 
34
34
  ["iso8601", "rfc2822"].each do |format|
35
- amq = MQ.new
35
+ amq = AMQP::Channel.new
36
36
  amq.queue(format.to_s).bind(amq.headers('multiformat_clock'), :arguments => {"format" => format}).subscribe { |time|
37
37
  log "received #{format}", time
38
38
  }
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- $:.unshift File.dirname(__FILE__) + '/../../lib'
4
- require 'mq'
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require 'amqp'
5
5
 
6
6
  AMQP.start(:host => 'localhost') do |connection|
7
7
 
@@ -18,7 +18,7 @@ AMQP.start(:host => 'localhost') do |connection|
18
18
 
19
19
  # AMQP.logging = true
20
20
 
21
- amq = MQ.new
21
+ amq = AMQP::Channel.new
22
22
  EM.add_periodic_timer(1) {
23
23
  puts
24
24
 
@@ -26,13 +26,13 @@ AMQP.start(:host => 'localhost') do |connection|
26
26
  amq.queue('one').publish('ping')
27
27
  }
28
28
 
29
- amq = MQ.new
29
+ amq = AMQP::Channel.new
30
30
  amq.queue('one').subscribe { |msg|
31
31
  log 'one', :received, msg, :sending, 'pong'
32
32
  amq.queue('two').publish('pong')
33
33
  }
34
34
 
35
- amq = MQ.new
35
+ amq = AMQP::Channel.new
36
36
  amq.queue('two').subscribe { |msg|
37
37
  log 'two', :received, msg
38
38
  }