amqp 1.0.0.pre2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/.travis.yml +3 -0
  2. data/README.md +80 -72
  3. data/amqp.gemspec +5 -13
  4. data/docs/08Migration.textile +4 -0
  5. data/docs/AMQP091ModelExplained.textile +6 -1
  6. data/docs/Bindings.textile +4 -0
  7. data/docs/Clustering.textile +4 -0
  8. data/docs/ConnectingToTheBroker.textile +4 -0
  9. data/docs/ConnectionEncryptionWithTLS.textile +4 -0
  10. data/docs/DocumentationGuidesIndex.textile +4 -0
  11. data/docs/Durability.textile +4 -0
  12. data/docs/ErrorHandling.textile +4 -0
  13. data/docs/Exchanges.textile +4 -0
  14. data/docs/GettingStarted.textile +4 -0
  15. data/docs/PatternsAndUseCases.textile +4 -1
  16. data/docs/Queues.textile +4 -0
  17. data/docs/RabbitMQVersions.textile +4 -0
  18. data/docs/RunningTests.textile +4 -0
  19. data/docs/TestingWithEventedSpec.textile +4 -0
  20. data/docs/Troubleshooting.textile +4 -0
  21. data/docs/VendorSpecificExtensions.textile +4 -0
  22. data/examples/error_handling/automatic_recovery_of_channel_and_queues.rb +1 -1
  23. data/examples/error_handling/automatically_recovering_hello_world_consumer.rb +1 -1
  24. data/examples/error_handling/automatically_recovering_hello_world_consumer_that_uses_a_server_named_queue.rb +1 -1
  25. data/examples/error_handling/connection_level_exception.rb +1 -1
  26. data/examples/error_handling/connection_level_exception_with_objects.rb +1 -1
  27. data/examples/error_handling/connection_loss_handler.rb +4 -3
  28. data/examples/error_handling/hello_world_producer.rb +1 -1
  29. data/examples/error_handling/manual_connection_and_channel_recovery.rb +1 -1
  30. data/examples/extensions/rabbitmq/publisher_confirmations_with_transient_messages.rb +1 -1
  31. data/examples/extensions/rabbitmq/using_alternate_exchanges.rb +1 -1
  32. data/examples/guides/getting_started/01_hello_world.rb +1 -1
  33. data/examples/guides/getting_started/02_hello_world_dslified.rb +1 -1
  34. data/examples/hello_world.rb +1 -1
  35. data/examples/hello_world_with_an_empty_string.rb +1 -1
  36. data/examples/hello_world_with_eventmachine_in_a_separate_thread.rb +2 -2
  37. data/examples/hello_world_with_large_payload.rb +41 -41
  38. data/examples/patterns/request_reply/client.rb +1 -2
  39. data/examples/patterns/request_reply/server.rb +0 -1
  40. data/examples/publishing/returned_messages.rb +1 -1
  41. data/examples/queues/accessing_message_metadata.rb +1 -1
  42. data/examples/queues/cancel_default_consumer.rb +1 -1
  43. data/lib/amqp/channel.rb +34 -16
  44. data/lib/amqp/client.rb +2 -2
  45. data/lib/amqp/connection.rb +2 -1
  46. data/lib/amqp/consumer.rb +2 -2
  47. data/lib/amqp/exceptions.rb +11 -2
  48. data/lib/amqp/exchange.rb +5 -5
  49. data/lib/amqp/queue.rb +51 -26
  50. data/lib/amqp/session.rb +5 -5
  51. data/lib/amqp/version.rb +1 -1
  52. data/spec/integration/basic_get_spec.rb +82 -27
  53. data/spec/integration/basic_return_spec.rb +3 -3
  54. data/spec/integration/channel_level_exception_with_multiple_channels_spec.rb +0 -1
  55. data/spec/integration/exchange_declaration_spec.rb +71 -102
  56. data/spec/integration/extensions/rabbitmq/publisher_confirmations_spec.rb +1 -1
  57. data/spec/integration/fanout_exchange_routing_spec.rb +1 -1
  58. data/spec/integration/multiple_consumers_per_queue_spec.rb +3 -160
  59. data/spec/integration/queue_redeclaration_with_incompatible_attributes_spec.rb +25 -12
  60. data/spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb +1 -1
  61. data/spec/integration/remove_individual_binding_spec.rb +51 -0
  62. data/spec/integration/reply_queue_communication_spec.rb +1 -2
  63. data/spec/integration/store_and_forward_spec.rb +6 -9
  64. data/spec/integration/topic_subscription_spec.rb +5 -4
  65. data/spec/spec_helper.rb +8 -2
  66. data/spec/unit/amqp/connection_spec.rb +3 -1
  67. metadata +93 -109
  68. data/spec/integration/immediate_messages_spec.rb +0 -59
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe AMQP do
5
+ describe "AMQP queue redeclaration with different attributes" do
6
6
 
