amqp 0.9.10 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.travis.yml +0 -3
  2. data/CHANGELOG +4 -0
  3. data/Gemfile +1 -0
  4. data/README.md +72 -81
  5. data/amqp.gemspec +14 -5
  6. data/docs/08Migration.textile +0 -4
  7. data/docs/AMQP091ModelExplained.textile +0 -5
  8. data/docs/Bindings.textile +0 -4
  9. data/docs/Clustering.textile +0 -4
  10. data/docs/ConnectingToTheBroker.textile +1 -5
  11. data/docs/ConnectionEncryptionWithTLS.textile +0 -4
  12. data/docs/DocumentationGuidesIndex.textile +0 -4
  13. data/docs/Durability.textile +0 -4
  14. data/docs/ErrorHandling.textile +40 -106
  15. data/docs/Exchanges.textile +0 -4
  16. data/docs/GettingStarted.textile +6 -10
  17. data/docs/PatternsAndUseCases.textile +1 -4
  18. data/docs/Queues.textile +0 -4
  19. data/docs/RabbitMQVersions.textile +0 -4
  20. data/docs/RunningTests.textile +0 -4
  21. data/docs/TestingWithEventedSpec.textile +0 -4
  22. data/docs/Troubleshooting.textile +0 -4
  23. data/docs/VendorSpecificExtensions.textile +0 -4
  24. data/examples/error_handling/hello_world_producer.rb +1 -1
  25. data/examples/issues/issue_121.rb +23 -0
  26. data/examples/patterns/request_reply/client.rb +2 -1
  27. data/examples/patterns/request_reply/server.rb +1 -0
  28. data/examples/publishing/returned_messages.rb +1 -1
  29. data/lib/amqp.rb +0 -7
  30. data/lib/amqp/channel.rb +15 -33
  31. data/lib/amqp/client.rb +2 -2
  32. data/lib/amqp/compatibility/ruby187_patchlevel_check.rb +4 -4
  33. data/lib/amqp/connection.rb +0 -1
  34. data/lib/amqp/consumer.rb +2 -2
  35. data/lib/amqp/exceptions.rb +1 -10
  36. data/lib/amqp/exchange.rb +5 -5
  37. data/lib/amqp/queue.rb +23 -47
  38. data/lib/amqp/session.rb +4 -4
  39. data/lib/amqp/version.rb +1 -1
  40. data/spec/integration/basic_get_spec.rb +24 -80
  41. data/spec/integration/basic_return_spec.rb +3 -3
  42. data/spec/integration/channel_level_exception_with_multiple_channels_spec.rb +1 -0
  43. data/spec/integration/exchange_declaration_spec.rb +102 -71
  44. data/spec/integration/extensions/rabbitmq/publisher_confirmations_spec.rb +17 -1
  45. data/spec/integration/fanout_exchange_routing_spec.rb +1 -1
  46. data/spec/integration/immediate_messages_spec.rb +59 -0
  47. data/spec/integration/multiple_consumers_per_queue_spec.rb +101 -39
  48. data/spec/integration/queue_redeclaration_with_incompatible_attributes_spec.rb +12 -25
  49. data/spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb +1 -1
  50. data/spec/integration/reply_queue_communication_spec.rb +2 -1
  51. data/spec/integration/store_and_forward_spec.rb +9 -6
  52. data/spec/integration/topic_subscription_spec.rb +4 -5
  53. data/spec/spec_helper.rb +2 -8
  54. data/spec/unit/amqp/connection_spec.rb +1 -3
  55. metadata +112 -116
  56. data/examples/deprecated/default_thread_local_channel_instance.rb +0 -34
  57. data/examples/legacy/ack.rb +0 -70
  58. data/examples/legacy/callbacks.rb +0 -45
  59. data/examples/legacy/clock.rb +0 -74
  60. data/examples/legacy/hashtable.rb +0 -60
  61. data/examples/legacy/logger.rb +0 -92
  62. data/examples/legacy/multiclock.rb +0 -56
  63. data/examples/legacy/pingpong.rb +0 -51
  64. data/examples/legacy/primes-simple.rb +0 -29
  65. data/examples/legacy/primes.rb +0 -74
  66. data/examples/legacy/stocks.rb +0 -59
  67. data/lib/amqp/deprecated/fork.rb +0 -17
  68. data/lib/amqp/deprecated/logger.rb +0 -100
  69. data/lib/amqp/deprecated/mq.rb +0 -22
  70. data/lib/amqp/deprecated/rpc.rb +0 -169
  71. data/lib/amqp/ext/em.rb +0 -3
  72. data/lib/amqp/ext/emfork.rb +0 -72
  73. data/lib/amqp/logger.rb +0 -19
  74. data/lib/amqp/rpc.rb +0 -20
  75. data/lib/mq.rb +0 -35
  76. data/lib/mq/logger.rb +0 -4
  77. data/lib/mq/rpc.rb +0 -4
  78. data/spec/integration/remove_individual_binding_spec.rb +0 -51
