march_hare 2.5.1-java → 2.7.0-java

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: 7d812346b01209ab8c2ddb64200f1a9e6d8a7488
4
- data.tar.gz: e8031aea2ef38e5ed724c1102fe03f8e310b5f28
3
+ metadata.gz: 8a417da5f5c33e7afac262924967c49e0910c6a8
4
+ data.tar.gz: 8bfcf751a299b57a60bf6bcd87260626ebc3d983
5
5
  SHA512:
6
- metadata.gz: 7d6d22f26143b7fd68b8bb4d4d4e73710675749d8da597171c4ea86e442b947d72177db5244685aa7d72365e4e5873527794176caa1f81ef91bb42519a871e75
7
- data.tar.gz: be9a1cbf79c8027b5193130d9fdabbcce82efe93bffd4bf3d3d03521a74ed01582068e8ad5f180c436005de63e114af74e3cead616d8bac174007cc01af87ec1
6
+ metadata.gz: f3af5dfa114500351fbaeece4d3d34cec7d73e5b6465880870d46cdef3ac9e25a0166a2fb6c884ae7ca9d9b3ece0871c9d3f98b85f5070f01b9c3aa7ca39bd71
7
+ data.tar.gz: ab7451d9f4621f5da10264af369558b94968a5772af9af282b0a5d0ce27123011822a00823d297ee419d3603ad4aa14da83c09ec1c4a4ce50127093e09f0a95e
Binary file
@@ -83,7 +83,12 @@ module MarchHare
83
83
  # executors cannot be restarted after shutdown,
84
84
  # so we really need a factory here. MK.
85
85
  @executor_factory = opts[:executor_factory] || build_executor_factory_from(opts)
86
- @connection = self.new_connection_impl
86
+
87
+ @hosts = self.class.hosts_from(opts)
88
+ @default_host_selection_strategy = lambda { |hosts| hosts.sample }
89
+ @host_selection_strategy = opts[:host_selection_strategy] || @default_host_selection_strategy
90
+
91
+ @connection = self.new_connection_impl(@hosts, @host_selection_strategy)
87
92
  @channels = JavaConcurrent::ConcurrentHashMap.new
88
93
 
89
94
  # should automatic recovery from network failures be used?
@@ -199,7 +204,7 @@ module MarchHare
199
204
 
200
205
  new_connection = converting_rjc_exceptions_to_ruby do
201
206
  reconnecting_on_network_failures(ms) do
202
- self.new_connection_impl
207
+ self.new_connection_impl(@hosts, @host_selection_strategy)
203
208
  end
204
209
  end
205
210
  @thread_pool = ThreadPools.dynamically_growing
@@ -289,6 +294,11 @@ module MarchHare
289
294
  options[:host] || options[:hostname] || ConnectionFactory::DEFAULT_HOST
290
295
  end
291
296
 
297
+ # @private
298
+ def self.hosts_from(options)
299
+ options[:hosts] || [hostname_from(options)]
300
+ end
301
+
292
302
  # @private
293
303
  def self.include_host?(options)
294
304
  !!(options[:host] || options[:hostname])
@@ -378,8 +388,12 @@ module MarchHare
378
388
  block.call
379
389
  rescue java.net.ConnectException => e
380
390
  raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} refused")
391
+ rescue java.net.NoRouteToHostException => e
392
+ raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} failed: no route to host")
381
393
  rescue java.net.UnknownHostException => e
382
394
  raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} refused: host unknown")
395
+ rescue java.net.SocketException => e
396
+ raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} failed")
383
397
  rescue com.rabbitmq.client.AuthenticationFailureException => e
384
398
  raise AuthenticationFailureError.new(@cf.username, @cf.virtual_host, @cf.password.bytesize)
385
399
  rescue com.rabbitmq.client.PossibleAuthenticationFailureException => e
@@ -399,7 +413,11 @@ module MarchHare
399
413
  end
400
414
 
401
415
  # @private
402
- def new_connection_impl
416
+ def new_connection_impl(hosts, host_selector)
417
+ if hosts && !hosts.empty?
418
+ @cf.host = host_selector.call(hosts)
419
+ end
420
+
403
421
  converting_rjc_exceptions_to_ruby do
404
422
  if @executor_factory
405
423
  @executor = @executor_factory.call
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module MarchHare
4
- VERSION = "2.5.1"
4
+ VERSION = "2.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: march_hare
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.7.0
5
5
  platform: java
6
6
  authors:
7
7
  - Theo Hultberg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-24 00:00:00.000000000 Z
12
+ date: 2014-11-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
15
15
  email:
@@ -21,7 +21,6 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - lib/ext/commons-io.jar
23
23
  - lib/ext/rabbitmq-client.jar
24
- - lib/hot_bunnies.rb
25
24
  - lib/march_hare.rb
26
25
  - lib/march_hare/channel.rb
27
26
  - lib/march_hare/consumers.rb
@@ -56,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
55
  version: '0'
57
56
  requirements: []
58
57
  rubyforge_project: march_hare
59
- rubygems_version: 2.2.2
58
+ rubygems_version: 2.1.9
60
59
  signing_key:
61
60
  specification_version: 4
62
61
  summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client
data/lib/hot_bunnies.rb DELETED
@@ -1,2 +0,0 @@
1
- # Backwards compatibility
2
- require "march_hare"