7
7
  #
8
8
  # Environment
@@ -17,7 +17,7 @@ describe AMQP do
17
17
  # Examples
18
18
  #
19
19
 
20
- context "when queue is redeclared with different attributes" do
20
+ context "when :durable value is different" do
21
21
  let(:name) { "amqp-gem.nondurable.queue" }
22
22
  let(:options) {
23
23
  { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false }
@@ -25,35 +25,48 @@ describe AMQP do
25
25
  let(:different_options) {
26
26
  { :durable => true, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false}
27
27
  }
28
- let(:irrelevant_different_options) {
29
- { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false, :header => {:random => 'stuff' } }
30
- }
31
28
 
32
29
 
33
30
  it "should raise AMQP::IncompatibleOptionsError for incompatable options" do
34
31
  channel = AMQP::Channel.new
35
- channel.on_error do |ch, close|
36
- @callback_fired = true
32
+ channel.on_error do |ch, channel_close|
33
+ @error_code = channel_close.reply_code
37
34
  end
38
35
 
39
36
  channel.queue(name, options)
40
37
  expect {
41
38
  channel.queue(name, different_options)
42
39
  }.to raise_error(AMQP::IncompatibleOptionsError)
43
- done
40
+
41
+ done(0.5) {
42
+ @error_code.should == 406
43
+ }
44
44
  end
45
+ end
46
+
47
+ context "when :headers are different" do
48
+ let(:name) { "amqp-gem.nondurable.queue" }
49
+ let(:options) {
50
+ { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false }
51
+ }
52
+ let(:different_options) {
53
+ { :durable => false, :exclusive => true, :auto_delete => true, :arguments => {}, :passive => false, :header => {:random => 'stuff' } }
54
+ }
45
55
 
46
56
  it "should not raise AMQP::IncompatibleOptionsError for irrelevant options" do
47
57
  channel = AMQP::Channel.new
48
- channel.on_error do |ch, close|
49
- @callback_fired = true
58
+ channel.on_error do |ch, channel_close|
59
+ @error_code = channel_close.reply_code
50
60
  end
51
61
 
52
62
  channel.queue(name, options)
53
63
  expect {
54
- channel.queue(name, irrelevant_different_options)
64
+ channel.queue(name, different_options)
55
65
  }.to_not raise_error(AMQP::IncompatibleOptionsError)
56
- done
66
+
67
+ done(0.5) {
68
+ @error_code.should == 406
69
+ }
57
70
  end
58
71
  end
59
72
  end # describe AMQP
@@ -73,7 +73,7 @@ if mri?
73
73
  20.times do
74
74
  Thread.new do
75
75
  messages.each do |message|
76
- exchange.publish(message, :routing_key => queue.name, :immediate => true, :mandatory => true)
76
+ exchange.publish(message, :routing_key => queue.name, :mandatory => true)
77
77
  end
78
78
  end
79
79
  end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "An individual binding" do
6
+
7
+ #
8
+ # Environment
9
+ #
10
+
11
+ include EventedSpec::AMQPSpec
12
+
13
+ default_timeout 3
14
+
15
+ amqp_before do
16
+ @channel = AMQP::Channel.new
17
+ @channel.should be_open
18
+ @channel.on_error do |ch, close|
19
+ raise "Channel-level error!: #{close.inspect}"
20
+ end
21
+ end
22
+
23
+
24
+ default_options AMQP_OPTS
25
+
26
+
27
+ it "can be deleted by specifying routing key" do
28
+ flag1 = false
29
+ flag2 = false
30
+
31
+ x = @channel.direct("amqpgem.examples.imaging")
32
+
33
+ q = @channel.queue("", :exclusive => true)
34
+ q.bind(x, :routing_key => "resize").bind(x, :routing_key => "watermark").subscribe do |meta, payload|
35
+ flag1 = (meta.routing_key == "watermark")
36
+ flag2 = (meta.routing_key == "resize")
37
+ end
38
+
39
+ EventMachine.add_timer(0.5) do
40
+ q.unbind(x, :routing_key => "resize") do
41
+ x.publish("some data", :routing_key => "resize")
42
+ x.publish("some data", :routing_key => "watermark")
43
+ end
44
+
45
+ done(1.0) {
46
+ flag1.should be_true
47
+ flag2.should be_false
48
+ }
49
+ end
50
+ end
51
+ end
@@ -53,8 +53,7 @@ describe "Exclusive server-named queue" do
53
53
  :reply_to => queue2.name,
54
54
  :app_id => "Client",
55
55
  :timestamp => request_timestamp,
56
- :mandatory => true,
57
- :immediate => true)
56
+ :mandatory => true)
58
57
 