@@ -110,7 +110,7 @@ module AMQP
110
110
 
111
111
 
112
112
  # Properly close connection with AMQ broker, as described in
113
- # section 2.2.4 of the {http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification}.
113
+ # section 2.2.4 of the {http://bit.ly/hw2ELX AMQP 0.9.1 specification}.
114
114
  #
115
115
  # @api plugin
116
116
  # @see #close_connection
@@ -129,19 +129,19 @@ module AMQP
129
129
  # Server properties (product information, platform, et cetera)
130
130
  #
131
131
  # @return [Hash]
132
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
132
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
133
133
  attr_reader :server_properties
134
134
 
135
135
  # Server capabilities (usually used to detect AMQP 0.9.1 extensions like basic.nack, publisher
136
136
  # confirms and so on)
137
137
  #
138
138
  # @return [Hash]
139
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
139
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
140
140
  attr_reader :server_capabilities
141
141
 
142
142
  # Locales server supports
143
143
  #
144
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
144
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
145
145
  attr_reader :server_locales
146
146
 
147
147
  # @return [AMQP::Broker] Broker this connection is established with
@@ -6,5 +6,5 @@ module AMQP
6
6
  #
7
7
  # @see AMQ::Protocol::VERSION
8
8
  # @return [String] AMQP gem version
9
- VERSION = '0.9.10'
9
+ VERSION = '1.0.0.pre1'
10
10
  end
@@ -61,92 +61,36 @@ describe AMQP::Queue, "#pop" do
61
61
 
62
62
  context "when THERE ARE messages in the queue" do
63
63
  it "yields message payload to the callback" do
64
- @channel.default_exchange.publish(@dispatched_data, :routing_key => @queue.name)
64
+ number_of_received_messages = 0
65
+ expected_number_of_messages = 300
65
66
 
66
- @queue.pop do |headers, payload|
67
- payload.should == @dispatched_data
67
+ expected_number_of_messages.times do |i|
68
+ @exchange.publish(@dispatched_data + "_#{i}", :key => @queue_name)
68
69
  end
69
70
 
