march_hare 4.0.0-java → 4.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1bc17534b034049e19db4642f26c7062834d26cb31ef1ed191e70e9621a0b3f
4
- data.tar.gz: 1635809c2a7f65d9d343e57fb34bc46b0df173065db6e64e98579ffcc61fc143
3
+ metadata.gz: d8fa8b82fb0e6e8a81f4734cc1aa5df2f4566b078b4b89485a915aa224cb0f68
4
+ data.tar.gz: fb24515cbd8e0e65e052d9fc1eedfb7c33423f7c5faf4fa6aae7445cb4285cbe
5
5
  SHA512:
6
- metadata.gz: f292ea76e5912fdef5a1dc5016371632cb1a48679300bf3b603f313b718f424b1b690f92c7bb1285967175f2814a5fcb5a46187bc09467375bb174dbb5220485
7
- data.tar.gz: 8aff2fb9a7c82779a6ac38a37ba71e09799aee1f1305ac7a2b3948101d48949c6226fedc827bab57f31946d058bc7f1a9866a5c9af86f366f0919321bff89e49
6
+ metadata.gz: 7d3cf202d16652aeb89b129c695ce42dbe0ddce9930ca259c612cb5f8fb0581eb1345b916393d9456798343ee9fdce3518885587250d478e7c000974929fe59c
7
+ data.tar.gz: 6563c124ce5a8817827526355d819bd6fbe585513c91164fc511576196b2f09c9ede5c246537f615848fb256149dd6ffaedef9b323bd62cb3d00be24d5c0129b
@@ -165,7 +165,7 @@ module MarchHare
165
165
  # we expect this option to be specified in seconds
166
166
  @executor_shutdown_timeout = opts.fetch(:executor_shutdown_timeout, 30.0)
167
167
 
168
- @addresses = self.class.adresses_from(opts)
168
+ @addresses = self.class.addresses_from(opts)
169
169
  @connection = build_new_connection
170
170
  @channels = JavaConcurrent::ConcurrentHashMap.new
171
171
 
@@ -458,7 +458,7 @@ module MarchHare
458
458
  end
459
459
 
460
460
  # @private
461
- def self.adresses_from(options)
461
+ def self.addresses_from(options)
462
462
  options[:addresses] || options[:hosts] || [address_with_port_from(options)]
463
463
  end
464
464
 
@@ -541,6 +541,19 @@ module MarchHare
541
541
  !!opts[:thread_factory]
542
542
  end
543
543
 
544
+ # @private
545
+ def endpoint_info_from(cf)
546
+ if @uses_uri
547
+ uri_without_credentials = URI.parse(@uri).tap do |u|
548
+ u.password = "REDACTED"
549
+ u.to_s
550
+ end
551
+ "Target URI: #{uri_without_credentials}"
552
+ else
553
+ "Target host list: #{@addresses.join(', ')}, target virtual host: #{cf.virtual_host}, username: #{cf.username}"
554
+ end
555
+ end
556
+
544
557
  # Executes a block, catching Java exceptions RabbitMQ Java client throws and
545
558
  # transforms them to Ruby exceptions that are then re-raised.
546
559
  #
@@ -548,19 +561,19 @@ module MarchHare
548
561
  def converting_rjc_exceptions_to_ruby(&block)
549
562
  begin
550
563
  block.call
551
- rescue java.net.ConnectException => e
552
- raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} refused")
553
- rescue java.net.NoRouteToHostException => e
554
- raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} failed: no route to host")
555
- rescue java.net.UnknownHostException => e
556
- raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} refused: host unknown")
557
- rescue java.net.SocketException => e
558
- raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} failed")
559
- rescue java.util.concurrent.TimeoutException => e
560
- raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} failed: timeout")
561
- rescue com.rabbitmq.client.AuthenticationFailureException => e
564
+ rescue java.net.ConnectException
565
+ raise ConnectionRefused.new("Connection was refused. #{endpoint_info_from(@cf)}")
566
+ rescue java.net.NoRouteToHostException
567
+ raise ConnectionRefused.new("Connection failed: no route to target host. #{endpoint_info_from(@cf)}")
568
+ rescue java.net.UnknownHostException
569
+ raise ConnectionRefused.new("Connection refused: target host unknown (cannot be resolved). #{endpoint_info_from(@cf)}")
570
+ rescue java.net.SocketException
571
+ raise ConnectionRefused.new("Connection failed due to a socket exception. #{endpoint_info_from(@cf)}")
572
+ rescue java.util.concurrent.TimeoutException
573
+ raise ConnectionRefused.new("Connection timed out. #{endpoint_info_from(@cf)}")
574
+ rescue com.rabbitmq.client.AuthenticationFailureException
562
575
  raise AuthenticationFailureError.new(@cf.username, @cf.virtual_host, @cf.password.bytesize)
563
- rescue com.rabbitmq.client.PossibleAuthenticationFailureException => e
576
+ rescue com.rabbitmq.client.PossibleAuthenticationFailureException
564
577
  raise PossibleAuthenticationFailureError.new(@cf.username, @cf.virtual_host, @cf.password.bytesize)
565
578
  end
566
579
  end
@@ -570,7 +583,7 @@ module MarchHare
570
583
  @logger.debug("session: reconnecting_on_network_failures")
571
584
  begin
572
585
  fn.call
573
- rescue IOError, MarchHare::ConnectionRefused, java.io.IOException, java.util.concurrent.TimeoutException => e
586
+ rescue IOError, MarchHare::ConnectionRefused, java.io.IOException, java.util.concurrent.TimeoutException
574
587
  java.lang.Thread.sleep(interval_in_ms)
575
588
 
576
589
  retry
@@ -579,8 +592,13 @@ module MarchHare
579
592
 
580
593
  # @private
581
594
  def build_new_connection
582
- @logger.debug("session: instantiating a new connection")
583
- @uses_uri ? new_uri_connection_impl(@uri) : new_connection_impl(@addresses)
595
+ if @uses_uri
596
+ @logger.debug("session: instantiating a new connection using a URI")
597
+ new_uri_connection_impl(@uri)
598
+ else
599
+ @logger.debug("session: instantiating a new connection using a set of addresses: #{@addresses.join(',')}")
600
+ new_connection_impl(@addresses)
601
+ end
584
602
  end
585
603
 
586
604
  # @private
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module MarchHare
4
- VERSION = "4.0.0"
4
+ VERSION = "4.1.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: 4.0.0
4
+ version: 4.1.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: 2019-07-05 00:00:00.000000000 Z
12
+ date: 2019-07-09 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: