amqp 0.8.0.rc11 → 0.8.0.rc12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/CHANGELOG +1 -0
  2. data/Gemfile +2 -1
  3. data/amqp.gemspec +1 -1
  4. data/docs/ConnectingToTheBroker.textile +136 -6
  5. data/docs/GettingStarted.textile +2 -2
  6. data/docs/Queues.textile +14 -14
  7. data/examples/channels/open_channel_with_one_arity_callback.rb +30 -0
  8. data/examples/deprecated/default_thread_local_channel_instance.rb +34 -0
  9. data/examples/error_handling/channel_level_exception.rb +1 -1
  10. data/examples/error_handling/channel_level_exception_with_multiple_channels_involved.rb +1 -1
  11. data/examples/error_handling/global_channel_level_exception_handler.rb +1 -1
  12. data/examples/guides/getting_started/03_babblr.rb +1 -1
  13. data/examples/guides/queues/05_binding_a_queue_using_exchange_instance.rb +1 -1
  14. data/examples/guides/queues/06_biding_a_queue_using_exchange_name_string.rb +1 -1
  15. data/examples/guides/queues/07_subscribing_to_receive_messages.rb +1 -1
  16. data/examples/guides/queues/08_poll_for_messages.rb +1 -1
  17. data/examples/guides/queues/09_unsubscribing_a_consumer.rb +1 -1
  18. data/examples/guides/queues/10_unbinding_from_exchange.rb +1 -1
  19. data/examples/guides/queues/11_purge_a_queue.rb +1 -1
  20. data/examples/guides/queues/12_deleting_a_queue.rb +1 -1
  21. data/examples/queues/declare_a_queue_without_assignment.rb +1 -1
  22. data/examples/queues/declare_and_bind_a_server_named_queue.rb +1 -1
  23. data/lib/amqp/channel.rb +27 -1
  24. data/lib/amqp/client.rb +36 -8
  25. data/lib/amqp/connection.rb +6 -3
  26. data/lib/amqp/deprecated/mq.rb +0 -22
  27. data/lib/amqp/queue.rb +19 -13
  28. data/lib/amqp/version.rb +1 -1
  29. data/spec/integration/authentication_spec.rb +7 -5
  30. data/spec/spec_helper.rb +1 -0
  31. data/spec/unit/amqp/client_spec.rb +149 -0
  32. data/spec/unit/amqp/connection_spec.rb +20 -0
  33. metadata +108 -86
@@ -73,5 +73,25 @@ describe AMQP, 'class object' do
73
73
  done(0.1) { @block_fired.should be_true }
74
74
  end
75
75
  end
76
+
77
+ it 'should try to connect again in case previous conection failed' do
78
+ em do
79
+ timeout(20)
80
+ error_handler = proc { EM.next_tick { AMQP.start(AMQP_OPTS) { done } } }
81
+ # Assuming that you don't run your amqp @ port 65535
82
+ AMQP.start(AMQP_OPTS.merge(:port => 65535, :on_tcp_connection_failure => error_handler))
83
+
84
+ end
85
+ end
86
+
87
+ it 'should keep connection if there was no failure' do
88
+ em do
89
+ error_handler = proc {}
90
+ @block_fired_times = 0
91
+ AMQP.start(AMQP_OPTS) { @block_fired_times += 1 }
92
+ delayed(0.1) { AMQP.start(AMQP_OPTS) { @block_fired_times += 1 } }
93
+ done(0.2) { @block_fired_times.should == 1 }
94
+ end
95
+ end
76
96
  end # .start
77
97
  end # describe AMQP
metadata CHANGED
@@ -1,48 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
- version: !ruby/object:Gem::Version
4
- version: 0.8.0.rc11
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15424141
5
5
  prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 0
10
+ - rc
11
+ - 12
12
+ version: 0.8.0.rc12
6
13
  platform: ruby
7
- authors:
14
+ authors:
8
15
  - Aman Gupta
9
16
  - Jakub Stastny aka botanicus
10
17
  - Michael S. Klishin
11
18
  autorequire:
12
19
  bindir: bin
13
20
  cert_chain: []
14
- date: 2011-05-14 00:00:00.000000000Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
21
+
22
+ date: 2011-05-18 00:00:00 Z
23
+ dependencies:
24
+ - !ruby/object:Gem::Dependency
17
25
  name: eventmachine
18
- requirement: &2156186280 !ruby/object:Gem::Requirement
26
+ prerelease: false
27
+ requirement: &id001 !ruby/object:Gem::Requirement
19
28
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ hash: 3
33
+ segments:
34
+ - 0
35
+ version: "0"
24
36
  type: :runtime
25
- prerelease: false
26
- version_requirements: *2156186280
27
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
28
39
  name: amq-client
29
- requirement: &2156185780 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
30
42
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: 0.7.0.alpha23
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: -3702664418
47
+ segments:
48
+ - 0
49
+ - 7
50
+ - 0
51
+ - alpha
52
+ - 25
53
+ version: 0.7.0.alpha25
35
54
  type: :runtime
36
- prerelease: false
37
- version_requirements: *2156185780
38
- description: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries
39
- included
40
- email:
55
+ version_requirements: *id002
56
+ description: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included
57
+ email:
41
58
  - michael@novemberain.com
42
59
  - stastny@101ideas.cz
43
60
  executables: []
61
+
44
62
  extensions: []
45
- extra_rdoc_files:
63
+
64
+ extra_rdoc_files:
46
65
  - README.textile
47
66
  - docs/08Migration.textile
48
67
  - docs/Bindings.textile
@@ -58,7 +77,7 @@ extra_rdoc_files:
58
77
  - docs/RabbitMQVersions.textile
59
78
  - docs/Routing.textile
60
79
  - docs/VendorSpecificExtensions.textile
61
- files:
80
+ files:
62
81
  - .gitignore
63
82
  - .rspec
64
83
  - .travis.yml
@@ -86,11 +105,13 @@ files:
86
105
  - docs/RabbitMQVersions.textile
87
106
  - docs/Routing.textile
88
107
  - docs/VendorSpecificExtensions.textile
108
+ - examples/channels/open_channel_with_one_arity_callback.rb
89
109
  - examples/channels/open_channel_without_assignment.rb
90
110
  - examples/channels/prefetch_as_constructor_argument.rb
91
111
  - examples/channels/qos_aka_prefetch.rb
92
112
  - examples/channels/qos_aka_prefetch_without_callback.rb
93
113
  - examples/connection/connect_and_immediately_disconnect.rb
114
+ - examples/deprecated/default_thread_local_channel_instance.rb
94
115
  - examples/error_handling/channel_level_exception.rb
95
116
  - examples/error_handling/channel_level_exception_with_multiple_channels_involved.rb
96
117
  - examples/error_handling/connection_loss_handler.rb
@@ -205,77 +226,78 @@ files:
205
226
  - spec/integration/workload_distribution_spec.rb
206
227
  - spec/spec_helper.rb
207
228
  - spec/unit/amqp/basic_spec.rb
229
+ - spec/unit/amqp/client_spec.rb
208
230
  - spec/unit/amqp/connection_spec.rb
209
231
  - tasks.rb
210
232
  homepage: http://github.com/ruby-amqp/amqp
211
233
  licenses: []
212
- post_install_message: ! "[\e[32mVersion 0.8.0\e[0m] [FEATURE] Returned messages, including
213
- header & content via AMQP::Exchange#on_publish. Callback accepts 3 args: basic_return,
214
- header, body\n[\e[32mVersion 0.8.0\e[0m] [BUG] Ruby 1.8.7-p249 is not supported
215
- because of this (p249-specific) Ruby bug: http://bit.ly/iONBmH\n[\e[32mVersion 0.8.0\e[0m]
216
- [FEATURE] AMQP::Utilities::EventLoopHelper detects app server (if any) being used
217
- and starts EventMachine reactor in an optimal way.\n[\e[32mVersion 0.8.0\e[0m] [FEATURE]
218
- AMQP 0.9.1 support, including tx.* operations class.\n[\e[32mVersion 0.8.0\e[0m]
219
- [API] Default authentication handler now raises AMQP::PossibleAuthenticationFailureError\n[\e[32mVersion
220
- 0.8.0\e[0m] [API] AMQP::Channel#initialize now takes 3rd (optional) options hash.\n[\e[32mVersion
221
- 0.8.0\e[0m] [API] Broker connection class is now AMQP::Session.\n[\e[32mVersion
222
- 0.8.0\e[0m] [API] AMQP::Error instance now may carry cause, an exception that caused
223
- exception in question to be raised.\n[\e[32mVersion 0.8.0\e[0m] [API] When initial
224
- TCP connection fails, default action is now to raise AMQP::TCPConnectionFailed.\n[\e[32mVersion
225
- 0.8.0\e[0m] [API] AMQP::BasicClient#reconnect now takes 2nd optional argument, period
226
- of waiting in seconds.\n[\e[32mVersion 0.8.0\e[0m] [FEATURE] Handlers for initial
227
- connection failure, connection loss; channel-level exceptions handlers on Channel
228
- instances.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Exchange#initialize now accepts
229
- :arguments option that takes a hash.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#initialize
230
- now accepts :arguments option that takes a hash.\n[\e[32mVersion 0.8.0\e[0m] [API]
231
- AMQP#Logger is deprecated. It will be removed before 1.0 release.\n[\e[32mVersion
232
- 0.8.0\e[0m] [API] AMQP#fork is deprecated. It will be removed before 1.0 release.\n[\e[32mVersion
233
- 0.8.0\e[0m] [API] AMQP::RPC is deprecated. It will be removed before 1.0 release.\n[\e[32mVersion
234
- 0.8.0\e[0m] [FEATURE] Significant improvements to the documentation. From now on
235
- lack of/poor documentation is considered a severe bug.\n[\e[32mVersion 0.8.0\e[0m]
236
- [FEATURE] Support for RabbitMQ extensions to AMQP 0.9.1\n[\e[32mVersion 0.8.0\e[0m]
237
- [API] AMQP::Exchange#publish now accepts (an optional) callback.\n[\e[32mVersion
238
- 0.8.0\e[0m] [API] AMQP::Channel.new now accepts (an optional) callback.\n[\e[32mVersion
239
- 0.8.0\e[0m] [API] AMQP::Header#ack now can acknowledge multiple deliveries\n[\e[32mVersion
240
- 0.8.0\e[0m] [API] AMQP::Exchange#delete now takes (an optional) block that is called
241
- when exchange.delete-ok response arrives.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Header
242
- now implements #to_hash\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#pop block
243
- now can take 1, 2 or 3 arguments.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#purge
244
- \ now takes an optional block which is called when queue.purge-ok response arrives.\n[\e[32mVersion
245
- 0.8.0\e[0m] [API] AMQP::Queue#delete now takes an optional block which is called
246
- when queue.delete-ok response arrives.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#delete
247
- now accepts :nowait option.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#unbind
248
- now takes an optional block which is called when queue.unbind-ok response arrives.\n[\e[32mVersion
249
- 0.8.0\e[0m] [API] AMQP::Queue#unbind now accepts :routing_key as alias to :key.
250
- we believe it is a good idea to use AMQP terms.\n[\e[32mVersion 0.8.0\e[0m] [API]
251
- AMQP::Channel#prefetch now takes (an optional) 2nd parameter that specifies that
252
- QoS settings should be applied to underlying connection, as well as optional callback.\n[\e[32mVersion
253
- 0.8.0\e[0m] [API] AMQP::Channel#recover now takes (an optional) callback that is
254
- called when basic.recover-ok is received.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Frame
255
- is gone.\n[\e[32mVersion 0.8.0\e[0m] [API] AMQP::Buffer is gone. Serialization &
256
- framing are now handled primarily by amq-protocol.\n[\e[32mVersion 0.8.0\e[0m] [API]
257
- AMQP::Queue#publish is deprecated.\n[\e[32mVersion 0.8.0\e[0m] [API] Name argument
258
- for AMQP::Queue.new and Channel#queue is optional.\n"
259
- rdoc_options:
234
+
235
+ post_install_message: "[\e[32mVersion 0.8.0\e[0m] [API] Connection URI (string) format for vhosts no longer assumes that vhosts begin with a slash (/), learn more at http://bit.ly/mfzwcB\n\
236
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] Returned messages, including header & content via AMQP::Exchange#on_publish. Callback accepts 3 args: basic_return, header, body\n\
237
+ [\e[32mVersion 0.8.0\e[0m] [BUG] Ruby 1.8.7-p249 is not supported because of this (p249-specific) Ruby bug: http://bit.ly/iONBmH\n\
238
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] AMQP::Utilities::EventLoopHelper detects app server (if any) being used and starts EventMachine reactor in an optimal way.\n\
239
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] AMQP 0.9.1 support, including tx.* operations class.\n\
240
+ [\e[32mVersion 0.8.0\e[0m] [API] Default authentication handler now raises AMQP::PossibleAuthenticationFailureError\n\
241
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel#initialize now takes 3rd (optional) options hash.\n\
242
+ [\e[32mVersion 0.8.0\e[0m] [API] Broker connection class is now AMQP::Session.\n\
243
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Error instance now may carry cause, an exception that caused exception in question to be raised.\n\
244
+ [\e[32mVersion 0.8.0\e[0m] [API] When initial TCP connection fails, default action is now to raise AMQP::TCPConnectionFailed.\n\
245
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::BasicClient#reconnect now takes 2nd optional argument, period of waiting in seconds.\n\
246
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] Handlers for initial connection failure, connection loss; channel-level exceptions handlers on Channel instances.\n\
247
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Exchange#initialize now accepts :arguments option that takes a hash.\n\
248
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#initialize now accepts :arguments option that takes a hash.\n\
249
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP#Logger is deprecated. It will be removed before 1.0 release.\n\
250
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP#fork is deprecated. It will be removed before 1.0 release.\n\
251
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::RPC is deprecated. It will be removed before 1.0 release.\n\
252
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] Significant improvements to the documentation. From now on lack of/poor documentation is considered a severe bug.\n\
253
+ [\e[32mVersion 0.8.0\e[0m] [FEATURE] Support for RabbitMQ extensions to AMQP 0.9.1\n\
254
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Exchange#publish now accepts (an optional) callback.\n\
255
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel.new now accepts (an optional) callback.\n\
256
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Header#ack now can acknowledge multiple deliveries\n\
257
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Exchange#delete now takes (an optional) block that is called when exchange.delete-ok response arrives.\n\
258
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Header now implements #to_hash\n\
259
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#pop block now can take 1, 2 or 3 arguments.\n\
260
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#purge now takes an optional block which is called when queue.purge-ok response arrives.\n\
261
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#delete now takes an optional block which is called when queue.delete-ok response arrives.\n\
262
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#delete now accepts :nowait option.\n\
263
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#unbind now takes an optional block which is called when queue.unbind-ok response arrives.\n\
264
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#unbind now accepts :routing_key as alias to :key. we believe it is a good idea to use AMQP terms.\n\
265
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel#prefetch now takes (an optional) 2nd parameter that specifies that QoS settings should be applied to underlying connection, as well as optional callback.\n\
266
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Channel#recover now takes (an optional) callback that is called when basic.recover-ok is received.\n\
267
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Frame is gone.\n\
268
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Buffer is gone. Serialization & framing are now handled primarily by amq-protocol.\n\
269
+ [\e[32mVersion 0.8.0\e[0m] [API] AMQP::Queue#publish is deprecated.\n\
270
+ [\e[32mVersion 0.8.0\e[0m] [API] Name argument for AMQP::Queue.new and Channel#queue is optional.\n"
271
+ rdoc_options:
260
272
  - --include=examples --main README.textile
261
- require_paths:
273
+ require_paths:
262
274
  - lib
263
- required_ruby_version: !ruby/object:Gem::Requirement
275
+ required_ruby_version: !ruby/object:Gem::Requirement
264
276
  none: false
265
- requirements:
266
- - - ! '>='
267
- - !ruby/object:Gem::Version
268
- version: '0'
269
- required_rubygems_version: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ hash: 3
281
+ segments:
282
+ - 0
283
+ version: "0"
284
+ required_rubygems_version: !ruby/object:Gem::Requirement
270
285
  none: false
271
- requirements:
272
- - - ! '>'
273
- - !ruby/object:Gem::Version
286
+ requirements:
287
+ - - ">"
288
+ - !ruby/object:Gem::Version
289
+ hash: 25
290
+ segments:
291
+ - 1
292
+ - 3
293
+ - 1
274
294
  version: 1.3.1
275
295
  requirements: []
296
+
276
297
  rubyforge_project: amqp
277
- rubygems_version: 1.8.1
298
+ rubygems_version: 1.8.2
278
299
  signing_key:
279
300
  specification_version: 3
280
301
  summary: AMQP client implementation in Ruby/EventMachine.
281
302
  test_files: []
303
+