59
58
  done(0.2) {
60
59
  queue1.unsubscribe
@@ -53,19 +53,16 @@ describe "Store-and-forward routing" do
53
53
  @queue.subscribe(:ack => false) do |payload|
54
54
  payload.should_not be_nil
55
55
  number_of_received_messages += 1
56
- if RUBY_VERSION =~ /^1.9/
57
- payload.force_encoding("UTF-8").should == dispatched_data
58
- else
59
- payload.should == dispatched_data
60
- end
56
+ payload.should == dispatched_data
61
57
  end # subscribe
62
58
 
63
- expected_number_of_messages.times do
64
- @exchange.publish(dispatched_data, :routing_key => @queue_name)
59
+ delayed(0.3) do
60
+ expected_number_of_messages.times do
61
+ @exchange.publish(dispatched_data, :routing_key => @queue_name)
62
+ end
65
63
  end
66
64
 
67
- # 6 seconds are for Rubinius, it is surprisingly slow on this workload
68
- done(6.0) {
65
+ done(4.0) {
69
66
  number_of_received_messages.should == expected_number_of_messages
70
67
  @queue.unsubscribe
71
68
  }
@@ -66,9 +66,9 @@ describe "Topic-based subscription" do
66
66
  # publish some messages none of our queues should be receiving
67
67
  3.times do
68
68
  @exchange.publish(626 + rand(1000)/400.0, :key => "nasdaq.goog")
69
- end # do
69
+ end
70
70
 
71
- done(0.4) {
71
+ done(0.5) {
72
72
  received_messages.should == expected_messages
73
73
  @aapl_queue.unsubscribe
74
74
  @amzn_queue.unsubscribe
@@ -117,7 +117,7 @@ describe "Topic-based subscription" do
117
117
  @exchange.publish("Blatche, Wall lead Wizards over Jazz 108-101", :key => "sports.nba.jazz")
118
118
  @exchange.publish("Deron Williams Receives NBA Cares Community Assist Award", :key => "sports.nba.jazz")
119
119
 
120
- done(0.2) {
120
+ done(0.6) {
121
121
  received_messages.should == expected_messages
122
122
 
123
123
  @nba_queue.unsubscribe
@@ -151,6 +151,7 @@ describe "Topic-based subscription" do
151
151
  @celtics_queue.name => 3
152
152
  }
153
153
 
154
+
154
155
  @sports_queue.bind(@exchange, :key => "sports.#").subscribe do |payload|
155
156
  received_messages[@sports_queue.name] += 1
156
157
  end
@@ -180,7 +181,7 @@ describe "Topic-based subscription" do
180
181
  @exchange.publish("Philadelphia's Daniel Briere has been named as an All-Star replacement for Jarome Iginla.", :key => "sports.nhl.allstargame")
181
182
  @exchange.publish("Devils blank Sid- and Malkin-less Penguins 2-0", :key => "sports.nhl.penguins")
182
183
 
183
- done(0.2) {
184
+ done(0.5) {
184
185
  received_messages.should == expected_messages
185
186
 
186
187
  @sports_queue.unsubscribe
@@ -15,6 +15,12 @@ puts "Using Ruby #{RUBY_VERSION}, amq-client #{AMQ::Client::VERSION} and amq-pro
15
15
 
16
16
  amqp_config = File.dirname(__FILE__) + '/amqp.yml'
17
17
 
18
+ port = if ENV["TRACER"]
19
+ 5673
20
+ else
21
+ 5672
22
+ end
23
+
18
24
  if File.exists? amqp_config
19
25
  class Hash
20
26
  def symbolize_keys
@@ -28,7 +34,7 @@ if File.exists? amqp_config
28
34
  end
29
35
  AMQP_OPTS = YAML::load_file(amqp_config).symbolize_keys[:test]
30
36
  else
31
- AMQP_OPTS = {:host => 'localhost', :port => 5672}
37
+ AMQP_OPTS = {:host => 'localhost', :port => port}
32
38
  end
33
39
 
34
40
  # puts "AMQP_OPTS = #{AMQP_OPTS.inspect}"
@@ -82,4 +88,4 @@ module PlatformDetection
82
88
  def rubinius?
83
89
  defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'rbx')
84
90
  end
85
- end
91
+ end
@@ -28,7 +28,9 @@ describe AMQP, 'class object' do
28
28
  :logging => false,
29
29
  :ssl => false,
30
30
  :broker => nil,
31
- :frame_max => 131072
31
+ :frame_max => 131072,
32
+ :heartbeat => 0,
33
+ :auth_mechanism => "PLAIN"
32
34
  }
33
35
  end
34
36
 
metadata CHANGED
@@ -1,109 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
- version: !ruby/object:Gem::Version
4
- hash: -1633158744
5
- prerelease: 6
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- - pre
11
- - 2
12
- version: 1.0.0.pre2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Aman Gupta
16
9
  - Jakub Stastny aka botanicus
17
10
  - Michael S. Klishin
18
- autorequire:
11
+ autorequire:
19
12
  bindir: bin
20
13
  cert_chain: []
21
-
22
- date: 2012-07-03 00:00:00 Z
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
14
+ date: 2013-03-24 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
25
17
  name: eventmachine
26
- prerelease: false
27
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: !binary |-
23
+ MA==
28
24
  none: false
29
- requirements:
25
+ requirement: !ruby/object:Gem::Requirement
26
+ requirements:
30
27
  - - ">="
31
- - !ruby/object:Gem::Version
32
- hash: 3
33
- segments:
34
- - 0
35
- version: "0"
28
+ - !ruby/object:Gem::Version
29
+ version: !binary |-
30
+ MA==
31
+ none: false
32
+ prerelease: false
36
33
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
34
+ - !ruby/object:Gem::Dependency
39
35
  name: amq-client
40
- prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
42
41
  none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: -1633158744
47
- segments:
48
- - 1
49
- - 0
50
- - 0
51
- - pre
52
- - 2
53
- version: 1.0.0.pre2
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.0
47
+ none: false
48
+ prerelease: false
54
49
  type: :runtime
55
- version_requirements: *id002
56
- - !ruby/object:Gem::Dependency
50
+ - !ruby/object:Gem::Dependency
57
51
  name: amq-protocol
58
- prerelease: false
59
- requirement: &id003 !ruby/object:Gem::Requirement
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: 1.2.0
57
+ none: false
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 1.2.0
60
63
  none: false
61
- requirements:
62
- - - ~>
63
- - !ruby/object:Gem::Version
64
- hash: -1633158752
65
- segments:
66
- - 1
67
- - 0
68
- - 0
69
- - pre
70
- - 6
71
- version: 1.0.0.pre6
64
+ prerelease: false
72
65
  type: :runtime
73
- version_requirements: *id003
74
- description: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included.
75
- email:
76
- - michael@novemberain.com
77
- - stastny@101ideas.cz
66
+ description: Widely used, feature-rich asynchronous AMQP RabbitMQ client with batteries included.
67
+ email:
68
+ - !binary |-
69
+ bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=
70
+ - !binary |-
71
+ c3Rhc3RueUAxMDFpZGVhcy5jeg==
78
72
  executables: []
79
-
80
73
  extensions: []
81
-
82
- extra_rdoc_files:
74
+ extra_rdoc_files:
83
75
  - README.md
76
+ - docs/08Migration.textile
77
+ - docs/AMQP091ModelExplained.textile
78
+ - docs/Bindings.textile
79
+ - docs/Clustering.textile
80
+ - docs/ConnectingToTheBroker.textile
81
+ - docs/ConnectionEncryptionWithTLS.textile
82
+ - docs/DocumentationGuidesIndex.textile
84
83
  - docs/Durability.textile
84
+ - docs/ErrorHandling.textile
85
85
  - docs/Exchanges.textile
86
+ - docs/GettingStarted.textile
86
87
  - docs/PatternsAndUseCases.textile
87
- - docs/ConnectingToTheBroker.textile
88
- - docs/ConnectionEncryptionWithTLS.textile
88
+ - docs/Queues.textile
89
+ - docs/RabbitMQVersions.textile
89
90
  - docs/RunningTests.textile
90
- - docs/DocumentationGuidesIndex.textile
91
+ - docs/TestingWithEventedSpec.textile
91
92
  - docs/Troubleshooting.textile
92
- - docs/RabbitMQVersions.textile
93
- - docs/Queues.textile
94
- - docs/08Migration.textile
95
93
  - docs/VendorSpecificExtensions.textile
96
- - docs/AMQP091ModelExplained.textile
97
- - docs/Bindings.textile
98
- - docs/GettingStarted.textile
99
- - docs/ErrorHandling.textile
100
- - docs/Clustering.textile
101
- - docs/TestingWithEventedSpec.textile
102
- files:
103
- - .gitignore
104
- - .rspec
105
- - .travis.yml
106
- - .yardopts
94
+ files:
95
+ - ".gitignore"
96
+ - ".rspec"
97
+ - ".travis.yml"
98
+ - ".yardopts"
107
99
  - CHANGELOG
108
100
  - Gemfile
109
101
  - README.md
@@ -291,7 +283,6 @@ files:
291
283
  - spec/integration/fanout_exchange_routing_spec.rb
292
284
  - spec/integration/headers_exchange_routing_spec.rb
293
285
  - spec/integration/hello_world_spec.rb
294
- - spec/integration/immediate_messages_spec.rb
295
286
  - spec/integration/mandatory_messages_spec.rb
296
287
  - spec/integration/message_acknowledgement_spec.rb
297
288
  - spec/integration/message_metadata_access_spec.rb
@@ -307,6 +298,7 @@ files:
307
298
  - spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb
308
299
  - spec/integration/regressions/empty_message_body_spec.rb
309
300
  - spec/integration/regressions/issue66_spec.rb
301
+ - spec/integration/remove_individual_binding_spec.rb
310
302
  - spec/integration/reply_queue_communication_spec.rb
311
303
  - spec/integration/store_and_forward_spec.rb
312
304
  - spec/integration/stress/publishing_of_messages_with_incrementing_sizes_spec.rb
@@ -319,41 +311,33 @@ files:
319
311
  - spec/unit/amqp/client_spec.rb
320
312
  - spec/unit/amqp/connection_spec.rb
321
313
  - spec/unit/amqp/int_allocator_spec.rb
322
- homepage: http://github.com/ruby-amqp/amqp
323
- licenses:
314
+ homepage: http://rubyamqp.info
315
+ licenses:
324
316
  - Ruby
325
- post_install_message: "[\e[32mVersion 1.0.0\e[0m] [API] All public API bits deprecated in 0.8.0 are COMPLETELY REMOVED\n"
326
- rdoc_options:
327
- - --include=examples --main README.md
328
- require_paths:
317
+ post_install_message:
318
+ rdoc_options:
319
+ - "--include=examples --main README.md"
320
+ require_paths:
329
321
  - lib
330
- required_ruby_version: !ruby/object:Gem::Requirement
322
+ required_ruby_version: !ruby/object:Gem::Requirement
323
+ requirements:
324
+ - - ">="
325
+ - !ruby/object:Gem::Version
326
+ version: !binary |-
327
+ MA==
331
328
  none: false
332
- requirements:
329
+ required_rubygems_version: !ruby/object:Gem::Requirement
330
+ requirements:
333
331
  - - ">="
334
- - !ruby/object:Gem::Version
335
- hash: 3
336
- segments:
337
- - 0
338
- version: "0"
339
- required_rubygems_version: !ruby/object:Gem::Requirement
332
+ - !ruby/object:Gem::Version
333
+ version: !binary |-
334
+ MA==
340
335
  none: false
341
- requirements:
342
- - - ">"
343
- - !ruby/object:Gem::Version
344
- hash: 25
345
- segments:
346
- - 1
347
- - 3
348
- - 1
349
- version: 1.3.1
350
336
  requirements: []
351
-
352
337
  rubyforge_project: amqp
353
338
  rubygems_version: 1.8.24
354
- signing_key:
339
+ signing_key:
355
340
  specification_version: 3
356
- summary: Widely used, feature-rich asynchronous AMQP 0.9.1 client with batteries included
341
+ summary: Widely used, feature-rich asynchronous RabbitMQ client with batteries included
357
342
  test_files: []
358
-
359
- has_rdoc:
343
+ has_rdoc: