amqp 0.8.0.rc12 → 0.8.0.rc13
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/.yardopts +2 -1
- data/CONTRIBUTORS +29 -22
- data/Gemfile +2 -1
- data/README.md +241 -0
- data/amqp.gemspec +7 -5
- data/bin/set_test_suite_realms_up.sh +6 -6
- data/docs/08Migration.textile +3 -1
- data/docs/Bindings.textile +3 -1
- data/docs/Clustering.textile +4 -0
- data/docs/ConnectingToTheBroker.textile +108 -86
- data/docs/ConnectionEncryptionWithTLS.textile +3 -1
- data/docs/DocumentationGuidesIndex.textile +24 -2
- data/docs/Durability.textile +22 -1
- data/docs/ErrorHandling.textile +21 -1
- data/docs/Exchanges.textile +181 -9
- data/docs/GettingStarted.textile +65 -167
- data/docs/Queues.textile +400 -355
- data/docs/RabbitMQVersions.textile +34 -3
- data/docs/Routing.textile +4 -1
- data/docs/RunningTests.textile +116 -0
- data/docs/Troubleshooting.textile +131 -0
- data/docs/VendorSpecificExtensions.textile +20 -0
- data/examples/channels/qos_aka_prefetch.rb +3 -3
- data/examples/channels/qos_aka_prefetch_without_callback.rb +2 -2
- data/examples/error_handling/channel_level_exception.rb +1 -1
- data/examples/error_handling/channel_level_exception_with_multiple_channels_involved.rb +1 -0
- data/examples/error_handling/connection_level_exception.rb +26 -0
- data/examples/error_handling/global_channel_level_exception_handler.rb +3 -3
- data/examples/exchanges/autodeletion_of_exchanges.rb +37 -0
- data/examples/extensions/rabbitmq/per_queue_message_ttl.rb +3 -3
- data/examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb +2 -2
- data/examples/guides/getting_started/{03_babblr.rb → 03_blabbr.rb} +0 -0
- data/examples/guides/queues/01a_declaring_a_server_named_queue_using_queue_constructor.rb +18 -0
- data/examples/guides/queues/01b_declaring_a_queue_using_queue_constructor.rb +18 -0
- data/examples/guides/queues/02a_declaring_a_durable_shared_queue.rb +18 -0
- data/examples/guides/queues/02b_declaring_a_durable_shared_queue.rb +18 -0
- data/examples/guides/queues/03a_declaring_a_temporary_exclusive_queue.rb +19 -0
- data/examples/guides/queues/03b_declaring_a_temporary_exclusive_queue.rb +18 -0
- data/examples/guides/queues/{05_binding_a_queue_using_exchange_instance.rb → 04_bind_a_queue_using_exchange_instance.rb} +2 -2
- data/examples/guides/queues/{06_biding_a_queue_using_exchange_name_string.rb → 05_bind_a_queue_using_exchange_name.rb} +2 -2
- data/examples/guides/queues/{07_subscribing_to_receive_messages.rb → 06_subscribe_to_receive_messages.rb} +1 -1
- data/examples/guides/queues/{08_poll_for_messages.rb → 07_fetch_a_message_from_the_queue.rb} +1 -1
- data/examples/guides/queues/{09_unsubscribing_a_consumer.rb → 08_unsubscribing_a_consumer.rb} +0 -0
- data/examples/guides/queues/{10_unbinding_from_exchange.rb → 09_unbinding_from_exchange.rb} +2 -2
- data/examples/guides/queues/{11_purge_a_queue.rb → 10_purge_a_queue.rb} +2 -2
- data/examples/guides/queues/{12_deleting_a_queue.rb → 11_deleting_a_queue.rb} +2 -2
- data/examples/hello_world.rb +1 -1
- data/examples/hello_world_with_an_empty_string.rb +33 -0
- data/examples/issues/amq_client_issue_7.rb +31 -0
- data/examples/issues/amq_protocol_issue_14.rb +46 -0
- data/examples/issues/issue_75.rb +23 -0
- data/examples/issues/issue_79.rb +35 -0
- data/examples/issues/issue_80.rb +40 -0
- data/examples/publishing/{publishing_and_immediately_stopping_event_loop.rb → publishing_a_one_off_message.rb} +9 -12
- data/examples/publishing/publishing_callback.rb +52 -0
- data/examples/publishing/returned_messages.rb +3 -3
- data/examples/queues/accessing_message_metadata.rb +60 -0
- data/examples/queues/queue_status.rb +0 -7
- data/examples/queues/rejecting_messages_without_requeueuing.rb +47 -0
- data/examples/queues/using_explicit_acknowledgements.rb +96 -0
- data/examples/routing/headers_routing.rb +54 -0
- data/lib/amqp/channel.rb +245 -40
- data/lib/amqp/client.rb +23 -11
- data/lib/amqp/exchange.rb +58 -41
- data/lib/amqp/queue.rb +66 -13
- data/lib/amqp/version.rb +1 -1
- data/spec/integration/authentication_spec.rb +5 -5
- data/spec/integration/basic_get_spec.rb +1 -1
- data/spec/integration/channel_close_spec.rb +10 -3
- data/spec/integration/queue_declaration_spec.rb +26 -5
- data/spec/integration/topic_subscription_spec.rb +1 -1
- data/spec/unit/amqp/client_spec.rb +7 -54
- data/tasks.rb +1 -8
- metadata +64 -23
- data/README.textile +0 -229
@@ -53,33 +53,6 @@ describe AMQP::Client do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
context "when URI ends in two consecutive slashes (//)" do
|
57
|
-
it "parses vhost as /" do
|
58
|
-
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com//")
|
59
|
-
|
60
|
-
val[:host].should == "dev.rabbitmq.com"
|
61
|
-
val[:port].should == 5672
|
62
|
-
val[:scheme].should == "amqp"
|
63
|
-
val[:ssl].should be_false
|
64
|
-
val[:vhost].should == "/"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
context "when URI ends in //vault" do
|
70
|
-
it "parses vhost as /vault" do
|
71
|
-
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com//vault")
|
72
|
-
|
73
|
-
val[:host].should == "dev.rabbitmq.com"
|
74
|
-
val[:port].should == 5672
|
75
|
-
val[:scheme].should == "amqp"
|
76
|
-
val[:ssl].should be_false
|
77
|
-
val[:vhost].should == "/vault"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
56
|
context "when URI ends in /%2Fvault" do
|
84
57
|
it "parses vhost as /vault" do
|
85
58
|
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/%2Fvault")
|
@@ -93,41 +66,21 @@ describe AMQP::Client do
|
|
93
66
|
end
|
94
67
|
|
95
68
|
|
96
|
-
context "when URI is amqp://dev.rabbitmq.com/
|
97
|
-
it "parses vhost as
|
98
|
-
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/
|
99
|
-
|
100
|
-
val[:host].should == "dev.rabbitmq.com"
|
101
|
-
val[:port].should == 5672
|
102
|
-
val[:scheme].should == "amqp"
|
103
|
-
val[:ssl].should be_false
|
104
|
-
val[:vhost].should == "i.am.a.vhost.without.slashes"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
context "when URI is amqp://dev.rabbitmq.com/production" do
|
110
|
-
it "parses vhost as production" do
|
111
|
-
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/production")
|
69
|
+
context "when URI is amqp://dev.rabbitmq.com/a.path.without.slashes" do
|
70
|
+
it "parses vhost as a.path.without.slashes" do
|
71
|
+
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/a.path.without.slashes")
|
112
72
|
|
113
73
|
val[:host].should == "dev.rabbitmq.com"
|
114
74
|
val[:port].should == 5672
|
115
75
|
val[:scheme].should == "amqp"
|
116
76
|
val[:ssl].should be_false
|
117
|
-
val[:vhost].should == "
|
77
|
+
val[:vhost].should == "a.path.without.slashes"
|
118
78
|
end
|
119
79
|
end
|
120
80
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com///a/b/c/d")
|
125
|
-
|
126
|
-
val[:host].should == "dev.rabbitmq.com"
|
127
|
-
val[:port].should == 5672
|
128
|
-
val[:scheme].should == "amqp"
|
129
|
-
val[:ssl].should be_false
|
130
|
-
val[:vhost].should == "//a/b/c/d"
|
81
|
+
context "when URI is amqp://dev.rabbitmq.com/a/path/with/slashes" do
|
82
|
+
it "raises an ArgumentError" do
|
83
|
+
lambda { described_class.parse_connection_uri("amqp://dev.rabbitmq.com/a/path/with/slashes") }.should raise_error(ArgumentError)
|
131
84
|
end
|
132
85
|
end
|
133
86
|
|
data/tasks.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
|
-
#!/usr/bin/env nake
|
1
|
+
#!/usr/bin/env bundle exec nake
|
2
2
|
# encoding: utf-8
|
3
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
4
|
load "contributors.nake"
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424143
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 0.8.0.
|
11
|
+
- 13
|
12
|
+
version: 0.8.0.rc13
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Aman Gupta
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2011-
|
22
|
+
date: 2011-06-04 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: eventmachine
|
@@ -43,17 +43,35 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
hash: -
|
46
|
+
hash: -3702664344
|
47
47
|
segments:
|
48
48
|
- 0
|
49
49
|
- 7
|
50
50
|
- 0
|
51
51
|
- alpha
|
52
|
-
-
|
53
|
-
version: 0.7.0.
|
52
|
+
- 34
|
53
|
+
version: 0.7.0.alpha34
|
54
54
|
type: :runtime
|
55
55
|
version_requirements: *id002
|
56
|
-
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: amq-protocol
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: -3702664416
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
- 7
|
68
|
+
- 0
|
69
|
+
- alpha
|
70
|
+
- 6
|
71
|
+
version: 0.7.0.alpha6
|
72
|
+
type: :runtime
|
73
|
+
version_requirements: *id003
|
74
|
+
description: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included.
|
57
75
|
email:
|
58
76
|
- michael@novemberain.com
|
59
77
|
- stastny@101ideas.cz
|
@@ -62,7 +80,7 @@ executables: []
|
|
62
80
|
extensions: []
|
63
81
|
|
64
82
|
extra_rdoc_files:
|
65
|
-
- README.
|
83
|
+
- README.md
|
66
84
|
- docs/08Migration.textile
|
67
85
|
- docs/Bindings.textile
|
68
86
|
- docs/Clustering.textile
|
@@ -76,6 +94,8 @@ extra_rdoc_files:
|
|
76
94
|
- docs/Queues.textile
|
77
95
|
- docs/RabbitMQVersions.textile
|
78
96
|
- docs/Routing.textile
|
97
|
+
- docs/RunningTests.textile
|
98
|
+
- docs/Troubleshooting.textile
|
79
99
|
- docs/VendorSpecificExtensions.textile
|
80
100
|
files:
|
81
101
|
- .gitignore
|
@@ -85,7 +105,7 @@ files:
|
|
85
105
|
- CHANGELOG
|
86
106
|
- CONTRIBUTORS
|
87
107
|
- Gemfile
|
88
|
-
- README.
|
108
|
+
- README.md
|
89
109
|
- Rakefile
|
90
110
|
- amqp.gemspec
|
91
111
|
- bin/cleanify.rb
|
@@ -104,6 +124,8 @@ files:
|
|
104
124
|
- docs/Queues.textile
|
105
125
|
- docs/RabbitMQVersions.textile
|
106
126
|
- docs/Routing.textile
|
127
|
+
- docs/RunningTests.textile
|
128
|
+
- docs/Troubleshooting.textile
|
107
129
|
- docs/VendorSpecificExtensions.textile
|
108
130
|
- examples/channels/open_channel_with_one_arity_callback.rb
|
109
131
|
- examples/channels/open_channel_without_assignment.rb
|
@@ -114,6 +136,7 @@ files:
|
|
114
136
|
- examples/deprecated/default_thread_local_channel_instance.rb
|
115
137
|
- examples/error_handling/channel_level_exception.rb
|
116
138
|
- examples/error_handling/channel_level_exception_with_multiple_channels_involved.rb
|
139
|
+
- examples/error_handling/connection_level_exception.rb
|
117
140
|
- examples/error_handling/connection_loss_handler.rb
|
118
141
|
- examples/error_handling/global_channel_level_exception_handler.rb
|
119
142
|
- examples/error_handling/handling_authentication_failure_with_a_callback.rb
|
@@ -121,24 +144,37 @@ files:
|
|
121
144
|
- examples/error_handling/handling_vhost_misconfiguration_with_a_rescue_block.rb
|
122
145
|
- examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
|
123
146
|
- examples/error_handling/tcp_connection_failure_with_a_callback.rb
|
147
|
+
- examples/exchanges/autodeletion_of_exchanges.rb
|
124
148
|
- examples/exchanges/declare_an_exchange_without_assignment.rb
|
125
149
|
- examples/extensions/rabbitmq/per_queue_message_ttl.rb
|
126
150
|
- examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb
|
127
151
|
- examples/guides/getting_started/01_hello_world.rb
|
128
152
|
- examples/guides/getting_started/02_hello_world_dslified.rb
|
129
|
-
- examples/guides/getting_started/
|
153
|
+
- examples/guides/getting_started/03_blabbr.rb
|
130
154
|
- examples/guides/getting_started/04_weathr.rb
|
131
|
-
- examples/guides/queues/
|
132
|
-
- examples/guides/queues/
|
133
|
-
- examples/guides/queues/
|
134
|
-
- examples/guides/queues/
|
135
|
-
- examples/guides/queues/
|
136
|
-
- examples/guides/queues/
|
137
|
-
- examples/guides/queues/
|
138
|
-
- examples/guides/queues/
|
155
|
+
- examples/guides/queues/01a_declaring_a_server_named_queue_using_queue_constructor.rb
|
156
|
+
- examples/guides/queues/01b_declaring_a_queue_using_queue_constructor.rb
|
157
|
+
- examples/guides/queues/02a_declaring_a_durable_shared_queue.rb
|
158
|
+
- examples/guides/queues/02b_declaring_a_durable_shared_queue.rb
|
159
|
+
- examples/guides/queues/03a_declaring_a_temporary_exclusive_queue.rb
|
160
|
+
- examples/guides/queues/03b_declaring_a_temporary_exclusive_queue.rb
|
161
|
+
- examples/guides/queues/04_bind_a_queue_using_exchange_instance.rb
|
162
|
+
- examples/guides/queues/05_bind_a_queue_using_exchange_name.rb
|
163
|
+
- examples/guides/queues/06_subscribe_to_receive_messages.rb
|
164
|
+
- examples/guides/queues/07_fetch_a_message_from_the_queue.rb
|
165
|
+
- examples/guides/queues/08_unsubscribing_a_consumer.rb
|
166
|
+
- examples/guides/queues/09_unbinding_from_exchange.rb
|
167
|
+
- examples/guides/queues/10_purge_a_queue.rb
|
168
|
+
- examples/guides/queues/11_deleting_a_queue.rb
|
139
169
|
- examples/hello_world.rb
|
170
|
+
- examples/hello_world_with_an_empty_string.rb
|
140
171
|
- examples/hello_world_with_eventmachine_in_a_separate_thread.rb
|
141
172
|
- examples/hello_world_with_large_payload.rb
|
173
|
+
- examples/issues/amq_client_issue_7.rb
|
174
|
+
- examples/issues/amq_protocol_issue_14.rb
|
175
|
+
- examples/issues/issue_75.rb
|
176
|
+
- examples/issues/issue_79.rb
|
177
|
+
- examples/issues/issue_80.rb
|
142
178
|
- examples/legacy/ack.rb
|
143
179
|
- examples/legacy/callbacks.rb
|
144
180
|
- examples/legacy/clock.rb
|
@@ -149,18 +185,23 @@ files:
|
|
149
185
|
- examples/legacy/primes-simple.rb
|
150
186
|
- examples/legacy/primes.rb
|
151
187
|
- examples/legacy/stocks.rb
|
152
|
-
- examples/publishing/
|
188
|
+
- examples/publishing/publishing_a_one_off_message.rb
|
189
|
+
- examples/publishing/publishing_callback.rb
|
153
190
|
- examples/publishing/returned_messages.rb
|
154
191
|
- examples/publishing/simplistic_scatter_gather.rb
|
192
|
+
- examples/queues/accessing_message_metadata.rb
|
155
193
|
- examples/queues/automatic_binding_for_default_direct_exchange.rb
|
156
194
|
- examples/queues/basic_get.rb
|
157
195
|
- examples/queues/declare_a_queue_without_assignment.rb
|
158
196
|
- examples/queues/declare_and_bind_a_server_named_queue.rb
|
159
197
|
- examples/queues/queue_status.rb
|
198
|
+
- examples/queues/rejecting_messages_without_requeueuing.rb
|
199
|
+
- examples/queues/using_explicit_acknowledgements.rb
|
160
200
|
- examples/rack/publish_a_message_on_request/thin.ru
|
161
201
|
- examples/real-world/task-queue/README.textile
|
162
202
|
- examples/real-world/task-queue/consumer.rb
|
163
203
|
- examples/real-world/task-queue/producer.rb
|
204
|
+
- examples/routing/headers_routing.rb
|
164
205
|
- examples/routing/pubsub.rb
|
165
206
|
- examples/routing/weather_updates.rb
|
166
207
|
- examples/tls_certificates/client/cert.pem
|
@@ -269,7 +310,7 @@ post_install_message: "[\e[32mVersion 0.8.0\e[0m] [API] Connection URI (string)
|
|
269
310
|
[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#publish is deprecated.\n\
|
270
311
|
[\e[32mVersion 0.8.0\e[0m] [API] Name argument for AMQP::Queue.new and Channel#queue is optional.\n"
|
271
312
|
rdoc_options:
|
272
|
-
- --include=examples --main README.
|
313
|
+
- --include=examples --main README.md
|
273
314
|
require_paths:
|
274
315
|
- lib
|
275
316
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -295,9 +336,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
336
|
requirements: []
|
296
337
|
|
297
338
|
rubyforge_project: amqp
|
298
|
-
rubygems_version: 1.8.
|
339
|
+
rubygems_version: 1.8.5
|
299
340
|
signing_key:
|
300
341
|
specification_version: 3
|
301
|
-
summary: AMQP client
|
342
|
+
summary: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included
|
302
343
|
test_files: []
|
303
344
|
|
data/README.textile
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
h1. About amqp gem "!http://travis-ci.org/ruby-amqp/amqp.png!":http://travis-ci.org/ruby-amqp/amqp
|
2
|
-
|
3
|
-
amqp gem is a widely used, feature-rich, well-maintained asynchronous AMQP 0.9.1 client with batteries included.
|
4
|
-
This library works with Ruby 1.8.7 (p174 and p334), Ruby 1.9.2, JRuby, REE and Rubinius, and is
|
5
|
-
licensed under the "Ruby License":http://www.ruby-lang.org/en/LICENSE.txt.
|
6
|
-
Versions 0.8.0 and later of amqp gem implement "AMQP 0.9.1":http://bit.ly/hw2ELX.
|
7
|
-
|
8
|
-
|
9
|
-
h2. I know what AMQP is, how do I get started?
|
10
|
-
|
11
|
-
See "Getting started with amqp gem" and "Documentation: tutorials, guides & API reference" sections below.
|
12
|
-
|
13
|
-
|
14
|
-
h2. What is AMQP?
|
15
|
-
|
16
|
-
AMQP is an "open standard for messaging middleware":http://www.amqp.org/confluence/display/AMQP/About+AMQP that
|
17
|
-
emphasizes interoperability between different technologies (for example, Java, .NET,
|
18
|
-
Ruby, Python, C and so on).
|
19
|
-
|
20
|
-
Key features of AMQP are very flexible yet simple routing and binary protocol
|
21
|
-
efficiency.
|
22
|
-
|
23
|
-
|
24
|
-
h2. What is amqp gem good for?
|
25
|
-
|
26
|
-
One can use amqp gem to make Ruby applications interoperate with other
|
27
|
-
applications (both Ruby and not). Complexity and size may vary from
|
28
|
-
simple work queues to complex multi-stage data processing workflows that involve
|
29
|
-
dozens or hundreds of applications built with all kinds of technologies.
|
30
|
-
|
31
|
-
Specific examples:
|
32
|
-
|
33
|
-
* A Web application may route messages to a Java app that works
|
34
|
-
with SMS delivery gateways.
|
35
|
-
|
36
|
-
* Periodically run (Cron-driven) application may notify other systems that
|
37
|
-
there are some new results.
|
38
|
-
|
39
|
-
* Content aggregators may update full-text search and geospatial search indexes
|
40
|
-
by delegating actual indexing work to other applications over AMQP.
|
41
|
-
|
42
|
-
* Companies may provide "Firehose-like" push APIs to their customers, partners
|
43
|
-
or just general public.
|
44
|
-
|
45
|
-
* A new shiny Ruby-based system may be integrated with an existing C++-based component
|
46
|
-
using AMQP.
|
47
|
-
|
48
|
-
* An application that watches updates from a real-time stream (be it markets data
|
49
|
-
or Twitter stream) can propagate updates to interested parties, including
|
50
|
-
Web applications that display that information in the real time.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
h2(Getting_started_with_amqp_gem). Getting started with amqp gem
|
55
|
-
|
56
|
-
h3. Install RabbitMQ
|
57
|
-
|
58
|
-
Please refer to "RabbitMQ installation guide":http://www.rabbitmq.com/install.html
|
59
|
-
Note that for Ubuntu and Debian we strongly advice that you use "RabbitMQ apt repository":http://www.rabbitmq.com/debian.html#apt
|
60
|
-
that has recent versions of RabbitMQ. Learn more in {file:docs/RabbitMQVersions.textile RabbitMQ versions} section.
|
61
|
-
|
62
|
-
|
63
|
-
h3. Install the gem
|
64
|
-
|
65
|
-
<pre>gem install amqp</pre>
|
66
|
-
|
67
|
-
|
68
|
-
h3. "Hello, World" example
|
69
|
-
|
70
|
-
<pre><code>
|
71
|
-
#!/usr/bin/env ruby
|
72
|
-
# encoding: utf-8
|
73
|
-
|
74
|
-
require "rubygems"
|
75
|
-
# or
|
76
|
-
#
|
77
|
-
# require "bundler"
|
78
|
-
# Bundler.setup
|
79
|
-
#
|
80
|
-
# if you use Bundler
|
81
|
-
|
82
|
-
require 'amqp'
|
83
|
-
|
84
|
-
EventMachine.run do
|
85
|
-
connection = AMQP.connect(:host => '127.0.0.1')
|
86
|
-
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
|
87
|
-
|
88
|
-
channel = AMQP::Channel.new(connection)
|
89
|
-
queue = channel.queue("amqpgem.examples.hello_world", :auto_delete => true)
|
90
|
-
exchange = channel.direct("")
|
91
|
-
|
92
|
-
queue.subscribe do |payload|
|
93
|
-
puts "Received a message: #{payload}. Disconnecting..."
|
94
|
-
|
95
|
-
connection.close {
|
96
|
-
EM.stop { exit }
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
exchange.publish "Hello, world!", :routing_key => queue.name
|
101
|
-
end
|
102
|
-
</code></pre>
|
103
|
-
|
104
|
-
(see "as a Gist":https://gist.github.com/910211)
|
105
|
-
|
106
|
-
"Getting started guide":http://rdoc.info/github/ruby-amqp/amqp/master/file/docs/GettingStarted.textile explains this and two more examples in detail,
|
107
|
-
and is written in a form of a tutorial.
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
h2. Documentation: tutorials, guides & API reference
|
112
|
-
|
113
|
-
We believe that in order to be the best Ruby AMQP client out there, we need to care about documentation as much as
|
114
|
-
code readability, API beauty and autotomated testing across 5 Ruby implementations on 3 operating systems.
|
115
|
-
|
116
|
-
|
117
|
-
h3. Tutorials
|
118
|
-
|
119
|
-
We have written and maintain "Getting started guide":http://rdoc.info/github/ruby-amqp/amqp/master/file/docs/GettingStarted.textile that is written in form of a tutorial.
|
120
|
-
Check it out! If something isn't clear, every guide explains how to contact documentation authors.
|
121
|
-
|
122
|
-
|
123
|
-
h3. Examples
|
124
|
-
|
125
|
-
You can find many examples (both real-world cases and simple demonstrations)
|
126
|
-
under "examples directory":https://github.com/ruby-amqp/amqp/tree/master/examples in the repository.
|
127
|
-
Note that those examples are written against version 0.8.0.rc1 and later. 0.6.x and 0.7.x
|
128
|
-
may not support certain AMQP protocol or "DSL syntax" features.
|
129
|
-
|
130
|
-
|
131
|
-
h3. Guides
|
132
|
-
|
133
|
-
"Documentation guides":http://rdoc.info/github/ruby-amqp/amqp/master/file/docs/DocumentationGuidesIndex.textile describe
|
134
|
-
the library itself as well as AMQP usage scenarios, routing, error handing & recovery, broker-specific extensions, TLS support and so on.
|
135
|
-
|
136
|
-
|
137
|
-
h3. API reference
|
138
|
-
|
139
|
-
"Reference documentation":http://rdoc.info/github/ruby-amqp/amqp/master/frames is up on rdoc.info and is updated daily.
|
140
|
-
|
141
|
-
*If you don't find your answer in documentation, we consider it a high severity bug* that you should "file to us":http://github.com/ruby-amqp/amqp/issues.
|
142
|
-
|
143
|
-
|
144
|
-
h2. How to use AMQP gem with Ruby on Rails, Merb, Sinatra and other web frameworks
|
145
|
-
|
146
|
-
We cover this subject for multiple Ruby application servers in "Connecting to the broker guide":http://bit.ly/kFCVQU, take a look and let us know
|
147
|
-
what wasn't clear.
|
148
|
-
|
149
|
-
|
150
|
-
h2. How does amqp gem relate to amq-client gem, amq-protocol and libraries like bunny?
|
151
|
-
|
152
|
-
See "this page about AMQP gems family":https://github.com/ruby-amqp/amq-client/blob/master/README.textile
|
153
|
-
|
154
|
-
|
155
|
-
h2. How can I learn more?
|
156
|
-
|
157
|
-
h3. AMQP resources
|
158
|
-
|
159
|
-
* "RabbitMQ tutorials":http://www.rabbitmq.com/getstarted.html that demonstrate interoperability
|
160
|
-
* "Wikipedia page on AMQP":http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol
|
161
|
-
* "AMQP quick reference":http://www.rabbitmq.com/amqp-0-9-1-quickref.html
|
162
|
-
* John O'Hara on the "history of AMQP":http://www.acmqueue.org/modules.php?name=Content&pa=showpage&pid=485
|
163
|
-
|
164
|
-
h3. Messaging and distributed systems resources
|
165
|
-
|
166
|
-
* "Enterprise Integration Patterns":http://www.eaipatterns.com/, a book about messaging and use of messaging in systems integration.
|
167
|
-
|
168
|
-
* "A Critique of the Remote Procedure Call Paradigm":http://www.cs.vu.nl/~ast/publications/euteco-1988.pdf
|
169
|
-
* "A Note on Distributed Computing":http://research.sun.com/techrep/1994/smli_tr-94-29.pdf
|
170
|
-
* "Convenience Over Correctness":http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf
|
171
|
-
* Joe Armstrong on "Erlang messaging vs RPC":http://armstrongonsoftware.blogspot.com/2008/05/road-we-didnt-go-down.html
|
172
|
-
|
173
|
-
|
174
|
-
h2. Community
|
175
|
-
|
176
|
-
* "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp
|
177
|
-
* "RabbitMQ mailing list":https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss (AMQP community epicenter).
|
178
|
-
* "Jabber room for contributors":xmpp://amqp-dev@conf.netlab.cz
|
179
|
-
|
180
|
-
|
181
|
-
h2. License
|
182
|
-
|
183
|
-
AMQP gem is licensed under the "Ruby License":http://www.ruby-lang.org/en/LICENSE.txt.
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
h2. Credits and copyright information
|
188
|
-
|
189
|
-
* The Original Code is "tmm1/amqp":http://github.com/tmm1/amqp.
|
190
|
-
* The Initial Developer of the Original Code is Aman Gupta.
|
191
|
-
* Copyright (c) 2008 - 2010 "Aman Gupta":http://github.com/tmm1.
|
192
|
-
* Contributions from "Jakub Stastny":http://github.com/botanicus are Copyright (c) 2011 VMware, Inc.
|
193
|
-
* Copyright (c) 2010 — 2011 "ruby-amqp":https://github.com/ruby-amqp group members.
|
194
|
-
|
195
|
-
Currently maintained by "ruby-amqp":https://github.com/ruby-amqp group members
|
196
|
-
Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
h2. FAQ
|
201
|
-
|
202
|
-
h3. So, does amqp gem only work with RabbitMQ?
|
203
|
-
|
204
|
-
This library was tested primarily with "RabbitMQ":http://rabbitmq.com, although it should be compatible with any
|
205
|
-
server implementing the "AMQP 0.9.1 spec":http://bit.ly/hw2ELX. For AMQP 0.8.0 brokers,
|
206
|
-
use version 0.7.
|
207
|
-
|
208
|
-
h3. Why isn't Ruby 1.8.7.-p249 supported?
|
209
|
-
|
210
|
-
Because there is absolutely no way we can both make code like the following (pseudo-synchronous) work
|
211
|
-
|
212
|
-
<pre>
|
213
|
-
<code>
|
214
|
-
conn = AMQP.connect
|
215
|
-
ch = AMQP::Channel.new(conn)
|
216
|
-
|
217
|
-
ex = ch.default_exchange
|
218
|
-
ex.publish(some_data)
|
219
|
-
</code>
|
220
|
-
</pre>
|
221
|
-
|
222
|
-
and not be affected by this "Ruby 1.8.7-p249-specific bug (super called outside of method)":http://bit.ly/iONBmH
|
223
|
-
|
224
|
-
h2. Links
|
225
|
-
|
226
|
-
* "API reference":http://rdoc.info/github/ruby-amqp/amqp/master/frames
|
227
|
-
* "Examples":https://github.com/ruby-amqp/amq-protocol/tree/master/examples/
|
228
|
-
* "Issue tracker":http://github.com/ruby-amqp/amqp/issues
|
229
|
-
* "Continous integration server":http://travis-ci.org/#!/ruby-amqp/amqp
|