70
- delayed(0.5) {
71
+ @queue.status do |number_of_messages, number_of_consumers|
72
+ expected_number_of_messages.times do
73
+ @queue.pop do |headers, payload|
74
+ payload.should_not be_nil
75
+ number_of_received_messages += 1
76
+ headers.message_count.should == (expected_number_of_messages - number_of_received_messages)
77
+
78
+ if RUBY_VERSION =~ /^1.9/
79
+ payload.force_encoding("UTF-8").should =~ /#{@dispatched_data}/
80
+ else
81
+ payload.should =~ /#{@dispatched_data}/
82
+ end
83
+ end # pop
84
+ end # do
85
+ end
86
+
87
+ delayed(1.3) {
71
88
  # Queue.Get doesn't qualify for subscription, hence, manual deletion is required
72
89
  @queue.delete
73
90
  }
74
- done(0.8)
91
+ done(2.5) {
92
+ number_of_received_messages.should == expected_number_of_messages
93
+ }
75
94
  end # it
76
95
  end # context
77
-
78
-
79
- context "with manual acknowledgements" do
80
- default_timeout 4
81
-
82
- let(:queue_name) { "amqpgem.integration.basic.get.acks.manual#{rand}" }
83
-
84
- it "does not remove messages from the queue unless ack-ed" do
85
- ch1 = AMQP::Channel.new
86
- ch2 = AMQP::Channel.new
87
-
88
- ch1.on_error do |ch, close_ok|
89
- puts "Channel error: #{close_ok.reply_code} #{close_ok.reply_text}"
90
- end
91
-
92
- q = ch1.queue(queue_name, :exclusive => true)
93
- x = ch1.default_exchange
94
-
95
- q.purge
96
- delayed(0.2) { x.publish(@dispatched_data, :routing_key => q.name) }
97
-
98
- delayed(0.5) {
99
- q.pop(:ack => true) do |meta, payload|
100
- # never ack
101
- end
102
-
103
- ch1.close
104
-
105
- EventMachine.add_timer(0.7) {
106
- ch2.queue(queue_name, :exclusive => true).status do |number_of_messages, number_of_consumers|
107
- number_of_messages.should == 1
108
- done
109
- end
110
- }
111
- }
112
- end
113
- end
114
-
115
-
116
-
117
- context "with automatic acknowledgements" do
118
- default_timeout 4
119
-
120
- let(:queue_name) { "amqpgem.integration.basic.get.acks.automatic#{rand}" }
121
-
122
- it "does remove messages from the queue after delivery" do
123
- ch1 = AMQP::Channel.new
124
- ch2 = AMQP::Channel.new
125
-
126
- ch1.on_error do |ch, close_ok|
127
- puts "Channel error: #{close_ok.reply_code} #{close_ok.reply_text}"
128
- end
129
-
130
- q = ch1.queue(queue_name, :exclusive => true)
131
- x = ch1.default_exchange
132
-
133
- q.purge
134
- x.publish(@dispatched_data, :routing_key => q.name)
135
-
136
- delayed(0.5) {
137
- q.pop(:ack => false) do |meta, payload|
138
- # never ack
139
- end
140
-
141
- ch1.close
142
-
143
- EventMachine.add_timer(0.5) {
144
- ch2.queue(queue_name, :exclusive => true).status do |number_of_messages, number_of_consumers|
145
- number_of_messages.should == 0
146
- done
147
- end
148
- }
149
- }
150
- end
151
- end
152
96
  end # describe
@@ -38,11 +38,11 @@ describe "Message published as mandatory" do
38
38
  @exchange.on_return do |basic_return, header, body|
39
39
  returned_messages << basic_return.reply_text
40
40
  end
41
- (1..10).to_a.each { |m| @exchange.publish(m, :mandatory => true) }
41
+ (1..10).to_a.each { |m| @exchange.publish(m, :immediate => true) }
42
42
 
43
43
  done(1.0) {
44
- returned_messages.should == Array.new(10) { "NO_ROUTE" }
44
+ returned_messages.should == Array.new(10) { "NO_CONSUMERS" }
45
45
  }
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -53,6 +53,7 @@ describe AMQP do
53
53
  }
54
54
 
55
55
  delayed(0.3) {
56
+ @q1.delete
56
57
  @q2.delete
57
58
  }
58
59
 
@@ -127,14 +127,27 @@ describe AMQP::Channel do
127
127
  end # context
128
128
 
129
129
 
130
+ context "when exchange name was specified as a blank string" do
131
+ it 'returns direct exchange with server-generated name' do
132
+ pending <<-EOF
133
+ This has to be fixed in RabbitMQ first
134
+ https://bugzilla.rabbitmq.com/show_bug.cgi?id=23509
135
+ EOF
136
+ @channel.direct("") do |exchange|
137
+ exchange.name.should_not be_empty
138
+ done
139
+ end
140
+ end
141
+ end # context
142
+
143
+
130
144
  context "when passive option is used" do
131
145
  context "and exchange with given name already exists" do
132
146
  it "silently returns" do
133
- name = "a_new_direct_exchange declared at #{Time.now.to_i}"
134
- channel = AMQP::Channel.new
147
+ name = "a_new_direct_exchange declared at #{Time.now.to_i}"
135
148
 
136
- original_exchange = channel.direct(name)
137
- exchange = channel.direct(name, :passive => true)
149
+ original_exchange = @channel.direct(name)
150
+ exchange = @channel.direct(name, :passive => true)
138
151
 
139
152
  exchange.should == original_exchange
140
153
 
@@ -144,16 +157,13 @@ describe AMQP::Channel do
144
157
 
145
158
  context "and exchange with given name DOES NOT exist" do
146
159
  it "raises an exception" do
147
- channel = AMQP::Channel.new
148
- channel.on_error do |ch, channel_close|
149
- @error_code = channel_close.reply_code
150
- end
160
+ pending "Not yet supported"
151
161
 
152
- exchange = channel.direct("direct exchange declared at #{Time.now.to_i}", :passive => true)
162
+ expect {
163
+ exchange = @channel.direct("direct exchange declared at #{Time.now.to_i}", :passive => true)
164
+ }.to raise_error
153
165
 
154
- done(0.5) {
155
- @error_code.should == 404
156
- }
166
+ done
157
167
  end # it
158
168
  end # context
159
169
  end # context
@@ -213,16 +223,27 @@ describe AMQP::Channel do
213
223
 
214
224
  context "when exchange is re-declared with parameters different from original declaration" do
215
225
  it "raises an exception" do
216
- channel = AMQP::Channel.new
217
- channel.direct("previously.declared.durable.direct.exchange", :durable => true)
226
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
218
227
 
219
228
  expect {
220
- channel.direct("previously.declared.durable.direct.exchange", :durable => false)
229
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => false)
221
230
  }.to raise_error(AMQP::IncompatibleOptionsError)
222
231
 
223
232
  done
224
233
  end # it
225
234
  end # context
235
+
236
+ context "when exchange is re-declared with irrelevent parameters different from original declaration" do
237
+ it "doesn't raise an exception" do
238
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true)
239
+
240
+ expect {
241
+ @channel.direct("previously.declared.durable.direct.exchange", :durable => true, :header => {:random => 'stuff' })
242
+ }.to_not raise_error(AMQP::IncompatibleOptionsError)
243
+
244
+ done
245
+ end # it
246
+ end # context
226
247
  end # describe
227
248
 
228
249
 
@@ -266,17 +287,12 @@ describe AMQP::Channel do
266
287
  end
267
288
 
268
289
  context "and exchange with given name DOES NOT exist" do
269
- it "results in a channel exception" do
270
- channel = AMQP::Channel.new
271
- channel.on_error do |ch, channel_close|
272
- @error_code = channel_close.reply_code
273
- end
274
-
275
- exchange = channel.fanout("fanout exchange declared at #{Time.now.to_i}", :passive => true)
290
+ it "raises an exception" do
291
+ pending "Not yet supported"
276
292
 
277
- done(0.5) {
278
- @error_code.should == 404
279
- }
293
+ expect {
294
+ exchange = @channel.fanout("fanout exchange declared at #{Time.now.to_i}", :passive => true)
295
+ }.to raise_error
280
296
 
281
297
  done
282
298
  end # it
@@ -338,11 +354,10 @@ describe AMQP::Channel do
338
354
 
339
355
  context "when exchange is re-declared with parameters different from original declaration" do
340
356
  it "raises an exception" do
341
- channel = AMQP::Channel.new
342
- channel.fanout("previously.declared.durable.topic.exchange", :durable => true)
357
+ @channel.fanout("previously.declared.durable.topic.exchange", :durable => true)
343
358
 
344
359
  expect {
345
- channel.fanout("previously.declared.durable.topic.exchange", :durable => false)
360
+ @channel.fanout("previously.declared.durable.topic.exchange", :durable => false)
346
361
  }.to raise_error(AMQP::IncompatibleOptionsError)
347
362
 
348
363
  done
@@ -362,7 +377,7 @@ describe AMQP::Channel do
362
377
  exchange.name.should == name
363
378
 
364
379
  done
365
- end # it
380
+ end
366
381
  end # context
367
382
 
368
383
  context "when exchange name is omitted" do
@@ -372,7 +387,7 @@ describe AMQP::Channel do
372
387
  exchange.name.should_not == "amq.topic2"
373
388
 
374
389
  done
375
- end # it
390
+ end
376
391
  end # context
377
392
 
378
393
  context "when passive option is used" do
@@ -387,23 +402,20 @@ describe AMQP::Channel do
387
402
 
388
403
  done
389
404
  end # it
390
- end # context
405
+ end
391
406
 
392
407
  context "and exchange with given name DOES NOT exist" do
393
- it "results in a channel exception" do
394
- channel = AMQP::Channel.new
395
- channel.on_error do |ch, channel_close|
396
- @error_code = channel_close.reply_code
397
- end
408
+ it "raises an exception" do
409
+ pending "Not yet supported"
398
410
 
399
- exchange = channel.topic("topic exchange declared at #{Time.now.to_i}", :passive => true)
411
+ expect {
412
+ exchange = @channel.topic("topic exchange declared at #{Time.now.to_i}", :passive => true)
413
+ }.to raise_error
400
414
 
401
- done(0.5) {
402
- @error_code.should == 404
403
- }
415
+ done
404
416
  end # it
405
417
  end # context
406
- end
418
+ end # context
407
419
 
408
420
 
409
421
  context "when exchange is declared as durable" do
@@ -458,14 +470,16 @@ describe AMQP::Channel do
458
470
  end # context
459
471
 
460
472
 
461
- context "when exchange is re-declared with parameters different from the original declaration" do
473
+ context "when exchange is re-declared with parameters different from original declaration" do
462
474
  amqp_after do
463
475
  done
464
476
  end
465
477
 
466
478
  it "raises an exception" do
467
479
  channel = AMQP::Channel.new
480
+
468
481
  channel.topic("previously.declared.durable.topic.exchange", :durable => true)
482
+ channel.should be_open
469
483
 
470
484
  expect {
471
485
  channel.topic("previously.declared.durable.topic.exchange", :durable => false)
@@ -484,8 +498,7 @@ describe AMQP::Channel do
484
498
  let(:name) { "new.headers.exchange" }
485
499
 
486
500
  it "declares a new headers exchange with that name" do
487
- channel = AMQP::Channel.new
488
- exchange = channel.headers(name)
501
+ exchange = @channel.headers(name)
489
502
 
490
503
  exchange.name.should == name
491
504
 
@@ -499,8 +512,7 @@ describe AMQP::Channel do
499
512
  end
500
513
 
501
514
  it "uses amq.match" do
502
- channel = AMQP::Channel.new
503
- exchange = channel.headers
515
+ exchange = @channel.headers
504
516
  exchange.name.should == "amq.match"
505
517
  exchange.name.should_not == "amq.headers"
506
518
 
@@ -511,11 +523,10 @@ describe AMQP::Channel do
511
523
  context "when passive option is used" do
512
524
  context "and exchange with given name already exists" do
513
525
  it "silently returns" do
514
- name = "a_new_headers_exchange declared at #{Time.now.to_i}"
515
- channel = AMQP::Channel.new
526
+ name = "a_new_headers_exchange declared at #{Time.now.to_i}"
516
527
 
517
- original_exchange = channel.headers(name)
518
- exchange = channel.headers(name, :passive => true)
528
+ original_exchange = @channel.headers(name)
529
+ exchange = @channel.headers(name, :passive => true)
519
530
 
520
531
  exchange.should == original_exchange
521
532
 
@@ -525,16 +536,13 @@ describe AMQP::Channel do
525
536
 
526
537
  context "and exchange with given name DOES NOT exist" do
527
538
  it "raises an exception" do
528
- channel = AMQP::Channel.new
529
- channel.on_error do |ch, channel_close|
530
- @error_code = channel_close.reply_code
531
- end
539
+ pending "Not yet supported"
532
540
 
533
- exchange = channel.headers("headers exchange declared at #{Time.now.to_i}", :passive => true)
541
+ expect {
542
+ exchange = @channel.headers("headers exchange declared at #{Time.now.to_i}", :passive => true)
543
+ }.to raise_error
534
544
 
535
- done(0.5) {
536
- @error_code.should == 404
537
- }
545
+ done
538
546
  end # it
539
547
  end # context
540
548
  end # context
@@ -542,8 +550,7 @@ describe AMQP::Channel do
542
550
 
543
551
  context "when exchange is declared as durable" do
544
552
  it "returns a new durable headers exchange" do
545
- channel = AMQP::Channel.new
546
- exchange = channel.headers("a_new_durable_headers_exchange", :durable => true)
553
+ exchange = @channel.headers("a_new_durable_headers_exchange", :durable => true)
547
554
  exchange.should be_durable
548
555
  exchange.should_not be_transient
549
556
 
@@ -554,8 +561,7 @@ describe AMQP::Channel do
554
561
 
555
562
  context "when exchange is declared as non-durable" do
556
563
  it "returns a new NON-durable headers exchange" do
557
- channel = AMQP::Channel.new
558
- exchange = channel.headers("a_new_non_durable_headers_exchange", :durable => false)
564
+ exchange = @channel.headers("a_new_non_durable_headers_exchange", :durable => false)
559
565
  exchange.should_not be_durable
560
566
  exchange.should be_transient
561
567
 
@@ -566,8 +572,7 @@ describe AMQP::Channel do
566
572
 
567
573
  context "when exchange is declared as auto-deleted" do
568
574
  it "returns a new auto-deleted headers exchange" do
569
- channel = AMQP::Channel.new
570
- exchange = channel.headers("a new auto-deleted headers exchange", :auto_delete => true)
575
+ exchange = @channel.headers("a new auto-deleted headers exchange", :auto_delete => true)
571
576
 
572
577
  exchange.should be_auto_deleted
573
578
  done
@@ -577,8 +582,7 @@ describe AMQP::Channel do
577
582
 
578
583
  context "when exchange is declared as auto-deleted" do
579
584
  it "returns a new auto-deleted headers exchange" do
580
- channel = AMQP::Channel.new
581
- exchange = channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
585
+ exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
582
586
 
583
587
  exchange.should_not be_auto_deleted
584
588
  done
@@ -588,8 +592,7 @@ describe AMQP::Channel do
588
592
 
589
593
  context "when exchange is declared without explicit :nowait parameter" do
590
594
  it "is declared with :nowait by default" do
591
- channel = AMQP::Channel.new
592
- exchange = channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
595
+ exchange = @channel.headers("a new non-auto-deleted headers exchange", :auto_delete => false)
593
596
 
594
597
  exchange.should_not be_auto_deleted
595
598
  done
@@ -603,15 +606,43 @@ describe AMQP::Channel do
603
606
  end
604
607
 
605
608
  it "raises an exception" do
606
- channel = AMQP::Channel.new
607
- channel.headers("previously.declared.durable.headers.exchange", :durable => true)
609
+ @channel.headers("previously.declared.durable.headers.exchange", :durable => true)
608
610
 
609
611
  expect {
610
- channel.headers("previously.declared.durable.headers.exchange", :durable => false)
612
+ @channel.headers("previously.declared.durable.headers.exchange", :durable => false)
611
613
  }.to raise_error(AMQP::IncompatibleOptionsError)
612
614
 
613
615
  done
614
616
  end # it
615
617
  end # context
618
+
619
+
620
+ context "when exchange is re-declared with parameters different from original declaration on two separate channels" do
621
+ it "raises an exception" do
622
+ channel2 = AMQP::Channel.new
623
+ @channel.headers("previously.declared.durable.headers.exchange", :durable => true)
624
+
625
+ channel2.on_error do |ch, channel_close|
626
+ puts "reply_text: #{channel_close.reply_text}, reply_code: #{channel_close.reply_code}"
627
+ done
628
+ end
629
+ channel2.headers("previously.declared.durable.headers.exchange", :durable => false)
630
+ end # it
631
+ end # context
632
+
633
+
634
+
635
+ context "when exchange is re-declared with type different from original declaration on two separate channels" do
636
+ it "raises an exception" do
637
+ channel2 = AMQP::Channel.new
638
+ @channel.topic("previously.declared.durable.topic.exchange", :durable => true)
639
+
640
+ channel2.on_error do |ch, channel_close|
641
+ puts "reply_text: #{channel_close.reply_text}, reply_code: #{channel_close.reply_code}"
642
+ done
643
+ end
644
+ channel2.headers("previously.declared.durable.topic.exchange", :durable => true)
645
+ end # it
646
+ end # context
616
647
  end # describe
617
648
  end # describe AMQP