amqp 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a214105750dda3fd90f5d3258b2574d58e7e85bf
4
- data.tar.gz: 48ca43153ca9a5bc9c62bc10191fd616e199bce0
3
+ metadata.gz: c7c6beb8c9f54c7d3a51e0abc31dfa3f17cd6c5b
4
+ data.tar.gz: c89625f4494fc2aebd74ad933cd444bc59530457
5
5
  SHA512:
6
- metadata.gz: 9958976df058e1798082fb69d2fba8f2bed2564bbdebb41e98c86ba4db1f1aefa189f706d7cb288efaca5b707489b73eeb2cdb03cf543c84e289a167108b3e1d
7
- data.tar.gz: f970fe4b28f97c7bc60a8181e1812db11c4bebfdcb5d66efe9b866b3a79562d1042f9cced7a62eaeb43c17f587f9ce7a2dd0e029af199889788c197702f20b6b
6
+ metadata.gz: 863eaec5942ad6a567cf7ce5f049b73cba3572af5fbcb20419071e88a8ff8e091b20c2c8ad9590c1326efc0eaca5fa4a5777ce924237f91dfeb875c7dffd8c51
7
+ data.tar.gz: 459b706baa1524e2493c5ffabc4aefdf0ced0cd1f82e090fe1aed0a672ead1e9cc70c2847ac6f2b2e0d4634cd21faba3aba379ce3c3f54a472e10b8f56da77ae
data/.gitignore CHANGED
@@ -17,3 +17,5 @@ tmp/*
17
17
  bin/*
18
18
  .AppleDouble/*
19
19
  debug/*
20
+
21
+ .ruby-version
@@ -1,12 +1,12 @@
1
1
  language: ruby
2
2
  bundler_args: --without development
3
- before_script: ./bin/ci/before_build.sh
3
+ before_script: ./bin/ci/before_build
4
4
  script: "bundle exec rake spec:ci"
5
5
  env:
6
6
  - CI=true
7
7
  rvm:
8
8
  - 2.3.3
9
- - 2.4.0
9
+ - 2.4.1
10
10
  gemfile:
11
11
  - Gemfile
12
12
  - gemfiles/eventmachine-pre
@@ -16,7 +16,7 @@ notifications:
16
16
  branches:
17
17
  only:
18
18
  - master
19
- - 1.5.x-stable
19
+ - 1.7.x-stable
20
20
  matrix:
21
21
  allow_failures:
22
22
  - rvm: jruby
@@ -1,7 +1,18 @@
1
- ## Changes Between 1.6.0 and 1.7.0 (unreleased)
1
+ ## Changes Between 1.6.0 and 1.7.0 (Feb 2nd, 2017)
2
2
 
3
- None to date.
3
+ ### Clear Framesets on Exception
4
4
 
5
+ Unprocessed frames received on a connection are now correctly
6
+ cleared when an exception occurs.
7
+
8
+ Contributed by Michael Lutsiuk.
9
+
10
+ GitHub issue: [#218](https://github.com/ruby-amqp/amqp/issues/218)
11
+
12
+
13
+ ### amq-protocol Update
14
+
15
+ Minimum `amq-protocol` version is now `2.1.0`.
5
16
 
6
17
 
7
18
  ## Changes Between 1.5.0 and 1.6.0 (Apr 4th, 2016)
data/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
  [Ruby amqp gem](http://rubyamqp.info) is a feature-rich,
4
4
  EventMachine-based RabbitMQ client with batteries included.
5
5
 
6
+ It's the original RabbitMQ client for Ruby. These days there are very
7
+ solid alternatives available: [Bunny](http://rubybunny.info) for MRI and [March Hare](http://rubymarchhare.info) for JRuby.
8
+
6
9
  It implement [AMQP
7
10
  0.9.1](http://www.rabbitmq.com/tutorials/amqp-concepts.html) and
8
11
  support [RabbitMQ extensions to AMQP
@@ -134,8 +137,9 @@ to learn more about RabbitMQ protocol principles & concepts.
134
137
 
135
138
  ## Supported Ruby Versions
136
139
 
137
- amqp gem `1.6.x` series supports
140
+ amqp gem `1.6.x` and `1.7.x` series support
138
141
 
142
+ * Ruby 2.4
139
143
  * Ruby 2.3
140
144
  * Ruby 2.2
141
145
  * Ruby 2.1
@@ -236,7 +240,7 @@ amqp gem is licensed under the [Ruby License](http://www.ruby-lang.org/en/LICENS
236
240
  * The Initial Developer of the Original Code is Aman Gupta.
237
241
  * Copyright (c) 2008 - 2010 [Aman Gupta](http://github.com/tmm1).
238
242
  * Contributions from [Jakub Stastny](http://github.com/botanicus) are Copyright (c) 2011-2012 VMware, Inc.
239
- * Copyright (c) 2010 — 2016 [ruby-amqp](https://github.com/ruby-amqp) group members.
243
+ * Copyright (c) 2010 — 2017 [ruby-amqp](https://github.com/ruby-amqp) group members.
240
244
 
241
245
  Currently maintained by [ruby-amqp](https://github.com/ruby-amqp) group members
242
246
  Special thanks to Dmitriy Samovskiy, Ben Hood and Tony Garnock-Jones.
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  # Dependencies
25
25
  s.add_dependency "eventmachine"
26
- s.add_dependency "amq-protocol", ">= 2.1.0"
26
+ s.add_dependency "amq-protocol", ">= 2.2.0"
27
27
 
28
28
  s.rubyforge_project = "amqp"
29
29
  end
@@ -229,22 +229,13 @@ module AMQP
229
229
  # It takes exactly the same parameters.
230
230
  # @return [AMQP::Session]
231
231
  # @api public
232
- def self.connect(connection_options_or_string = {}, other_options = {}, &block)
233
- opts = case connection_options_or_string
234
- when String then
235
- AMQP::Settings.parse_connection_uri(connection_options_or_string)
236
- when Hash then
237
- connection_options_or_string
238
- else
239
- Hash.new
240
- end
241
-
242
- AMQP::Session.connect(opts.merge(other_options), &block)
232
+ def self.connect(connection_options_or_string = ENV['RABBITMQ_URL'], other_options = {}, &block)
233
+ AMQP::Session.connect(connection_options_or_string, other_options, &block)
243
234
  end
244
235
 
245
236
  # @return [Hash] Default AMQP connection settings. This hash may be modified.
246
237
  # @api public
247
238
  def self.settings
248
- @settings ||= AMQP::Settings.default
239
+ @settings ||= AMQ::Settings.default.merge(logging: false)
249
240
  end
250
241
  end # AMQP
@@ -7,7 +7,7 @@ require "amqp/queue"
7
7
  module AMQP
8
8
  # h2. What are AMQP channels
9
9
  #
10
- # To quote {http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification}:
10
+ # To quote {https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification}:
11
11
  #
12
12
  # AMQP is a multi-channelled protocol. Channels provide a way to multiplex
13
13
  # a heavyweight TCP/IP connection into several light weight connections.
@@ -140,7 +140,7 @@ module AMQP
140
140
  # AMQP gem supports several RabbitMQ extensions that extend Channel functionality.
141
141
  # Learn more in {file:docs/VendorSpecificExtensions.textile}
142
142
  #
143
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.2.5)
143
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.2.5)
144
144
  class Channel
145
145
 
146
146
  #
@@ -431,7 +431,7 @@ module AMQP
431
431
  # @see Channel#default_exchange
432
432
  # @see Exchange
433
433
  # @see Exchange#initialize
434
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3.1)
434
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3.1)
435
435
  #
436
436
  # @return [Exchange]
437
437
  # @api public
@@ -484,7 +484,7 @@ module AMQP
484
484
  #
485
485
  #
486
486
  # @see Exchange
487
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.2.4)
487
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.2.4)
488
488
  #
489
489
  # @return [Exchange]
490
490
  # @api public
@@ -534,7 +534,7 @@ module AMQP
534
534
  # @see Exchange
535
535
  # @see Exchange#initialize
536
536
  # @see Channel#default_exchange
537
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3.2)
537
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3.2)
538
538
  #
539
539
  # @return [Exchange]
540
540
  # @api public
@@ -645,7 +645,7 @@ module AMQP
645
645
  # @see Exchange
646
646
  # @see Exchange#initialize
647
647
  # @see http://www.rabbitmq.com/faq.html#Binding-and-Routing RabbitMQ FAQ on routing & wildcards
648
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3.3)
648
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3.3)
649
649
  #
650
650
  # @return [Exchange]
651
651
  # @api public
@@ -747,7 +747,7 @@ module AMQP
747
747
  # @see Exchange
748
748
  # @see Exchange#initialize
749
749
  # @see Channel#default_exchange
750
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3.3)
750
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3.3)
751
751
  #
752
752
  # @return [Exchange]
753
753
  # @api public
@@ -842,7 +842,7 @@ module AMQP
842
842
  #
843
843
  # @see Queue
844
844
  # @see Queue#initialize
845
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.4)
845
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.4)
846
846
  #
847
847
  # @return [Queue]
848
848
  # @api public
@@ -971,7 +971,7 @@ module AMQP
971
971
  #
972
972
  # @param [Boolean] Desired flow state.
973
973
  #
974
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.5.2.3.)
974
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.5.2.3.)
975
975
  # @api public
976
976
  def flow(active = false, &block)
977
977
  @connection.send_frame(AMQ::Protocol::Channel::Flow.encode(@id, active))
@@ -1017,7 +1017,7 @@ module AMQP
1017
1017
  # @api public
1018
1018
  # @see #reject
1019
1019
  # @see #recover
1020
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.13.)
1020
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.13.)
1021
1021
  def acknowledge(delivery_tag, multiple = false)
1022
1022
  @connection.send_frame(AMQ::Protocol::Basic::Ack.encode(self.id, delivery_tag, multiple))
1023
1023
 
@@ -1029,7 +1029,7 @@ module AMQP
1029
1029
  # @api public
1030
1030
  # @see #acknowledge
1031
1031
  # @see #recover
1032
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.14.)
1032
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.14.)
1033
1033
  def reject(delivery_tag, requeue = true, multi = false)
1034
1034
  if multi
1035
1035
  @connection.send_frame(AMQ::Protocol::Basic::Nack.encode(self.id, delivery_tag, multi, requeue))
@@ -1046,7 +1046,7 @@ module AMQP
1046
1046
  # @return [Channel] self
1047
1047
  #
1048
1048
  # @note RabbitMQ as of 2.3.1 does not support basic.recover with requeue = false.
1049
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Reference.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.16.)
1049
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.8.3.16.)
1050
1050
  # @see #acknowledge
1051
1051
  # @api public
1052
1052
  def recover(requeue = true, &block)
@@ -1118,9 +1118,9 @@ module AMQP
1118
1118
 
1119
1119
  def confirm_select(nowait = false, &block)
1120
1120
  self.once_open do
1121
- if nowait && block
1122
- raise ArgumentError, "confirm.select with nowait = true and a callback makes no sense"
1123
- end
1121
+ if nowait && block
1122
+ raise ArgumentError, "confirm.select with nowait = true and a callback makes no sense"
1123
+ end
1124
1124
 
1125
1125
  @uses_publisher_confirmations = true
1126
1126
  reset_publisher_index!
@@ -132,9 +132,9 @@ module AMQP
132
132
  # @see Channel#topic
133
133
  # @see Channel#headers
134
134
  # @see Queue
135
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.1)
136
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.5)
137
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3)
135
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.1)
136
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.5)
137
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3)
138
138
  class Exchange
139
139
 
140
140
 
@@ -170,7 +170,7 @@ module AMQP
170
170
  # AMQP::Exchange.default(channel).publish("make clean", routing_key => "tasks")
171
171
  #
172
172
  # @see Exchange
173
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.2.4)
173
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.2.4)
174
174
  # @note Do not confuse default exchange with amq.direct: amq.direct is a pre-defined direct
175
175
  # exchange that doesn't have any special routing semantics.
176
176
  # @return [Exchange] An instance that corresponds to the default exchange (of type direct).
@@ -303,7 +303,7 @@ module AMQP
303
303
  # @see Channel#topic
304
304
  # @see Channel#headers
305
305
  # @see Queue
306
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 3.1.3)
306
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 3.1.3)
307
307
  #
308
308
  # @return [Exchange]
309
309
  # @api public
@@ -118,7 +118,7 @@ module AMQP
118
118
  # persistence.
119
119
  #
120
120
  #
121
- # @see http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification (Section 2.1.1)
121
+ # @see https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification (Section 2.1.1)
122
122
  # @see AMQP::Exchange
123
123
  class Queue
124
124
 
@@ -764,7 +764,7 @@ module AMQP
764
764
  end
765
765
 
766
766
  # @api public
767
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.8.3.9)
767
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Sections 1.8.3.9)
768
768
  def on_delivery(&block)
769
769
  @default_consumer.on_delivery(&block)
770
770
  end # on_delivery(&block)
@@ -939,7 +939,7 @@ module AMQP
939
939
  # @return [Queue] self
940
940
  #
941
941
  # @api public
942
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.1.)
942
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.7.2.1.)
943
943
  def queue_declare(passive = false, durable = false, exclusive = false, auto_delete = false, nowait = false, arguments = nil, &block)
944
944
  raise ArgumentError, "declaration with nowait does not make sense for server-named queues! Either specify name other than empty string or use #declare without nowait" if nowait && self.anonymous?
945
945
 
@@ -996,7 +996,7 @@ module AMQP
996
996
  # @return [Queue] self
997
997
  #
998
998
  # @api public
999
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.9.)
999
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.7.2.9.)
1000
1000
  def queue_delete(if_unused = false, if_empty = false, nowait = false, &block)
1001
1001
  nowait = true unless block
1002
1002
  @connection.send_frame(AMQ::Protocol::Queue::Delete.encode(@channel.id, @name, if_unused, if_empty, nowait))
@@ -1019,7 +1019,7 @@ module AMQP
1019
1019
  # @return [Queue] self
1020
1020
  #
1021
1021
  # @api public
1022
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.3.)
1022
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.7.2.3.)
1023
1023
  def queue_bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)
1024
1024
  nowait = true unless block
1025
1025
  exchange_name = if exchange.respond_to?(:name)
@@ -1048,7 +1048,7 @@ module AMQP
1048
1048
  # @return [Queue] self
1049
1049
  #
1050
1050
  # @api public
1051
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.5.)
1051
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.7.2.5.)
1052
1052
  def queue_unbind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, arguments = nil, &block)
1053
1053
  exchange_name = if exchange.respond_to?(:name)
1054
1054
  exchange.name
@@ -1079,7 +1079,7 @@ module AMQP
1079
1079
  # @return [Queue] self
1080
1080
  #
1081
1081
  # @api public
1082
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.3.)
1082
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.8.3.3.)
1083
1083
  def basic_consume(no_ack = false, exclusive = false, nowait = false, no_local = false, arguments = nil, &block)
1084
1084
  raise RuntimeError.new("This queue already has default consumer. Please instantiate AMQP::Consumer directly to register additional consumers.") if @default_consumer
1085
1085
 
@@ -1094,7 +1094,7 @@ module AMQP
1094
1094
  # @return [Queue] self
1095
1095
  #
1096
1096
  # @api public
1097
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.5.)
1097
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.8.3.5.)
1098
1098
  def cancel(nowait = false, &block)
1099
1099
  raise "There is no default consumer for this queue. This usually means that you are trying to unsubscribe a queue that never was subscribed for messages in the first place." if @default_consumer.nil?
1100
1100
 
@@ -1119,7 +1119,7 @@ module AMQP
1119
1119
  # @return [Queue] self
1120
1120
  #
1121
1121
  # @api public
1122
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.10.)
1122
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.8.3.10.)
1123
1123
  def get(no_ack = false, &block)
1124
1124
  @connection.send_frame(AMQ::Protocol::Basic::Get.encode(@channel.id, @name, no_ack))
1125
1125
 
@@ -1140,7 +1140,7 @@ module AMQP
1140
1140
  # @return [Queue] self
1141
1141
  #
1142
1142
  # @api public
1143
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.7.2.7.)
1143
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.7.2.7.)
1144
1144
  def queue_purge(nowait = false, &block)
1145
1145
  nowait = true unless block
1146
1146
  @connection.send_frame(AMQ::Protocol::Queue::Purge.encode(@channel.id, @name, nowait))
@@ -1164,7 +1164,7 @@ module AMQP
1164
1164
  # @return [Queue] self
1165
1165
  #
1166
1166
  # @api public
1167
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.13.)
1167
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.8.3.13.)
1168
1168
  def acknowledge(delivery_tag)
1169
1169
  @channel.acknowledge(delivery_tag)
1170
1170
 
@@ -1175,7 +1175,7 @@ module AMQP
1175
1175
  # @return [Queue] self
1176
1176
  #
1177
1177
  # @api public
1178
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.8.3.14.)
1178
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.8.3.14.)
1179
1179
  def reject(delivery_tag, requeue = true)
1180
1180
  @channel.reject(delivery_tag, requeue)
1181
1181
 
@@ -7,6 +7,7 @@ require "amqp/broker"
7
7
 
8
8
  require "amqp/channel"
9
9
  require "amqp/channel_id_allocator"
10
+ require "amq/settings"
10
11
 
11
12
  module AMQP
12
13
  # AMQP session represents connection to the broker. Session objects let you define callbacks for
@@ -62,37 +63,22 @@ module AMQP
62
63
 
63
64
  # The locale defines the language in which the server will send reply texts.
64
65
  #
65
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
66
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.2)
66
67
  attr_accessor :locale
67
68
 
68
69
  # Client capabilities
69
70
  #
70
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2.1)
71
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.2.1)
71
72
  attr_accessor :client_properties
72
73
 
73
- # Server properties
74
- #
75
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
76
- attr_reader :server_properties
77
-
78
- # Server capabilities
79
- #
80
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
81
- attr_reader :server_capabilities
82
-
83
- # Locales server supports
84
- #
85
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.3)
86
- attr_reader :server_locales
87
-
88
74
  # Authentication mechanism used.
89
75
  #
90
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
76
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.2)
91
77
  attr_reader :mechanism
92
78
 
93
79
  # Authentication mechanisms broker supports.
94
80
  #
95
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.2)
81
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.2)
96
82
  attr_reader :server_authentication_mechanisms
97
83
 
98
84
  # Channels within this connection.
@@ -104,14 +90,15 @@ module AMQP
104
90
  # Usable channel numbers are in the range 1..channel_max.
105
91
  # Zero indicates no specified limit.
106
92
  #
107
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.4.2.5.1 and 1.4.2.6.1)
93
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Sections 1.4.2.5.1 and 1.4.2.6.1)
108
94
  attr_accessor :channel_max
109
95
 
110
96
  # Maximum frame size that the server permits this connection to use.
111
97
  #
112
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Sections 1.4.2.5.2 and 1.4.2.6.2)
98
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Sections 1.4.2.5.2 and 1.4.2.6.2)
113
99
  attr_accessor :frame_max
114
100
 
101
+ attr_accessor :connection_timeout
115
102
 
116
103
  attr_reader :known_hosts
117
104
 
@@ -119,7 +106,7 @@ module AMQP
119
106
  class << self
120
107
  # Settings
121
108
  def settings
122
- @settings ||= AMQP::Settings.default
109
+ @settings ||= AMQ::Settings.default
123
110
  end
124
111
 
125
112
  def logger
@@ -156,6 +143,9 @@ module AMQP
156
143
  def initialize(*args, &block)
157
144
  super(*args)
158
145
 
146
+ connection_options_or_string = args.first
147
+ other_options = args[1] || {}
148
+
159
149
  self.logger = self.class.logger
160
150
 
161
151
  # channel => collected frames. MK.
@@ -170,9 +160,7 @@ module AMQP
170
160
  @tcp_connection_failed = false
171
161
  @intentionally_closing_connection = false
172
162
 
173
- # EventMachine::Connection's and Adapter's constructors arity
174
- # make it easier to use *args. MK.
175
- @settings = Settings.configure(args.first)
163
+ @settings = AMQ::Settings.configure(connection_options_or_string).merge(other_options)
176
164
 
177
165
  @on_tcp_connection_failure = Proc.new { |settings|
178
166
  closed!
@@ -186,16 +174,17 @@ module AMQP
186
174
  @on_possible_authentication_failure = @settings[:on_possible_authentication_failure] || Proc.new { |settings|
187
175
  raise self.class.authentication_failure_exception_class.new(settings)
188
176
  }
189
-
190
- @mechanism = @settings.fetch(:auth_mechanism, "PLAIN")
177
+ @mechanism = normalize_auth_mechanism(@settings.fetch(:auth_mechanism, "PLAIN"))
191
178
  @locale = @settings.fetch(:locale, "en_GB")
192
179
  @client_properties = Settings.client_properties.merge(@settings.fetch(:client_properties, Hash.new))
193
180
 
194
181
  @auto_recovery = (!!@settings[:auto_recovery])
195
182
 
183
+ @connection_timeout = (@settings[:timeout] || @settings[:connection_timeout] || 3).to_f
184
+
196
185
  self.reset
197
- self.set_pending_connect_timeout((@settings[:timeout] || 3).to_f) unless defined?(JRUBY_VERSION)
198
- end # initialize(*args, &block)
186
+ self.set_pending_connect_timeout(@connection_timeout) unless defined?(JRUBY_VERSION)
187
+ end # initialize
199
188
 
200
189
  # @return [Boolean] true if this AMQP connection is currently open
201
190
  # @api plugin
@@ -231,7 +220,7 @@ module AMQP
231
220
 
232
221
 
233
222
  # Properly close connection with AMQ broker, as described in
234
- # section 2.2.4 of the {http://files.travis-ci.org/docs/amqp/0.9.1/AMQP091Specification.pdf AMQP 0.9.1 specification}.
223
+ # section 2.2.4 of the {https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf AMQP 0.9.1 specification}.
235
224
  #
236
225
  # @api plugin
237
226
  # @see #close_connection
@@ -263,19 +252,19 @@ module AMQP
263
252
  # Server properties (product information, platform, et cetera)
264
253
  #
265
254
  # @return [Hash]
266
- # @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)
255
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
267
256
  attr_reader :server_properties
268
257
 
269
258
  # Server capabilities (usually used to detect AMQP 0.9.1 extensions like basic.nack, publisher
270
259
  # confirms and so on)
271
260
  #
272
261
  # @return [Hash]
273
- # @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)
262
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
274
263
  attr_reader :server_capabilities
275
264
 
276
265
  # Locales server supports
277
266
  #
278
- # @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)
267
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
279
268
  attr_reader :server_locales
280
269
 
281
270
  # @return [AMQP::Broker] Broker this connection is established with
@@ -451,8 +440,9 @@ module AMQP
451
440
  # @option settings [Fixnum] :frame_max (131072) Maximum frame size to use. If broker cannot support frames this large, broker's maximum value will be used instead.
452
441
  #
453
442
  # @param [Hash] settings
454
- def self.connect(settings = {}, &block)
455
- @settings = Settings.configure(settings)
443
+ # def self.connect(settings = {}, &block)
444
+ def self.connect(connection_string_or_opts = ENV['RABBITMQ_URL'], other_options = {}, &block)
445
+ @settings = AMQ::Settings.configure(connection_string_or_opts).merge(other_options)
456
446
 
457
447
  instance = EventMachine.connect(@settings[:host], @settings[:port], self, @settings)
458
448
  instance.register_connection_callback(&block)
@@ -485,14 +475,7 @@ module AMQP
485
475
  # @see #reconnect
486
476
  # @api public
487
477
  def reconnect_to(connection_string_or_options, period = 5)
488
- settings = case connection_string_or_options
489
- when String then
490
- AMQP.parse_connection_uri(connection_string_or_options)
491
- when Hash then
492
- connection_string_or_options
493
- else
494
- Hash.new
495
- end
478
+ settings = AMQ::Settings.configure(connection_string_or_opts)
496
479
 
497
480
  if !@reconnecting
498
481
  @reconnecting = true
@@ -763,7 +746,7 @@ module AMQP
763
746
  # Zero means the server does not want a heartbeat.
764
747
  #
765
748
  # @return [Fixnum] Heartbeat interval this client uses, in seconds.
766
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
749
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.6)
767
750
  def heartbeat_interval
768
751
  @heartbeat_interval
769
752
  end # heartbeat_interval
@@ -894,7 +877,7 @@ module AMQP
894
877
  # Sends connection.open to the server.
895
878
  #
896
879
  # @api plugin
897
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.7)
880
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.7)
898
881
  def open(vhost = "/")
899
882
  self.send_frame(AMQ::Protocol::Connection::Open.encode(vhost))
900
883
  end
@@ -995,7 +978,7 @@ module AMQP
995
978
  # Handles connection.start.
996
979
  #
997
980
  # @api plugin
998
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.1.)
981
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.1.)
999
982
  def handle_start(connection_start)
1000
983
  @server_properties = connection_start.server_properties
1001
984
  @server_capabilities = @server_properties["capabilities"]
@@ -1018,7 +1001,7 @@ module AMQP
1018
1001
  # Handles Connection.Tune-Ok.
1019
1002
  #
1020
1003
  # @api plugin
1021
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
1004
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.6)
1022
1005
  def handle_tune(connection_tune)
1023
1006
  @channel_max = connection_tune.channel_max.freeze
1024
1007
  @frame_max = connection_tune.frame_max.freeze
@@ -1035,7 +1018,7 @@ module AMQP
1035
1018
  # Handles Connection.Open-Ok.
1036
1019
  #
1037
1020
  # @api plugin
1038
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.8.)
1021
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.8.)
1039
1022
  def handle_open_ok(open_ok)
1040
1023
  @known_hosts = open_ok.known_hosts.dup.freeze
1041
1024
 
@@ -1047,7 +1030,7 @@ module AMQP
1047
1030
  # Handles connection.close. When broker detects a connection level exception, this method is called.
1048
1031
  #
1049
1032
  # @api plugin
1050
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.5.2.9)
1033
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.5.2.9)
1051
1034
  def handle_close(conn_close)
1052
1035
  closed!
1053
1036
  # getting connection.close during connection negotiation means authentication
@@ -1063,7 +1046,7 @@ module AMQP
1063
1046
  # Handles Connection.Close-Ok.
1064
1047
  #
1065
1048
  # @api plugin
1066
- # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.10)
1049
+ # @see https://www.rabbitmq.com/resources/specs/amqp-xml-doc0-9-1.pdf AMQP 0.9.1 protocol reference (Section 1.4.2.10)
1067
1050
  def handle_close_ok(close_ok)
1068
1051
  closed!
1069
1052
  self.disconnection_successful
@@ -1185,5 +1168,18 @@ module AMQP
1185
1168
  start_tls
1186
1169
  end
1187
1170
  end # upgrade_to_tls_if_necessary
1171
+
1172
+ private
1173
+
1174
+ def normalize_auth_mechanism(value)
1175
+ case value
1176
+ when [] then
1177
+ "PLAIN"
1178
+ when nil then
1179
+ "PLAIN"
1180
+ else
1181
+ value
1182
+ end
1183
+ end
1188
1184
  end # Session
1189
1185
  end # AMQP
@@ -1,46 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- require "amq/protocol/client"
4
- require "uri"
5
-
6
3
  module AMQP
7
- # @see AMQP::Settings.configure
8
4
  module Settings
9
- # @private
10
- AMQP_PORTS = {"amqp" => 5672, "amqps" => 5671}.freeze
11
-
12
- # @private
13
- AMQPS = "amqps".freeze
14
-
15
- # Default connection settings used by AMQ clients
16
- #
17
- # @see AMQP::Settings.configure
18
- def self.default
19
- @default ||= {
20
- # server
21
- :host => "127.0.0.1",
22
- :port => AMQ::Protocol::DEFAULT_PORT,
23
-
24
- # login
25
- :user => "guest",
26
- :pass => "guest",
27
- :auth_mechanism => "PLAIN",
28
- :vhost => "/",
29
-
30
- # connection timeout
31
- :timeout => nil,
32
-
33
- # logging
34
- :logging => false,
35
-
36
- # ssl
37
- :ssl => false,
38
-
39
- :frame_max => 131072,
40
- :heartbeat => 0
41
- }
42
- end
43
-
44
5
  CLIENT_PROPERTIES = {
45
6
  :platform => ::RUBY_DESCRIPTION,
46
7
  :product => "amqp gem",
@@ -59,108 +20,5 @@ module AMQP
59
20
  def self.client_properties
60
21
  @client_properties ||= CLIENT_PROPERTIES
61
22
  end
62
-
63
-
64
- # Merges given configuration parameters with defaults and returns
65
- # the result.
66
- #
67
- # @param [Hash] Configuration parameters to use.
68
- #
69
- # @option settings [String] :host ("127.0.0.1") Hostname AMQ broker runs on.
70
- # @option settings [String] :port (5672) Port AMQ broker listens on.
71
- # @option settings [String] :vhost ("/") Virtual host to use.
72
- # @option settings [String] :user ("guest") Username to use for authentication.
73
- # @option settings [String] :pass ("guest") Password to use for authentication.
74
- # @option settings [String] :ssl (false) Should be use TLS (SSL) for connection?
75
- # @option settings [String] :timeout (nil) Connection timeout.
76
- # @option settings [String] :logging (false) Turns logging on or off.
77
- # @option settings [String] :broker (nil) Broker name (use if you intend to use broker-specific features).
78
- # @option settings [Fixnum] :frame_max (131072) Maximum frame size to use. If broker cannot support frames this large, broker's maximum value will be used instead.
79
- #
80
- # @return [Hash] Merged configuration parameters.
81
- def self.configure(settings = nil)
82
- case settings
83
- when Hash then
84
- settings = Hash[settings.map {|k, v| [k.to_sym, v] }] # symbolize keys
85
- if username = settings.delete(:username)
86
- settings[:user] ||= username
87
- end
88
-
89
- if password = settings.delete(:password)
90
- settings[:pass] ||= password
91
- end
92
-
93
-
94
- self.default.merge(settings)
95
- when String then
96
- settings = self.parse_amqp_url(settings)
97
- self.default.merge(settings)
98
- when NilClass then
99
- self.default
100
- end
101
- end
102
-
103
- # Parses AMQP connection URI and returns its components as a hash.
104
- #
105
- # h2. vhost naming schemes
106
- #
107
- # It is convenient to be able to specify the AMQP connection
108
- # parameters as a URI string, and various "amqp" URI schemes
109
- # exist. Unfortunately, there is no standard for these URIs, so
110
- # while the schemes share the basic idea, they differ in some
111
- # details. This implementation aims to encourage URIs that work
112
- # as widely as possible.
113
- #
114
- # The URI scheme should be "amqp", or "amqps" if SSL is required.
115
- #
116
- # The host, port, username and password are represented in the
117
- # authority component of the URI in the same way as in http URIs.
118
- #
119
- # The vhost is obtained from the first segment of the path, with the
120
- # leading slash removed. The path should contain only a single
121
- # segment (i.e, the only slash in it should be the leading one).
122
- # If the vhost is to include slashes or other reserved URI
123
- # characters, these should be percent-escaped.
124
- #
125
- # @example How vhost is parsed
126
- #
127
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com") # => vhost is nil, so default (/) will be used
128
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/") # => vhost is an empty string
129
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/%2Fvault") # => vhost is /vault
130
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/production") # => vhost is production
131
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/a.b.c") # => vhost is a.b.c
132
- # AMQP::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/foo/bar") # => ArgumentError
133
- #
134
- #
135
- # @param [String] connection_string AMQP connection URI, à la JDBC connection string. For example: amqp://bus.megacorp.internal:5877.
136
- # @return [Hash] Connection parameters (:username, :password, :vhost, :host, :port, :ssl)
137
- #
138
- # @raise [ArgumentError] When connection URI schema is not amqp or amqps, or the path contains multiple segments
139
- #
140
- # @see http://bit.ly/ks8MXK Connecting to The Broker documentation guide
141
- # @api public
142
- def self.parse_amqp_url(connection_string)
143
- uri = URI.parse(connection_string)
144
- raise ArgumentError.new("Connection URI must use amqp or amqps schema (example: amqp://bus.megacorp.internal:5766), learn more at http://rubyamqp.info") unless %w{amqp amqps}.include?(uri.scheme)
145
-
146
- opts = {}
147
-
148
- opts[:scheme] = uri.scheme
149
- opts[:user] = URI.unescape(uri.user) if uri.user
150
- opts[:pass] = URI.unescape(uri.password) if uri.password
151
- opts[:host] = uri.host if uri.host
152
- opts[:port] = uri.port || AMQP::Settings::AMQP_PORTS[uri.scheme]
153
- opts[:ssl] = uri.scheme == AMQP::Settings::AMQPS
154
- if uri.path =~ %r{^/(.*)}
155
- raise ArgumentError.new("#{uri} has multiple-segment path; please percent-encode any slashes in the vhost name (e.g. /production => %2Fproduction). Learn more at http://rubyamqp.info") if $1.index('/')
156
- opts[:vhost] = URI.unescape($1)
157
- end
158
-
159
- opts
160
- end
161
-
162
- def self.parse_connection_uri(connection_string)
163
- parse_amqp_url(connection_string)
164
- end
165
23
  end
166
24
  end
@@ -6,5 +6,5 @@ module AMQP
6
6
  #
7
7
  # @see AMQ::Protocol::VERSION
8
8
  # @return [String] AMQP gem version
9
- VERSION = '1.7.0'
9
+ VERSION = '1.8.0'
10
10
  end
@@ -36,7 +36,7 @@ describe "AMQP queue redeclaration with different attributes" do
36
36
  channel.queue(name, options)
37
37
  expect {
38
38
  channel.queue(name, different_options)
39
- }.to raise_error(AMQP::IncompatibleOptionsError)
39
+ }.to raise_error
40
40
 
41
41
  done(0.5) {
42
42
  @error_code.should == 406
@@ -62,7 +62,7 @@ describe "AMQP queue redeclaration with different attributes" do
62
62
  channel.queue(name, options)
63
63
  expect {
64
64
  channel.queue(name, different_options)
65
- }.to_not raise_error(AMQP::IncompatibleOptionsError)
65
+ }.to_not raise_error
66
66
 
67
67
  done(0.5) {
68
68
  @error_code.should == 406
@@ -16,10 +16,27 @@ describe AMQP do
16
16
  s[:port].should == 5672
17
17
  s[:user].should == "guest"
18
18
  s[:pass].should == "guest"
19
- s[:heartbeat].should == 0
20
- s[:auth_mechanism].should == "PLAIN"
19
+ s[:heartbeat].should be_nil
20
+ s[:auth_mechanism].should eq([])
21
21
  end
22
22
 
23
+ describe "connection to RabbitMQ with a connection string" do
24
+ include EventedSpec::SpecHelper
25
+
26
+ em_before { AMQP.cleanup_state }
27
+ em_after { AMQP.cleanup_state }
28
+
29
+ it 'parses URI string' do
30
+ em do
31
+ AMQP.start("amqp://guest:guest@127.0.0.1?heartbeat=10&connection_timeout=100") do |session|
32
+ expect(session.heartbeat_interval).to eq(10)
33
+ expect(session.connection_timeout).to eq(100)
34
+ session.close
35
+ end
36
+ done(0.3)
37
+ end
38
+ end
39
+ end
23
40
 
24
41
  describe '.start' do
25
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-02 00:00:00.000000000 Z
13
+ date: 2018-01-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 2.1.0
35
+ version: 2.2.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 2.1.0
42
+ version: 2.2.0
43
43
  description: Mature EventMachine-based RabbitMQ client.
44
44
  email:
45
45
  - michael@novemberain.com
@@ -48,28 +48,27 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files:
50
50
  - README.md
51
- - docs/08Migration.textile
52
- - docs/AMQP091ModelExplained.textile
53
- - docs/Bindings.textile
51
+ - docs/Exchanges.textile
54
52
  - docs/Clustering.textile
55
- - docs/ConnectingToTheBroker.textile
53
+ - docs/VendorSpecificExtensions.textile
54
+ - docs/PatternsAndUseCases.textile
55
+ - docs/Troubleshooting.textile
56
+ - docs/Bindings.textile
57
+ - docs/AMQP091ModelExplained.textile
58
+ - docs/Durability.textile
56
59
  - docs/ConnectionEncryptionWithTLS.textile
60
+ - docs/TestingWithEventedSpec.textile
61
+ - docs/Queues.textile
57
62
  - docs/DocumentationGuidesIndex.textile
58
- - docs/Durability.textile
59
- - docs/ErrorHandling.textile
60
- - docs/Exchanges.textile
61
63
  - docs/GettingStarted.textile
62
- - docs/PatternsAndUseCases.textile
63
- - docs/Queues.textile
64
+ - docs/08Migration.textile
65
+ - docs/ConnectingToTheBroker.textile
66
+ - docs/ErrorHandling.textile
64
67
  - docs/RabbitMQVersions.textile
65
68
  - docs/RunningTests.textile
66
- - docs/TestingWithEventedSpec.textile
67
- - docs/Troubleshooting.textile
68
- - docs/VendorSpecificExtensions.textile
69
69
  files:
70
70
  - ".gitignore"
71
71
  - ".rspec"
72
- - ".ruby-version"
73
72
  - ".travis.yml"
74
73
  - ".yardopts"
75
74
  - ChangeLog.md
@@ -77,7 +76,7 @@ files:
77
76
  - README.md
78
77
  - Rakefile
79
78
  - amqp.gemspec
80
- - bin/ci/before_build.sh
79
+ - bin/ci/before_build
81
80
  - bin/cleanify.rb
82
81
  - bin/docup
83
82
  - bin/irb
@@ -300,7 +299,6 @@ files:
300
299
  - spec/integration/tx_rollback_spec.rb
301
300
  - spec/spec_helper.rb
302
301
  - spec/unit/amqp/channel_id_allocation_spec.rb
303
- - spec/unit/amqp/client_spec.rb
304
302
  - spec/unit/amqp/connection_spec.rb
305
303
  homepage: http://rubyamqp.info
306
304
  licenses:
@@ -323,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
321
  version: '0'
324
322
  requirements: []
325
323
  rubyforge_project: amqp
326
- rubygems_version: 2.5.2
324
+ rubygems_version: 2.6.13
327
325
  signing_key:
328
326
  specification_version: 4
329
327
  summary: Mature EventMachine-based RabbitMQ client
@@ -1 +0,0 @@
1
- 2.3
@@ -1,104 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- require "amqp/settings"
6
-
7
- describe AMQP::Settings do
8
-
9
- #
10
- # Examples
11
- #
12
-
13
-
14
- describe ".parse_connection_uri(connection_string)" do
15
- context "when schema is not one of [amqp, amqps]" do
16
- it "raises ArgumentError" do
17
- expect {
18
- described_class.parse_connection_uri("http://dev.rabbitmq.com")
19
- }.to raise_error(ArgumentError, /amqp or amqps schema/)
20
- end
21
- end
22
-
23
-
24
- it "handles amqp:// URIs w/o path part" do
25
- val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com")
26
-
27
- val[:vhost].should be_nil # in this case, default / will be used
28
- val[:host].should == "dev.rabbitmq.com"
29
- val[:port].should == 5672
30
- val[:scheme].should == "amqp"
31
- val[:ssl].should be_false
32
- end
33
-
34
- it "handles amqps:// URIs w/o path part" do
35
- val = described_class.parse_connection_uri("amqps://dev.rabbitmq.com")
36
-
37
- val[:vhost].should be_nil
38
- val[:host].should == "dev.rabbitmq.com"
39
- val[:port].should == 5671
40
- val[:scheme].should == "amqps"
41
- val[:ssl].should be_true
42
- end
43
-
44
-
45
- context "when URI ends in a slash" do
46
- it "parses vhost as an empty string" do
47
- val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/")
48
-
49
- val[:host].should == "dev.rabbitmq.com"
50
- val[:port].should == 5672
51
- val[:scheme].should == "amqp"
52
- val[:ssl].should be_false
53
- val[:vhost].should == ""
54
- end
55
- end
56
-
57
-
58
- context "when URI ends in /%2Fvault" do
59
- it "parses vhost as /vault" do
60
- val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/%2Fvault")
61
-
62
- val[:host].should == "dev.rabbitmq.com"
63
- val[:port].should == 5672
64
- val[:scheme].should == "amqp"
65
- val[:ssl].should be_false
66
- val[:vhost].should == "/vault"
67
- end
68
- end
69
-
70
-
71
- context "when URI is amqp://dev.rabbitmq.com/a.path.without.slashes" do
72
- it "parses vhost as a.path.without.slashes" do
73
- val = described_class.parse_connection_uri("amqp://dev.rabbitmq.com/a.path.without.slashes")
74
-
75
- val[:host].should == "dev.rabbitmq.com"
76
- val[:port].should == 5672
77
- val[:scheme].should == "amqp"
78
- val[:ssl].should be_false
79
- val[:vhost].should == "a.path.without.slashes"
80
- end
81
- end
82
-
83
- context "when URI is amqp://dev.rabbitmq.com/a/path/with/slashes" do
84
- it "raises an ArgumentError" do
85
- lambda { described_class.parse_connection_uri("amqp://dev.rabbitmq.com/a/path/with/slashes") }.should raise_error(ArgumentError)
86
- end
87
- end
88
-
89
-
90
- context "when URI has username:password, for instance, amqp://hedgehog:t0ps3kr3t@hub.megacorp.internal" do
91
- it "parses them out" do
92
- val = described_class.parse_connection_uri("amqp://hedgehog:t0ps3kr3t@hub.megacorp.internal")
93
-
94
- val[:host].should == "hub.megacorp.internal"
95
- val[:port].should == 5672
96
- val[:scheme].should == "amqp"
97
- val[:ssl].should be_false
98
- val[:user].should == "hedgehog"
99
- val[:pass].should == "t0ps3kr3t"
100
- val[:vhost].should be_nil # in this case, default / will be used
101
- end
102
- end
103
- end
104
- end