amqp 0.7.5 → 0.8.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/.gitignore +3 -4
  2. data/.travis.yml +3 -5
  3. data/.yardopts +6 -0
  4. data/CHANGELOG +26 -7
  5. data/Gemfile +15 -7
  6. data/README.textile +216 -0
  7. data/Rakefile +0 -6
  8. data/amqp.gemspec +14 -4
  9. data/bin/jenkins.sh +27 -0
  10. data/bin/set_test_suite_realms_up.sh +16 -2
  11. data/docs/VendorSpecificExtensions.textile +32 -0
  12. data/examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb +53 -0
  13. data/examples/hello_world.rb +29 -0
  14. data/examples/real-world/task-queue/README.textile +3 -0
  15. data/examples/real-world/task-queue/consumer.rb +27 -0
  16. data/examples/real-world/task-queue/producer.rb +22 -0
  17. data/examples/various/ack.rb +70 -0
  18. data/examples/various/automatic_binding_for_default_direct_exchange.rb +53 -0
  19. data/examples/various/basic_get.rb +65 -0
  20. data/examples/various/callbacks.rb +45 -0
  21. data/examples/various/clock.rb +74 -0
  22. data/examples/various/declare_a_queue_without_assignment.rb +46 -0
  23. data/examples/various/declare_an_exchange_without_assignment.rb +46 -0
  24. data/examples/various/hashtable.rb +60 -0
  25. data/examples/{logger.rb → various/logger.rb} +9 -7
  26. data/examples/{multiclock.rb → various/multiclock.rb} +15 -17
  27. data/examples/various/open_channel_without_assignment.rb +34 -0
  28. data/examples/various/pingpong.rb +53 -0
  29. data/examples/various/primes-simple.rb +29 -0
  30. data/examples/various/primes.rb +76 -0
  31. data/examples/various/pubsub.rb +43 -0
  32. data/examples/various/queue_status.rb +58 -0
  33. data/examples/various/stocks.rb +59 -0
  34. data/examples/various/weather_updates.rb +63 -0
  35. data/lib/amqp.rb +11 -2
  36. data/lib/amqp/basic_client.rb +23 -54
  37. data/lib/amqp/channel.rb +577 -805
  38. data/lib/amqp/client.rb +37 -275
  39. data/lib/amqp/connection.rb +165 -93
  40. data/lib/amqp/deprecated/fork.rb +15 -0
  41. data/lib/amqp/deprecated/logger.rb +99 -0
  42. data/lib/amqp/deprecated/mq.rb +20 -0
  43. data/lib/amqp/deprecated/rpc.rb +168 -0
  44. data/lib/amqp/exchange.rb +409 -281
  45. data/lib/amqp/extensions/rabbitmq.rb +1 -0
  46. data/lib/amqp/header.rb +41 -17
  47. data/lib/amqp/logger.rb +10 -84
  48. data/lib/amqp/queue.rb +457 -320
  49. data/lib/amqp/rpc.rb +11 -107
  50. data/lib/amqp/version.rb +1 -1
  51. data/lib/mq.rb +2 -1
  52. data/lib/mq/logger.rb +2 -0
  53. data/lib/mq/rpc.rb +2 -0
  54. data/spec/integration/authentication_spec.rb +36 -40
  55. data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +3 -5
  56. data/spec/integration/basic_get_spec.rb +91 -0
  57. data/spec/integration/channel_close_spec.rb +5 -5
  58. data/spec/integration/exchange_declaration_spec.rb +6 -53
  59. data/spec/integration/extensions/basic_return_spec.rb +47 -0
  60. data/spec/integration/queue_declaration_spec.rb +14 -17
  61. data/spec/integration/queue_exclusivity_spec.rb +49 -48
  62. data/spec/integration/reply_queue_communication_spec.rb +6 -4
  63. data/spec/integration/store_and_forward_spec.rb +9 -36
  64. data/spec/integration/topic_subscription_spec.rb +1 -1
  65. data/spec/integration/workload_distribution_spec.rb +1 -0
  66. data/spec/spec_helper.rb +69 -43
  67. data/spec/unit/amqp/connection_spec.rb +27 -23
  68. data/tasks.rb +11 -0
  69. metadata +124 -95
  70. data/README.md +0 -156
  71. data/TODO +0 -30
  72. data/amqp.pre.gemspec +0 -6
  73. data/examples/ack.rb +0 -47
  74. data/examples/automatic_binding_for_default_direct_exchange.rb +0 -65
  75. data/examples/callbacks.rb +0 -40
  76. data/examples/clock.rb +0 -65
  77. data/examples/default_channel.rb +0 -19
  78. data/examples/hashtable.rb +0 -61
  79. data/examples/immediately_bind_a_server_named_queue.rb +0 -38
  80. data/examples/internal.rb +0 -51
  81. data/examples/issues/issue_75.rb +0 -21
  82. data/examples/issues/issue_94.rb +0 -23
  83. data/examples/pingpong.rb +0 -54
  84. data/examples/pop.rb +0 -45
  85. data/examples/primes-simple.rb +0 -21
  86. data/examples/primes.rb +0 -101
  87. data/examples/simple.rb +0 -81
  88. data/examples/stocks.rb +0 -67
  89. data/gemfiles/eventmachine-pre +0 -24
  90. data/lib/amqp/buffer.rb +0 -272
  91. data/lib/amqp/collection.rb +0 -60
  92. data/lib/amqp/frame.rb +0 -68
  93. data/lib/amqp/protocol.rb +0 -163
  94. data/lib/amqp/server.rb +0 -101
  95. data/lib/amqp/spec.rb +0 -832
  96. data/protocol/amqp-0.8.json +0 -617
  97. data/protocol/amqp-0.8.xml +0 -3908
  98. data/protocol/codegen.rb +0 -175
  99. data/protocol/doc.txt +0 -281
  100. data/research/api.rb +0 -52
  101. data/research/primes-forked.rb +0 -65
  102. data/research/primes-processes.rb +0 -137
  103. data/research/primes-threaded.rb +0 -51
  104. data/spec/integration/queue_status_spec.rb +0 -44
  105. data/spec/unit/amqp/buffer_spec.rb +0 -178
  106. data/spec/unit/amqp/client_spec.rb +0 -102
  107. data/spec/unit/amqp/collection_spec.rb +0 -144
  108. data/spec/unit/amqp/frame_spec.rb +0 -60
  109. data/spec/unit/amqp/protocol_spec.rb +0 -51
@@ -14,15 +14,19 @@ describe AMQP, 'class object' do
14
14
  #
15
15
 
16
16
  its(:settings) do
17
+ # TODO: rewrite using key should eql value,
18
+ # it's not very wise to check frame_max etc.
17
19
  should == {
18
- :host => "127.0.0.1",
19
- :port => 5672,
20
- :user => "guest",
21
- :pass => "guest",
22
- :vhost => "/",
23
- :timeout => nil,
24
- :logging => false,
25
- :ssl => false
20
+ :host => "127.0.0.1",
21
+ :port => 5672,
22
+ :user => "guest",
23
+ :pass => "guest",
24
+ :vhost => "/",
25
+ :timeout => nil,
26
+ :logging => false,
27
+ :ssl => false,
28
+ :broker => nil,
29
+ :frame_max => 131072
26
30
  }
27
31
  end
28
32
 
@@ -65,8 +69,6 @@ describe AMQP, 'class object' do
65
69
  @block_fired = true
66
70
 
67
71
  AMQP.connection.should be_connected
68
- AMQP.channel.should_not be_nil
69
- AMQP.channel.connection.should == AMQP.connection
70
72
  end
71
73
  done(0.1) { @block_fired.should be_true }
72
74
  end
@@ -79,7 +81,10 @@ describe AMQP, 'class object' do
79
81
  describe '.stop' do
