amqp 0.8.0.rc13 → 0.8.0.rc14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/.rspec +2 -1
  2. data/.travis.yml +8 -2
  3. data/.yardopts +1 -0
  4. data/CHANGELOG +9 -0
  5. data/Gemfile +17 -11
  6. data/README.md +26 -16
  7. data/amqp.gemspec +2 -2
  8. data/bin/ci/before_build.sh +21 -0
  9. data/docs/08Migration.textile +199 -5
  10. data/docs/AMQP091ModelExplained.textile +322 -0
  11. data/docs/Bindings.textile +24 -4
  12. data/docs/Clustering.textile +1 -1
  13. data/docs/ConnectingToTheBroker.textile +98 -82
  14. data/docs/ConnectionEncryptionWithTLS.textile +65 -5
  15. data/docs/DocumentationGuidesIndex.textile +93 -13
  16. data/docs/Durability.textile +1 -1
  17. data/docs/ErrorHandling.textile +458 -94
  18. data/docs/Exchanges.textile +901 -87
  19. data/docs/GettingStarted.textile +278 -143
  20. data/docs/PatternsAndUseCases.textile +420 -0
  21. data/docs/Queues.textile +730 -178
  22. data/docs/RabbitMQVersions.textile +18 -3
  23. data/docs/RunningTests.textile +1 -1
  24. data/docs/TestingWithEventedSpec.textile +121 -0
  25. data/docs/Troubleshooting.textile +15 -1
  26. data/docs/VendorSpecificExtensions.textile +1 -1
  27. data/docs/diagrams/001_hello_world_example_routing.png +0 -0
  28. data/docs/diagrams/002_blabbr_example_routing.png +0 -0
  29. data/docs/diagrams/003_weathr_example_routing.png +0 -0
  30. data/docs/diagrams/004_fanout_exchange.png +0 -0
  31. data/docs/diagrams/005_direct_exchange.png +0 -0
  32. data/docs/diagrams/redhat/direct_exchange.png +0 -0
  33. data/docs/diagrams/redhat/fanout_exchange.png +0 -0
  34. data/docs/diagrams/redhat/topic_exchange.png +0 -0
  35. data/examples/error_handling/automatic_recovery_of_channel_and_queues.rb +50 -0
  36. data/examples/error_handling/automatically_recovering_hello_world_consumer.rb +51 -0
  37. data/examples/error_handling/automatically_recovering_hello_world_consumer_that_uses_a_server_named_queue.rb +51 -0
  38. data/examples/error_handling/basic_connection_failover.rb +22 -0
  39. data/examples/error_handling/channel_level_exception.rb +9 -2
  40. data/examples/error_handling/connection_level_exception.rb +8 -1
  41. data/examples/error_handling/connection_level_exception_with_objects.rb +49 -0
  42. data/examples/error_handling/connection_loss_handler.rb +1 -5
  43. data/examples/error_handling/hello_world_producer.rb +43 -0
  44. data/examples/error_handling/insufficient_permissions.rb +54 -0
  45. data/examples/error_handling/manual_connection_and_channel_recovery.rb +71 -0
  46. data/examples/error_handling/queue_exclusivity_violation.rb +41 -0
  47. data/examples/error_handling/queue_name_violation.rb +31 -0
  48. data/examples/exchanges/autodeletion_of_exchanges.rb +1 -4
  49. data/examples/guides/queues/01a_declaring_a_server_named_queue_using_queue_constructor.rb +7 -8
  50. data/examples/guides/queues/01b_declaring_a_queue_using_queue_constructor.rb +7 -8
  51. data/examples/guides/queues/02a_declaring_a_durable_shared_queue.rb +5 -8
  52. data/examples/guides/queues/02b_declaring_a_durable_shared_queue.rb +5 -8
  53. data/examples/guides/queues/03a_declaring_a_temporary_exclusive_queue.rb +7 -8
  54. data/examples/guides/queues/04_bind_a_queue_using_exchange_instance.rb +9 -10
  55. data/examples/guides/queues/05_bind_a_queue_using_exchange_name.rb +8 -10
  56. data/examples/guides/queues/06_subscribe_to_receive_messages.rb +10 -12
  57. data/examples/guides/queues/07_fetch_a_message_from_the_queue.rb +14 -14
  58. data/examples/guides/queues/08_unsubscribing_a_consumer.rb +13 -16
  59. data/examples/guides/queues/09_unbinding_from_exchange.rb +16 -22
  60. data/examples/guides/queues/10_purge_a_queue.rb +13 -18
  61. data/examples/guides/queues/11_deleting_a_queue.rb +14 -19
  62. data/examples/guides/queues/12_objects_that_consume_messages.rb +69 -0
  63. data/examples/guides/queues/13_objects_that_consume_messages_take_two.rb +89 -0
  64. data/examples/hello_world.rb +1 -3
  65. data/examples/hello_world_with_an_empty_string.rb +5 -6
  66. data/examples/inspecting_server_information.rb +45 -0
  67. data/examples/issues/issue_93.rb +23 -0
  68. data/examples/issues/issue_94.rb +23 -0
  69. data/examples/patterns/command/consumer.rb +45 -0
  70. data/examples/patterns/command/producer.rb +26 -0
  71. data/examples/patterns/request_reply/client.rb +29 -0
  72. data/examples/patterns/request_reply/server.rb +26 -0
  73. data/examples/publishing/publishing_a_one_off_message.rb +6 -4
  74. data/examples/publishing/returned_messages.rb +2 -10
  75. data/examples/queues/accessing_message_metadata.rb +15 -13
  76. data/examples/queues/queue_status.rb +12 -15
  77. data/examples/routing/fanout_routing.rb +33 -0
  78. data/examples/routing/headers_routing.rb +17 -15
  79. data/examples/routing/round_robin_with_direct_exchange.rb +39 -0
  80. data/examples/routing/round_robin_with_the_default_exchange.rb +38 -0
  81. data/examples/routing/unroutable_mandatory_message_is_returned.rb +33 -0
  82. data/examples/routing/weather_updates.rb +15 -20
  83. data/examples/tls/using_tls.rb +41 -0
  84. data/lib/amqp/bit_set.rb +80 -0
  85. data/lib/amqp/broker.rb +72 -0
  86. data/lib/amqp/channel.rb +93 -13
  87. data/lib/amqp/client.rb +11 -22
  88. data/lib/amqp/compatibility/ruby187_patchlevel_check.rb +2 -0
  89. data/lib/amqp/connection.rb +2 -3
  90. data/lib/amqp/consumer.rb +208 -0
  91. data/lib/amqp/deprecated/fork.rb +2 -0
  92. data/lib/amqp/deprecated/mq.rb +2 -0
  93. data/lib/amqp/exchange.rb +6 -4
  94. data/lib/amqp/extensions/rabbitmq.rb +3 -1
  95. data/lib/amqp/header.rb +76 -14
  96. data/lib/amqp/int_allocator.rb +96 -0
  97. data/lib/amqp/logger.rb +2 -0
  98. data/lib/amqp/queue.rb +242 -86
  99. data/lib/amqp/rpc.rb +2 -0
  100. data/lib/amqp/session.rb +169 -9
  101. data/lib/amqp/utilities/event_loop_helper.rb +2 -0
  102. data/lib/amqp/utilities/server_type.rb +2 -0
  103. data/lib/amqp/version.rb +2 -2
  104. data/lib/mq.rb +4 -2
  105. data/lib/mq/logger.rb +3 -1
  106. data/lib/mq/rpc.rb +3 -1
  107. data/spec/integration/authentication_spec.rb +17 -10
  108. data/spec/integration/automatic_binding_for_default_direct_exchange_spec.rb +1 -1
  109. data/spec/integration/automatic_recovery_predicate_spec.rb +68 -0
  110. data/spec/integration/basic_get_spec.rb +2 -1
  111. data/spec/integration/{extensions/basic_return_spec.rb → basic_return_spec.rb} +2 -1
  112. data/spec/integration/channel_level_exception_handling_spec.rb +53 -0
  113. data/spec/integration/connection_level_exception_handling_spec.rb +49 -0
  114. data/spec/integration/declare_and_immediately_bind_a_server_named_queue_spec.rb +38 -17
  115. data/spec/integration/declare_one_hundred_server_named_queues_spec.rb +44 -0
  116. data/spec/integration/direct_exchange_routing_spec.rb +125 -0
  117. data/spec/integration/exchange_declaration_spec.rb +75 -46
  118. data/spec/integration/extensions/rabbitmq/publisher_confirmations_spec.rb +180 -0
  119. data/spec/integration/{workload_distribution_spec.rb → fanout_exchange_routing_spec.rb} +10 -9
  120. data/spec/integration/headers_exchange_routing_spec.rb +269 -0
  121. data/spec/integration/hello_world_spec.rb +77 -0
  122. data/spec/integration/immediate_messages_spec.rb +59 -0
  123. data/spec/integration/mandatory_messages_spec.rb +52 -0
  124. data/spec/integration/message_metadata_access_spec.rb +106 -0
  125. data/spec/integration/multiple_consumers_per_queue_spec.rb +319 -0
  126. data/spec/integration/ordering_of_published_messages_spec.rb +96 -0
  127. data/spec/integration/queue_declaration_spec.rb +8 -8
  128. data/spec/integration/queue_status_spec.rb +66 -0
  129. data/spec/integration/recovery/per_channel_automatic_recovery_on_graceful_broker_shutdown_spec.rb +76 -0
  130. data/spec/integration/recovery/per_channel_automatic_recovery_spec.rb +72 -0
  131. data/spec/integration/redelivery_of_unacknowledged_messages_spec.rb +96 -0
  132. data/spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb +91 -0
  133. data/spec/integration/regressions/empty_message_body_spec.rb +56 -0
  134. data/spec/integration/regressions/issue66_spec.rb +2 -1
  135. data/spec/integration/reply_queue_communication_spec.rb +2 -1
  136. data/spec/integration/store_and_forward_spec.rb +4 -3
  137. data/spec/integration/topic_subscription_spec.rb +2 -1
  138. data/spec/integration/tx_commit_spec.rb +124 -0
  139. data/spec/integration/tx_rollback_spec.rb +167 -0
  140. data/spec/spec_helper.rb +44 -71
  141. data/spec/unit/amqp/bit_set_spec.rb +127 -0
  142. data/spec/unit/amqp/channel_id_allocation_spec.rb +40 -0
  143. data/spec/unit/amqp/connection_spec.rb +4 -2
  144. data/spec/unit/amqp/int_allocator_spec.rb +116 -0
  145. metadata +92 -26
  146. data/CONTRIBUTORS +0 -29
  147. data/docs/Routing.textile +0 -30
  148. data/examples/real-world/task-queue/README.textile +0 -3
  149. data/examples/real-world/task-queue/consumer.rb +0 -27
  150. data/examples/real-world/task-queue/producer.rb +0 -22
  151. data/spec/unit/amqp/basic_spec.rb +0 -39
  152. data/tasks.rb +0 -4
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
- --format nested
2
+ --format
3
+ progress
data/.travis.yml CHANGED
@@ -1,10 +1,16 @@
1
+ # https://github.com/travis-ci/travis-ci/wiki/.travis.yml-options
2
+ bundler_args: --without development
1
3
  script: "bundle exec rake spec:ci"
4
+ before_script: ./bin/ci/before_build.sh
2
5
  rvm:
3
6
  - 1.8.7
4
- - rbx
5
7
  - 1.9.2
6
- - ree
7
8
  - jruby
9
+ - ree
10
+ - rbx-2.0
8
11
  gemfile:
9
12
  - Gemfile
10
13
  - gemfiles/eventmachine-pre
14
+ notifications:
15
+ recipients:
16
+ - michaelklishin@me.com
data/.yardopts CHANGED
@@ -3,6 +3,7 @@
3
3
  --markup="textile" lib/**/*.rb
4
4
  --main README.md
5
5
  --asset docs:docs --asset examples:examples
6
+ --hide-tag todo
6
7
  -
7
8
  LICENSE
8
9
  CHANGELOG
data/CHANGELOG CHANGED
@@ -1,5 +1,14 @@
1
1
  = Version 0.8.0
2
2
 
3
+ * [API] AMQP::Exchange#publish calls now use a mutex on the channel exchange is declared on. Sharing channels between threads is discouraged but amqp gem covers your back in the most dangerous case.
4
+ * [API] AMQP::Channel#synchronize now can be used to guarantee mutual exclusion of multiple threads on channel instances.
5
+ * [BUG] Empty messages can finally be published fine. Yes, it took us just 3 years.
6
+ * [FEATURE] When connected to RabbitMQ, RabbitMQ-specific extensions are required automatically
7
+ * [FEATURE] AMQP::Session#broker and AMQP::Broker allow for broker capabilities inspection
8
+ * [FEATURE] New bitset-based channel id allocator
9
+ * [FEATURE] Multiple consumers per queue with AMQP::Consumer
10
+ * [FEATURE] Automatic recovery mode for channels
11
+ * [FEATURE] Network connection recovery callbacks for channels, exchanges, queues, consumers
3
12
  * [API] Connection URI (string) format for vhosts no longer assumes that vhosts begin with a slash (/), learn more at http://bit.ly/mfzwcB
4
13
  * [FEATURE] Returned messages, including header & content via AMQP::Exchange#on_publish. Callback accepts 3 args: basic_return, header, body
5
14
  * [BUG] Ruby 1.8.7-p249 is not supported because of this (p249-specific) Ruby bug: http://bit.ly/iONBmH
data/Gemfile CHANGED
@@ -14,27 +14,33 @@ def custom_gem(name, options = Hash.new)
14
14
  end
15
15
 
16
16
  custom_gem "eventmachine"
17
- gem "json", :platform => :ruby_18
17
+ # gem "json", :platform => :ruby_18
18
18
  custom_gem "amq-client", :git => "git://github.com/ruby-amqp/amq-client.git", :branch => "master"
19
19
  custom_gem "amq-protocol", :git => "git://github.com/ruby-amqp/amq-protocol.git", :branch => "master"
20
20
 
21
21
  group(:development) do
22
- gem "yard", ">= 0.7.1"
22
+ gem "yard", ">= 0.7.2"
23
23
  # yard tags this buddy along
24
- gem "RedCloth"
25
- gem "rdiscount"
26
-
27
- custom_gem "nake", :platform => :ruby_19
28
- custom_gem "contributors", :platform => :ruby_19
24
+ gem "RedCloth", :platform => :mri
25
+ gem "rdiscount", :platform => :ruby
26
+ gem "yajl-ruby", :platform => :ruby
29
27
 
30
28
  # To test event loop helper and various Rack apps
31
- gem "thin"
29
+ gem "thin", :platform => :ruby
32
30
  gem "unicorn", :platform => :ruby
31
+
33
32
  gem "changelog"
34
33
  end
35
34
 
36
- group(:test) do
37
- gem "rspec", ">=2.5.0"
38
- gem "rake"
35
+ group :test do
36
+ gem "rspec", "~> 2.6.0"
37
+ gem "rake", "~> 0.9.2"
38
+
39
39
  custom_gem "evented-spec", :git => "git://github.com/ruby-amqp/evented-spec.git", :branch => "master"
40
+ gem "effin_utf8"
41
+
42
+ gem "multi_json"
43
+
44
+ gem "json", :platform => :jruby
45
+ gem "yajl-ruby", :platform => :ruby_18
40
46
  end
data/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  Ruby amqp gem is a widely used, feature-rich, well-maintained asynchronous AMQP 0.9.1 client with batteries included.
4
4
  This library works with Ruby 1.8.7 (p174 and p334), Ruby 1.9.2, [JRuby](http://jruby.org) (highly recommended to Microsoft Windows users), [REE](http://www.rubyenterpriseedition.com) and [Rubinius](http://rubini.us), and is licensed under the [Ruby License](http://www.ruby-lang.org/en/LICENSE.txt)
5
5
 
6
- Versions 0.8.0 and later of amqp gem implement [AMQP 0.9.1](http://bit.ly/hw2ELX) and supports [RabbitMQ extensions to AMQP 0.9.1](http://www.rabbitmq.com/extensions.html).
6
+ Versions 0.8.0.RC13 and later of amqp gem implement [AMQP 0.9.1](http://bit.ly/amqp-model-explained) (see also [AMQP 0.9.1 spec document](http://bit.ly/hw2ELX)) and support [RabbitMQ extensions to AMQP 0.9.1](http://www.rabbitmq.com/extensions.html).
7
7
 
8
- [![Continuous Integration status](http://travis-ci.org/ruby-amqp/amqp.png)](http://travis-ci.org/ruby-amqp/amqp)
8
+ [![Continuous Integration status](https://secure.travis-ci.org/ruby-amqp/amqp.png)](http://travis-ci.org/ruby-amqp/amqp)
9
9
 
10
10
 
11
11
  ## I know what AMQP is, how do I get started? ##
@@ -20,7 +20,7 @@ AMQP is an [open standard for messaging middleware](http://www.amqp.org/confluen
20
20
  emphasizes interoperability between different technologies (for example, Java, .NET, Ruby, Python, Node.js, Erlang, C and so on).
21
21
 
22
22
  Key features of AMQP are very flexible yet simple routing and binary protocol efficiency. AMQP supports many sophisticated features, for example,
23
- message acknowledgements, returning messages to producer, delivery confirmation, flow control and so on.
23
+ message acknowledgements, returning of messages to producer, redelivery of messages that couldn't be processed, load balancing between message consumers and so on.
24
24
 
25
25
 
26
26
  ## What is amqp gem good for? ##
@@ -32,11 +32,15 @@ dozens or hundreds of applications built with all kinds of technologies.
32
32
 
33
33
  Specific examples:
34
34
 
35
+ * Events collectors, metrics & analytics applications can aggregate events produced by various applications
36
+ (Web and not) in the company network.
37
+
35
38
  * A Web application may route messages to a Java app that works
36
39
  with SMS delivery gateways.
37
40
 
38
- * Periodically run (Cron-driven) application may notify other systems that
39
- there are some new results.
41
+ * MMO games can use flexible routing AMQP provides to propagate event notifications to players and locations.
42
+
43
+ * Price updates from public markets or other sources can be distributed between interested parties, from trading systems to points of sale in a specific geographic region.
40
44
 
41
45
  * Content aggregators may update full-text search and geospatial search indexes
42
46
  by delegating actual indexing work to other applications over AMQP.
@@ -44,8 +48,8 @@ Specific examples:
44
48
  * Companies may provide streaming/push APIs to their customers, partners
45
49
  or just general public.
46
50
 
47
- * A new shiny Ruby-based system may be integrated with an existing C++-based component
48
- using AMQP.
51
+ * Continuous integration systems can distribute builds between multiple machines with various hardware and software
52
+ configurations using advanced routing features of AMQP.
49
53
 
50
54
  * An application that watches updates from a real-time stream (be it markets data
51
55
  or Twitter stream) can propagate updates to interested parties, including
@@ -67,11 +71,11 @@ with are outdated even in recent (10.10) releases. Learn more in the [RabbitMQ v
67
71
  On Microsoft Windows 7
68
72
 
69
73
  gem install eventmachine --pre
70
- gem install amqp --pre --version "~> 0.8.0.RC12"
74
+ gem install amqp --pre
71
75
 
72
76
  On other OSes or [JRuby](http://jruby.org):
73
77
 
74
- gem install amqp --pre --version "~> 0.8.0.RC12"
78
+ gem install amqp --pre
75
79
 
76
80
 
77
81
  ### "Hello, World" example ###
@@ -110,7 +114,8 @@ On other OSes or [JRuby](http://jruby.org):
110
114
 
111
115
 
112
116
  [Getting started guide](http://bit.ly/getting-started-with-amqp-ruby-gem) explains this and two more examples in detail,
113
- and is written in a form of a tutorial.
117
+ and is written in a form of a tutorial. See [AMQP Model Explained](http://bit.ly/amqp-model-explained) if you want
118
+ to learn more about AMQP principles & concepts.
114
119
 
115
120
 
116
121
 
@@ -118,7 +123,7 @@ and is written in a form of a tutorial.
118
123
 
119
124
  We believe that in order to be a library our users **really** love, we need to care about documentation as much as (or more)
120
125
  code readability, API beauty and autotomated testing across 5 Ruby implementations on multiple operating systems. We do care
121
- about our documentation: **if you don't find your answer in documentation, we consider it a high severity bug** that you
126
+ about our [documentation](http://bitly.com/amqp-gem-docs): **if you don't find your answer in documentation, we consider it a high severity bug** that you
122
127
  should [file to us](http://github.com/ruby-amqp/amqp/issues). Or just complain to [@rubyamqp](https://twitter.com/rubyamqp) on Twitter.
123
128
 
124
129
 
@@ -140,10 +145,13 @@ of the page.
140
145
  You can find many examples (both real-world cases and simple demonstrations) under [examples directory](https://github.com/ruby-amqp/amqp/tree/master/examples) in the repository.
141
146
  Note that those examples are written against version 0.8.0.rc1 and later. 0.6.x and 0.7.x may not support certain AMQP protocol or "DSL syntax" features.
142
147
 
148
+ There is also a work-in-progress [Messaging Patterns and Use Cases With AMQP](http://bit.ly/amqp-gem-patterns) documentation guide.
149
+
143
150
 
144
151
  ### Documentation guides ###
145
152
 
146
- [Documentation guides](http://bit.ly/amqp-gem-docs) describe the library itself as well as AMQP usage scenarios, topics like routing, error handing & recovery, broker-specific extensions, TLS support, troubleshooting and so on.
153
+ [Documentation guides](http://bit.ly/amqp-gem-docs) describe the library itself as well as AMQP concepts, usage scenarios, topics like working with exchanges and queues,
154
+ error handing & recovery, broker-specific extensions, TLS support, troubleshooting and so on. Most of the documentation is in these guides.
147
155
 
148
156
 
149
157
  ### API reference ###
@@ -165,7 +173,7 @@ what wasn't clear.
165
173
  * Join [Ruby AMQP mailing list](http://groups.google.com/group/ruby-amqp)
166
174
  * Follow [@rubyamqp](https://twitter.com/rubyamqp) on Twitter for Ruby AMQP ecosystem updates.
167
175
  * Join also [RabbitMQ mailing list](https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss) (AMQP community epicenter).
168
- * Stop by #rabbitmq on irc.freenode.net. You can use [Web IRC client](http://webchat.freenode.net?channels=rabbitmq) if you don't have an IRC client installed.
176
+ * Stop by #rabbitmq on irc.freenode.net. You can use [Web IRC client](http://webchat.freenode.net?channels=rabbitmq) if you don't have IRC client installed.
169
177
 
170
178
 
171
179
 
@@ -223,9 +231,9 @@ Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
223
231
  This library is developed and tested primarily with [RabbitMQ](http://rabbitmq.com), although it should be compatible with any
224
232
  server implementing the [AMQP 0.9.1 spec](http://bit.ly/hw2ELX). For AMQP 0.8 brokers, use amqp gem version 0.7.x.
225
233
 
226
- ### Why isn't Ruby 1.8.7.-p249 supported? ###
234
+ ### Why isn't Ruby 1.8.7.-p249 supported? Will it be supported in the future? ###
227
235
 
228
- Because there is absolutely no way we can both make code like the following (pseudo-synchronous) work
236
+ In order to make code like the following (pseudo-synchronous) work
229
237
 
230
238
  conn = AMQP.connect
231
239
  ch = AMQP::Channel.new(conn)
@@ -233,7 +241,9 @@ Because there is absolutely no way we can both make code like the following (pse
233
241
  ex = ch.default_exchange
234
242
  ex.publish(some_data)
235
243
 
236
- and not be affected by this [Ruby 1.8.7-p249-specific bug (super called outside of method)](http://bit.ly/iONBmH)
244
+ and not be affected by this [Ruby 1.8.7-p249-specific bug (super called outside of method)](http://bit.ly/iONBmH), we need to
245
+ avoid any inheritance for key amqp gem classes: Channel, Queue, Exchange. This will take a moderate refactoring effort, and
246
+ is likely to happen in 0.8.0.RC15.
237
247
 
238
248
 
239
249
  ### How does amqp gem relate to amq-client gem, amq-protocol and libraries like bunny? ###
data/amqp.gemspec CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |s|
23
23
 
24
24
  # Dependencies
25
25
  s.add_dependency "eventmachine"
26
- s.add_dependency "amq-client", ">= 0.7.0.alpha34"
27
- s.add_dependency "amq-protocol", ">= 0.7.0.alpha6"
26
+ s.add_dependency "amq-client", ">= 0.8.0"
27
+ s.add_dependency "amq-protocol", ">= 0.8.0"
28
28
 
29
29
  begin
30
30
  require "changelog"
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ # guest:guest has full access to /
4
+
5
+ sudo rabbitmqctl add_vhost /
6
+ sudo rabbitmqctl add_user guest guest
7
+ sudo rabbitmqctl set_permissions -p / guest ".*" ".*" ".*"
8
+
9
+
10
+ # amqp_gem:amqp_gem_password has full access to amqp_gem_testbed
11
+
12
+ sudo rabbitmqctl add_vhost amqp_gem_testbed
13
+ sudo rabbitmqctl add_user amqp_gem amqp_gem_password
14
+ sudo 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
+ sudo rabbitmqctl add_user amqp_gem_reader reader_password
20
+ sudo rabbitmqctl clear_permissions -p amqp_gem_testbed guest
21
+ sudo rabbitmqctl set_permissions -p amqp_gem_testbed amqp_gem_reader "^---$" "^---$" ".*"
@@ -1,28 +1,222 @@
1
1
  # @title Ruby AMQP gem: Migrating to version 0.8.0 and later
2
2
 
3
- h1. TBD
3
+ h1. amqp gem 0.8 migration guide
4
4
 
5
5
 
6
6
  h2. About this guide
7
7
 
8
- TBD
8
+ This guide explains how (and why) applications that use amqp gem versions 0.6.x and 0.7.x should migrate
9
+ to 0.8.0.RCs and future versions. It also outlines deprecated features, when and why they will be removed.
9
10
 
10
11
 
11
12
  h2. Covered versions
12
13
 
13
- This guide covers "Ruby amqp gem":http://github.com/ruby-amqp/amqp v0.8.0 and later.
14
+ This guide covers "Ruby amqp gem":http://github.com/ruby-amqp/amqp v0.6.x and v0.7.x.
14
15
 
15
16
 
16
17
 
17
- h2. TBD
18
+ h2. Brief history of amqp gem
19
+
20
+ amqp gem was born in early July 2008. Since then, it has seen 7 releases, used by all kinds of companies, have been
21
+ key component to systems that process more than 100 gigabytes of data per day and, despite not being a "1.0 library",
22
+ proven to be very usable.
23
+
24
+ For the most part of 2008 and 2009 the gem did not receive much of attention. In 2010, some other AMQP clients (for example,
25
+ RabbitMQ Java & .NET clients) switched to AMQP 0.9.1 specification. By the fall of 2010 it became clear that amqp gem needs
26
+ a new team of maintainers, deep refactoring, new solid test suite and extensive documentation guides. Long story short,
27
+ by December 2010, the "new maintainers group":https://github.com/ruby-amqp was formed and now maintains number of other libraries
28
+ in the Ruby AMQP ecosystem, most notably the "Bunny gem":github.com/ruby-amqp/bunny.
29
+
30
+ Over first few months of 2011, amqp gem undergone a number of maintenance releases (known as 0.7.x series), a ground up rewrite of
31
+ the test suite, major documentation update as well as a major refactoring. It was upgraded to AMQP 0.9.1 specification and
32
+ based on a new, much more efficient AMQP serialization library, "amq-protocol":https://github.com/ruby-amqp/amq-protocol.
33
+
34
+ As part of this transition, amqp gem maintainers team pursued a number of goals:
35
+
36
+ * Implement AMQP 0.9.1 spec plus all the RabbitMQ extensions
37
+ * End "300 of 1 patch forks" situation that had gotten especially bad in early 2010
38
+ * Produce a solid end-to-end test suite that imitates real asynchronous applications
39
+ * Resolve many API usability issues: inconsistent behavior, weird class and method naming, heavy reliance on implicit connection objects and so on
40
+ * Produce documentation guides that other AMQP client users will be envious of
41
+ * Define a stable public API
42
+ * Improve memory efficiency and performance
43
+ * Resolve many limitations of the original API and implementation design
44
+ * Drop all the "experimental-stuff-that-was-never-finished"
45
+
46
+ In the end, several projects like "evented-spec":https://github.com/ruby-amqp/evented-spec were born and became part of the amqp gem
47
+ family of libraries. "300 one patch forks" hell is a thing of the past. Even initial pure Ruby implementation of the new serialization
48
+ library is "several times as memory efficient":http://www.rabbitmq.com/blog/2011/03/01/ruby-amqp-benchmarks/. "Documentation guides":http://bit.ly/amqp-gem-docs
49
+ response if very positive. amqp gem 0.8.0.RCs implement all but 1 RabbitMQ extensions as well as AMQP 0.9.1 spec features original gem
50
+ never implemented fully. Many large users of the gem upgraded to 0.8.0.RCs. The future for amqp gem and its spin-offs is bright.
51
+
52
+
53
+ h2. amqp gem 0.8.0 backwards compatibility policy
54
+
55
+ amqp gem 0.8.0 is *not 100% backwards compatible*. That said, for most applications, upgrade path will be easy.
56
+ Over 90% of the deprecated API classes & methods are still in place and will only be dropped in the 0.9.0 release.
57
+
58
+ Plenty of incompatibilities between 0.6.x and 0.7.x series were ironed out in 0.8.0.RCs. Finally, this guide will explain
59
+ what has changed, why, why it is the right thing to do and how you should adapt your application code.
60
+
61
+
62
+
63
+ h2. Why developers should upgrade to 0.8.0
64
+
65
+ * Great documentation
66
+ * amqp gem 0.8.0 RCs and later versions are actively maintained
67
+ * Largest library users either already switched to amqp gem 0.8.0 RCs or are switching in the near future (2011)
68
+ * AMQP 0.9.1 spec implementation: many other popular clients, for example the RabbitMQ Java client, has dropped support for AMQP 0.8 specification
69
+ * RabbitMQ extensions
70
+ * Several AMQP brokers, including RabbitMQ (by far the most popular from the maintainers team observation), are planning to drop AMQP 0.8 spec support
71
+ * Applications that do not use depricated API features & behaviors will have very seamless upgrade path to the amqp gem 0.9.0 and beyond
72
+
73
+
74
+
75
+ h2. AMQP protocol version change
76
+
77
+ amqp gem before 0.8.0.RCs series implemented (most of) AMQP 0.8 specification.
78
+
79
+
80
+
81
+ h2. Follow established AMQP terminology
82
+
83
+ h3. require "mq" is deprecated
84
+
85
+ Instead of the following:
86
+
87
+ <pre>
88
+ <code>
89
+ require "amqp"
90
+ require "mq"
91
+ </code>
92
+ </pre>
93
+
94
+ or
95
+
96
+ <pre>
97
+ <code>
98
+ require "mq"
99
+ </code>
100
+ </pre>
101
+
102
+
103
+ switch to
104
+
105
+ <pre>
106
+ <code>
107
+ require "amqp"
108
+ </code>
109
+ </pre>
110
+
111
+ <span class="note">
112
+ mq.rb will be removed before 1.0 release.
113
+ </span>
114
+
115
+
116
+ h3. MQ class is deprecated
117
+
118
+ Please use {AMQP::Channel} instead. MQ class & its methods are implemented in amqp gem 0.8.x for backwards compatibility,
119
+ but only for transition period (that will end after 0.9 release).
120
+
121
+ Why is it deprecated? Because it was a poor name choice all along. Both mq.rb and MQ class step away from AMQP terminology and
122
+ make 8 out of 10 engineers think it has something to do with AMQP queues (in fact, MQ should have been called Channel all along).
123
+ No other AMQP client library we know of invents its own terminology when it comes to AMQP entities, and amqp gem shouldn't, too.
124
+
125
+ <span class="note">
126
+ MQ class and class methods that use implicit connection (MQ.queue and so on) will be removed before 1.0 release.
127
+ </span>
128
+
129
+
130
+ h2. MQ class is now AMQP::Channel
18
131
 
19
132
  TBD
20
133
 
21
134
 
135
+ h2. MQ::Queue is now AMQP::Queue
136
+
137
+ TBD
138
+
139
+
140
+ h2. MQ::Exchange is now AMQP::Exchange
141
+
142
+ TBD
143
+
144
+
145
+ h2. MQ::Header is now AMQP::Header
146
+
147
+ TBD
148
+
149
+
150
+
151
+ h2. MQ::RPC is deprecated
152
+
153
+ It was an experiment that was never finished. Some API design choices are very opinionated as well. amqp gem should not ship with
154
+ half-baked poorly designed or overly opinionated solutions.
155
+
156
+ <span class="note">
157
+ MQ::RPC class will be removed before 1.0 release.
158
+ </span>
159
+
160
+
161
+ h2. MQ::Logger is removed
162
+
163
+ It was an experiment that was never finished. Some API design choices are very opinionated as well. amqp gem should not ship with
164
+ half-baked poorly designed or overly opinionated solutions.
165
+
166
+ <span class="note">
167
+ MQ::Logger class was removed in the the amqp gem 0.8.0 development cycle.
168
+ </span>
169
+
170
+
171
+ h2. AMQP::Buffer is removed
172
+
173
+ AMQP::Buffer was AMQP 0.8 protocol implementation detail. With the new "amq-protocol gem":http://rubygems.org/gems/amq-protocol, it is no
174
+ longer relevant.
175
+
176
+ <span class="note">
177
+ AMQP::Buffer class was removed in the the amqp gem 0.8.0 development cycle.
178
+ </span>
179
+
180
+
181
+ h2. AMQP::Frame is removed
182
+
183
+ AMQP::Frame was AMQP 0.8 protocol implementation detail. With the new "amq-protocol gem":http://rubygems.org/gems/amq-protocol, it is no
184
+ longer relevant.
185
+
186
+ <span class="note">
187
+ AMQP::Frame class was removed in the the amqp gem 0.8.0 development cycle.
188
+ </span>
189
+
190
+
191
+ h2. AMQP::Server is removed
192
+
193
+ AMQP::Server was (an unfinished) toy implementation of AMQP 0.8 broker in Ruby on top of EventMachine. We believe that Ruby is not an optimal
194
+ choice for AMQP broker implementations. We also never heard from anyone using it.
195
+
196
+ <span class="note">
197
+ AMQP::Server class was removed in the the amqp gem 0.8.0 development cycle.
198
+ </span>
199
+
200
+
201
+ h2. AMQP::Protocol::* classes are removed
202
+
203
+ AMQP::Protocol::* classes were AMQP 0.8 protocol implementation detail. With the new "amq-protocol gem":http://rubygems.org/gems/amq-protocol, they are no
204
+ longer relevant.
205
+
206
+ <span class="note">
207
+ AMQP::Protocol::* classes were removed in the the amqp gem 0.8.0 development cycle.
208
+ </span>
209
+
210
+
211
+
212
+
213
+ h2. TBD
214
+
215
+
22
216
 
23
217
  h2. Tell us what you think!
24
218
 
25
- 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:
219
+ Please take a moment and tell us what you think about this guide "on Twitter":http://twitter.com/rubyamqp or "Ruby AMQP mailing list":http://groups.google.com/group/ruby-amqp:
26
220
  what was unclear? what wasn't covered? maybe you don't like guide style or grammar and spelling are incorrect? Readers feedback is
27
221
  key to making documentation better.
28
222