80
82
  context "when connection is not established" do
81
83
  it 'is a no-op' do
82
- expect { @res = AMQP.stop }.to_not raise_error
84
+ AMQP.stop
85
+ AMQP.stop
86
+
87
+ @res = AMQP.stop
83
88
  @res.should be_nil
84
89
  end # it
85
90
  end # context
@@ -91,26 +96,25 @@ describe AMQP, 'class object' do
91
96
  #
92
97
  #
93
98
 
94
- include EventedSpec::AMQPSpec
95
- after { AMQP.cleanup_state; done }
99
+ include EventedSpec::EMSpec
96
100
  default_options AMQP_OPTS
97
-
98
101
  #
99
102
  # Examples
100
103
  #
101
104
 
102
105
  it 'properly closes AMQP broker connection and fires a callback. Mind the delay!' do
103
- AMQP.start(AMQP_OPTS)
104
- AMQP.connection.should be_connected
106
+ AMQP.start(AMQP_OPTS) do
107
+ AMQP.connection.should be_connected
105
108
 
106
- @block_has_fired = false
109
+ @block_has_fired = false
107
110
 
108
- AMQP.stop do
109
- @block_has_fired = true
110
- end
111
- AMQP.connection.should_not be_nil
112
- done(0.1) do
113
- @block_has_fired.should be_true
111
+ AMQP.stop do
112
+ @block_has_fired = true
113
+ end
114
+ AMQP.connection.should_not be_nil
115
+ done(0.1) do
116
+ @block_has_fired.should be_true
117
+ end
114
118
  end
115
119
  end # it
116
120
  end # context
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env nake
2
+ # encoding: utf-8
3
+
4
+ if RUBY_VERSION =~ /^1.9/
5
+ Encoding.default_internal = Encoding::UTF_8
6
+ Encoding.default_external = Encoding::UTF_8
7
+ end
8
+
9
+
10
+ require "contributors"
11
+ load "contributors.nake"
metadata CHANGED
@@ -1,49 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
- version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 5
10
- version: 0.7.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0.beta1
5
+ prerelease: 6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Aman Gupta
14
9
  - Jakub Stastny aka botanicus
15
10
  - Michael S. Klishin
16
11
  autorequire:
17
12
  bindir: bin
18
- cert_chain: []
19
-
20
- date: 2011-08-31 00:00:00 +04:00
13
+ cert_chain:
14
+ date: 2011-04-17 00:00:00.000000000 +04:00
21
15
  default_executable:
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
24
18
  name: eventmachine
19
+ requirement: &2168991900 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.12.10
25
+ type: :runtime
25
26
  prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
27
+ version_requirements: *2168991900
28
+ - !ruby/object:Gem::Dependency
29
+ name: amq-client
30
+ requirement: &2168991480 !ruby/object:Gem::Requirement
27
31
  none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
35
36
  type: :runtime
36
- version_requirements: *id001
37
+ prerelease: false
38
+ version_requirements: *2168991480
37
39
  description: Asynchronous AMQP 0.9.1 client for Ruby. Built on top of Eventmachine.
38
- email:
40
+ email:
39
41
  - michael@novemberain.com
40
42
  - stastny@101ideas.cz
41
43
  executables: []
42
-
43
44
  extensions: []
44
-
45
- extra_rdoc_files:
46
- - README.md
45
+ extra_rdoc_files:
46
+ - README.textile
47
+ - doc/_index.html
48
+ - doc/AMQP.html
49
+ - doc/class_list.html
47
50
  - doc/EXAMPLE_01_PINGPONG
48
51
  - doc/EXAMPLE_02_CLOCK
49
52
  - doc/EXAMPLE_03_STOCKS
@@ -51,20 +54,28 @@ extra_rdoc_files:
51
54
  - doc/EXAMPLE_05_ACK
52
55
  - doc/EXAMPLE_05_POP
53
56
  - doc/EXAMPLE_06_HASHTABLE
54
- files:
57
+ - doc/file.README.html
58
+ - doc/file.VendorSpecificExtensions.html
59
+ - doc/file_list.html
60
+ - doc/frames.html
61
+ - doc/index.html
62
+ - doc/method_list.html
63
+ - doc/MQ.html
64
+ - doc/top-level-namespace.html
65
+ files:
55
66
  - .gitignore
56
67
  - .rspec
57
68
  - .travis.yml
69
+ - .yardopts
58
70
  - CHANGELOG
59
71
  - CONTRIBUTORS
60
72
  - Gemfile
61
- - README.md
73
+ - README.textile
62
74
  - Rakefile
63
- - TODO
64
75
  - amqp.gemspec
65
- - amqp.pre.gemspec
66
76
  - bin/cleanify.rb
67
77
  - bin/irb
78
+ - bin/jenkins.sh
68
79
  - bin/set_test_suite_realms_up.sh
69
80
  - doc/EXAMPLE_01_PINGPONG
70
81
  - doc/EXAMPLE_02_CLOCK
@@ -73,106 +84,124 @@ files:
73
84
  - doc/EXAMPLE_05_ACK
74
85
  - doc/EXAMPLE_05_POP
75
86
  - doc/EXAMPLE_06_HASHTABLE
76
- - examples/ack.rb
77
- - examples/automatic_binding_for_default_direct_exchange.rb
78
- - examples/callbacks.rb
79
- - examples/clock.rb
80
- - examples/default_channel.rb
81
- - examples/hashtable.rb
82
- - examples/immediately_bind_a_server_named_queue.rb
83
- - examples/internal.rb
84
- - examples/issues/issue_75.rb
85
- - examples/issues/issue_94.rb
86
- - examples/logger.rb
87
- - examples/multiclock.rb
88
- - examples/pingpong.rb
89
- - examples/pop.rb
90
- - examples/primes-simple.rb
91
- - examples/primes.rb
92
- - examples/simple.rb
93
- - examples/stocks.rb
94
- - gemfiles/eventmachine-pre
87
+ - docs/VendorSpecificExtensions.textile
88
+ - examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb
89
+ - examples/hello_world.rb
90
+ - examples/real-world/task-queue/README.textile
91
+ - examples/real-world/task-queue/consumer.rb
92
+ - examples/real-world/task-queue/producer.rb
93
+ - examples/various/ack.rb
94
+ - examples/various/automatic_binding_for_default_direct_exchange.rb
95
+ - examples/various/basic_get.rb
96
+ - examples/various/callbacks.rb
97
+ - examples/various/clock.rb
98
+ - examples/various/declare_a_queue_without_assignment.rb
99
+ - examples/various/declare_an_exchange_without_assignment.rb
100
+ - examples/various/hashtable.rb
101
+ - examples/various/logger.rb
102
+ - examples/various/multiclock.rb
103
+ - examples/various/open_channel_without_assignment.rb
104
+ - examples/various/pingpong.rb
105
+ - examples/various/primes-simple.rb
106
+ - examples/various/primes.rb
107
+ - examples/various/pubsub.rb
108
+ - examples/various/queue_status.rb
109
+ - examples/various/stocks.rb
110
+ - examples/various/weather_updates.rb
95
111
  - lib/amqp.rb
96
112
  - lib/amqp/basic_client.rb
97
- - lib/amqp/buffer.rb
98
113
  - lib/amqp/channel.rb
99
114
  - lib/amqp/client.rb
100
- - lib/amqp/collection.rb
101
115
  - lib/amqp/connection.rb
116
+ - lib/amqp/deprecated/fork.rb
117
+ - lib/amqp/deprecated/logger.rb
118
+ - lib/amqp/deprecated/mq.rb
119
+ - lib/amqp/deprecated/rpc.rb
102
120
  - lib/amqp/exceptions.rb
103
121
  - lib/amqp/exchange.rb
104
122
  - lib/amqp/ext/em.rb
105
123
  - lib/amqp/ext/emfork.rb
106
- - lib/amqp/frame.rb
124
+ - lib/amqp/extensions/rabbitmq.rb
107
125
  - lib/amqp/header.rb
108
126
  - lib/amqp/logger.rb
109
- - lib/amqp/protocol.rb
110
127
  - lib/amqp/queue.rb
111
128
  - lib/amqp/rpc.rb
112
- - lib/amqp/server.rb
113
- - lib/amqp/spec.rb
114
129
  - lib/amqp/version.rb
115
130
  - lib/mq.rb
116
- - protocol/amqp-0.8.json
117
- - protocol/amqp-0.8.xml
118
- - protocol/codegen.rb
119
- - protocol/doc.txt
120
- - research/api.rb
121
- - research/primes-forked.rb
122
- - research/primes-processes.rb
123
- - research/primes-threaded.rb
131
+ - lib/mq/logger.rb
132
+ - lib/mq/rpc.rb
124
133
  - spec/integration/authentication_spec.rb
125
134
  - spec/integration/automatic_binding_for_default_direct_exchange_spec.rb
135
+ - spec/integration/basic_get_spec.rb
126
136
  - spec/integration/channel_close_spec.rb
127
137
  - spec/integration/exchange_declaration_spec.rb
138
+ - spec/integration/extensions/basic_return_spec.rb
128
139
  - spec/integration/queue_declaration_spec.rb
129
140
  - spec/integration/queue_exclusivity_spec.rb
130
- - spec/integration/queue_status_spec.rb
131
141
  - spec/integration/reply_queue_communication_spec.rb
132
142
  - spec/integration/store_and_forward_spec.rb
133
143
  - spec/integration/topic_subscription_spec.rb
134
144
  - spec/integration/workload_distribution_spec.rb
135
145
  - spec/spec_helper.rb
136
146
  - spec/unit/amqp/basic_spec.rb
137
- - spec/unit/amqp/buffer_spec.rb
138
- - spec/unit/amqp/client_spec.rb
139
- - spec/unit/amqp/collection_spec.rb
140
147
  - spec/unit/amqp/connection_spec.rb
141
- - spec/unit/amqp/frame_spec.rb
142
- - spec/unit/amqp/protocol_spec.rb
148
+ - tasks.rb
149
+ - doc/_index.html
150
+ - doc/AMQP.html
151
+ - doc/class_list.html
152
+ - doc/file.README.html
153
+ - doc/file.VendorSpecificExtensions.html
154
+ - doc/file_list.html
155
+ - doc/frames.html
156
+ - doc/index.html
157
+ - doc/method_list.html
158
+ - doc/MQ.html
159
+ - doc/top-level-namespace.html
143
160
  has_rdoc: true
144
161
  homepage: http://github.com/ruby-amqp/amqp
145
162
  licenses: []
146
-
147
- post_install_message:
148
- rdoc_options:
149
- - --include=examples --main README.md
150
- require_paths:
163
+ post_install_message: ! "[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel.new now accepts
164
+ (an optional) block and yields newly opened channel to it as soon as\n[\e[32mVersion
165
+ 0.8.0\e[0m] [API] AMQP::Header#ack now can acknowledge multiple deliveries\n[\e[32mVersion
166
+ 0.8.0\e[0m] [API] AMQP::Exchange#delete now takes (an optional) block that is called
167
+ when exchange.delete-ok response arrives.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Header
168
+ now implements #to_hash\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#pop block
169
+ now can take 1, 2 or 7 (that's right) arguments.\n[\e[32mVersion 0.8.0\e[0m] [API]
170
+ AMQP::Queue#purge now takes an optional block which is called when queue.purge-ok
171
+ response arrives.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#delete now takes
172
+ an optional block which is called when queue.delete-ok response arrives.\n[\e[32mVersion
173
+ 0.8.0\e[0m] [API] AMQP::Queue#delete now accepts :nowait option.\n[\e[32mVersion
174
+ 0.8.0\e[0m] [API] AMQP::Queue#unbind now takes an optional block which is called
175
+ when queue.unbind-ok response arrives.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#unbind
176
+ now accepts :routing_key as alias to :key. we believe it is a good idea to use AMQP
177
+ terms.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel#prefetch now takes (an optional)
178
+ 2nd parameter that specifies\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel#recover
179
+ now takes (an optional) callback that is called when\n[\e[32mVersion 0.8.0\e[0m]
180
+ [API] AMQP::Frame is gone.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Buffer is gone.
181
+ Serialization & framing are now handled primarily by amq-protocol.\n[\e[32mVersion
182
+ 0.8.0\e[0m] [FEATURE] AMQP gem is now AMQP 0.9.1 compatible: it runs atop of amq-client
183
+ gem\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#publish is deprecated.\n[\e[32mVersion
184
+ 0.8.0\e[0m] [API] Name argument for AMQP::Queue.new and Channel#queue is optional.\n"
185
+ rdoc_options:
186
+ - --include=examples --main README.textile
187
+ require_paths:
151
188
  - lib
152
- required_ruby_version: !ruby/object:Gem::Requirement
189
+ required_ruby_version: !ruby/object:Gem::Requirement
153
190
  none: false
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- hash: 3
158
- segments:
159
- - 0
160
- version: "0"
161
- required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
196
  none: false
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- hash: 3
167
- segments:
168
- - 0
169
- version: "0"
197
+ requirements:
198
+ - - ! '>'
199
+ - !ruby/object:Gem::Version
200
+ version: 1.3.1
170
201
  requirements: []
171
-
172
202
  rubyforge_project: amqp
173
203
  rubygems_version: 1.6.2
174
204
  signing_key:
175
205
  specification_version: 3
176
206
  summary: AMQP client implementation in Ruby/EventMachine.
177
207
  test_files: []
178
-
data/README.md DELETED
@@ -1,156 +0,0 @@
1
- What AMQP gem is
2
- ===================
3
-
4
- Simple asynchronous AMQP driver for Ruby/EventMachine
5
- This library works with Ruby 1.8, Ruby 1.9, JRuby and Rubinius, and is licensed under [the Ruby License](http://www.ruby-lang.org/en/LICENSE.txt).
6
-
7
- This library was tested primarily with RabbitMQ, although it should be compatible with any
8
- server implementing the [AMQP 0-8 spec](http://www.amqp.org/confluence/download/attachments/720900/amqp0-8.pdf).
9
-
10
- Getting started
11
- ===============
12
-
13
- To use examples with RabbitMQ, first [install the broker](http://www.rabbitmq.com/install.html). If you have Mercurial
14
- and Erlang/OTP installed, here is how to do it in 4 lines:
15
-
16
- hg clone http://hg.rabbitmq.com/rabbitmq-codegen
17
- hg clone http://hg.rabbitmq.com/rabbitmq-server
18
- cd rabbitmq-server
19
- make run
20
-
21
- Then have a look at the various bundled examples:
22
-
23
- ruby examples/mq/pingpong.rb # 1-1 communication using amq.direct
24
- ruby examples/mq/clock.rb # 1-N communication using amq.fanout
25
- ruby examples/mq/stocks.rb # 1-subscriber communication using amq.topic
26
-
27
- ruby examples/mq/multiclock.rb # header based routing (new rabbitmq feature)
28
- ruby examples/mq/ack.rb # using ack
29
- ruby examples/mq/pop.rb # pop off messages one at a time
30
-
31
- ruby examples/mq/hashtable.rb # simple async rpc layer
32
- ruby examples/mq/primes.rb 4 # parallelized prime number generation
33
- ruby examples/mq/logger.rb # simple logging api
34
-
35
- For high level API documentation see MQ class.
36
- For more details into the lower level AMQP client API, run the simple client example:
37
-
38
- ruby examples/amqp/simple.rb # low-level AMQP api
39
- ruby examples/mq/internal.rb # low-level Queue/Exchange api
40
-
41
- Or refer to protocol/doc.txt, which enumerates packets sent between a server and client
42
- during a typical session, in both binary and decoded formats.
43
-
44
- How to use AMQP gem with Ruby on Rails, Merb, Sinatra and other web frameworks
45
- ==============================================================================
46
-
47
- To use AMQP gem from web applications, you would need to have EventMachine reactor running.
48
- If you use [Thin](http://code.macournoyer.com/thin/), you are all set: Thin uses EventMachine under
49
- the hood.
50
-
51
- With other web servers, you need to start EventMachine reactor in it's own thread like this:
52
-
53
- Thread.new { EM.run }
54
-
55
- because otherwise EventMachine will block current thread. Then connect to AMQP broker:
56
-
57
- AMQP.connect(:host => "localhost", :user => "guest", :pass => "guest", :vhost => "/")
58
-
59
- In a Ruby on Rails app, probably the best place for this code is initializer
60
- (like config/initializers/amqp.rb). For Merb apps, it is config/init.rb. For
61
- Sinatra and pure Rack applications, place it next to other configuration
62
- code.
63
-
64
- If you want to integrate AMQP with Thin or another EventMachine-based software which already runs an event loop, you might want to use following code:
65
-
66
- EM.next_tick { AMQP.connect(...) }
67
-
68
- So in case the reactor isn't running yet (which seems to be the case with Ruby on Rails 3.x and Thin combination), it won't fail, but wait when the reactor is started (see [issue #21](https://github.com/tmm1/amqp/issues/21)).
69
-
70
- Same separate thread technique can be used to make EventMachine play nicely with other
71
- libraries that would block current thread (like [File::Tail](http://rubygems.org/gems/file-tail)).
72
-
73
- Links
74
- ==============================
75
-
76
- * [RDoc](http://rubydoc.info/github/ruby-amqp/amqp/master/file/README.md)
77
- * Jabber chat [amqp-dev@conf.netlab.cz](xmpp://amqp-dev@conf.netlab.cz)
78
- * [AMQP gem mailing list](http://groups.google.com/group/ruby-amqp)
79
- * [AMQP gem at GitHub](http://github.com/amqp-dev/amqp)
80
- * [AMQP gem at Gemcutter](http://rubygems.org/gems/amqp)
81
- * [Jenkins CI Server](http://jenkins.101ideas.cz/job/AMQP)
82
-
83
- Contributions
84
- ============================
85
-
86
- All the dependencies are specified in <code>Gemfile</code>, so if you have [Bundler](http://gembundler.com), you can just run <code>bundle install</code>.
87
-
88
- The <code>lib/amqp/spec.rb</code> file is generated automatically based on the [AMQP specification](http://www.amqp.org/confluence/display/AMQP/AMQP+Specification). To generate it:
89
-
90
- rake codegen
91
-
92
- For running specs, use <code>rake spec</code>.
93
-
94
- Credits and more information
95
- ============================
96
-
97
- * The Original Code is tmm1/amqp.
98
- * The Initial Developer of the Original Code is Aman Gupta.
99
- * Copyright (c) 2008 - 2010 [Aman Gupta](http://github.com/tmm1) (tmm1).
100
- * Contributions from Jakub Stastny are Copyright (c) 2011 VMware, Inc.
101
-
102
- Current maintainer: [Jakub Stastny](http://github.com/botanicus) aka [botanicus](http://twitter.com/botanicus).
103
-
104
- This project was inspired by [py-amqplib](http://barryp.org/software/py-amqplib/), [rabbitmq](http://rabbitmq.com), [qpid](http://qpid.apache.org/) and [rubbyt](http://github.com/rubbyt/rubbyt).
105
- Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
106
-
107
- AMQP brokers
108
- ------------
109
-
110
- * [RabbitMQ](http://rabbitmq.com) (Rabbit Technologies, Erlang/OTP, MPL)
111
- * [OpenAMQ](http://openamq.org) (iMatix, C, GPL2)
112
- * [ActiveMQ](http://activemq.apache.org) (Apache Foundation, Java, Apache2)
113
-
114
- AMQP resources
115
- --------------
116
-
117
- * Steve Vinoski [explains AMQP](http://steve.vinoski.net/pdf/IEEE-Advanced_Message_Queuing_Protocol.pdf) in his column, Towards Integration
118
-
119
- * John O'Hara on [the history of AMQP](http://www.acmqueue.org/modules.php?name=Content&pa=showpage&pid=485)
120
-
121
- * Dmitriy's [presentation on RabbitMQ/AMQP](http://somic-org.homelinux.org/blog/2008/07/31/slides-for-my-amqprabbitmq-talk/)
122
-
123
- * ZeroMQ's [analysis of the messaging technology market](http://www.zeromq.org/whitepapers:market-analysis)
124
-
125
- * Pieter Hintjens's [background to AMQP](http://www.openamq.org/doc:amqp-background)
126
-
127
- * Barry Pederson's [py-amqplib](http://barryp.org/software/py-amqplib/)
128
-
129
- * Ben Hood on [writing an AMQP client](http://hopper.squarespace.com/blog/2008/6/21/build-your-own-amqp-client.html)
130
-
131
- * Dmitriy Samovskiy introduces [Ruby + QPid + RabbitMQ](http://somic-org.homelinux.org/blog/2008/06/24/ruby-amqp-rabbitmq-example/)
132
-
133
- * Ben Hood's [as3-amqp](http://github.com/0x6e6562/as3-amqp) ([two](http://hopper.squarespace.com/blog/2008/7/4/server-side-as3.html), [three](http://hopper.squarespace.com/blog/2008/3/24/as3-amqp-client-first-cut.html))
134
-
135
- * RabbitMQ's [AMQP protocol code generator](http://hg.rabbitmq.com/rabbitmq-codegen/)
136
-
137
- * Erlang Exchange [presentation on the implementation of RabbitMQ](http://skillsmatter.com/podcast/erlang/presenting-rabbitmq-an-erlang-based-implementatio-nof-amqp) (and on the [LShift blog](http://www.lshift.net/blog/2008/07/01/slides-from-our-erlang-exchange-talk))
138
-
139
- * Jonathan Conway's series on RabbitMQ and using it with Ruby and Merb: [One](http://jaikoo.com/2007/9/4/didn-t-you-get-the-memo), [Two](http://jaikoo.com/2008/2/29/friday-round-up-2008-02-29), [Three](http://jaikoo.com/2008/3/14/oh-hai-rabbitmq), [Four](http://jaikoo.com/2008/3/20/daemonize-rabbitmq)
140
-
141
- * Open Enterprise's series on messaging middleware and AMQP: [Part 1](http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-1.html), [Part 2](http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-2.html), [Part 3](http://www1.interopsystems.com/analysis/can-amqp-break-ibms-mom-monopoly-part-3.html)
142
-
143
- Messaging and distributed systems resources
144
- -------------------------------------------
145
-
146
- * [A Critique of the Remote Procedure Call Paradigm](http://www.cs.vu.nl/~ast/publications/euteco-1988.pdf)
147
-
148
- * [A Note on Distributed Computing](http://research.sun.com/techrep/1994/smli_tr-94-29.pdf)
149
-
150
- * [Convenience Over Correctness](http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf)
151
-
152
- * [Metaprotocol Taxonomy and Communications Patterns](http://hessian.caucho.com/doc/metaprotocol-taxonomy.xtp)
153
-
154
- * Joe Armstrong on [Erlang messaging vs RPC](http://armstrongonsoftware.blogspot.com/2008/05/road-we-didnt-go-down.html)
155
-
156
- * [SEDA: scalable internet services using message queues](http://www.eecs.harvard.edu/~mdw/papers/seda-sosp01.pdf)