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 +4 -4
- data/lib/march_hare/session.rb +35 -17
- data/lib/march_hare/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8fa8b82fb0e6e8a81f4734cc1aa5df2f4566b078b4b89485a915aa224cb0f68
|
4
|
+
data.tar.gz: fb24515cbd8e0e65e052d9fc1eedfb7c33423f7c5faf4fa6aae7445cb4285cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3cf202d16652aeb89b129c695ce42dbe0ddce9930ca259c612cb5f8fb0581eb1345b916393d9456798343ee9fdce3518885587250d478e7c000974929fe59c
|
7
|
+
data.tar.gz: 6563c124ce5a8817827526355d819bd6fbe585513c91164fc511576196b2f09c9ede5c246537f615848fb256149dd6ffaedef9b323bd62cb3d00be24d5c0129b
|
data/lib/march_hare/session.rb
CHANGED
@@ -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.
|
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.
|
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
|
552
|
-
raise ConnectionRefused.new("Connection
|
553
|
-
rescue java.net.NoRouteToHostException
|
554
|
-
raise ConnectionRefused.new("Connection
|
555
|
-
rescue java.net.UnknownHostException
|
556
|
-
raise ConnectionRefused.new("Connection
|
557
|
-
rescue java.net.SocketException
|
558
|
-
raise ConnectionRefused.new("Connection to #{@cf
|
559
|
-
rescue java.util.concurrent.TimeoutException
|
560
|
-
raise ConnectionRefused.new("Connection
|
561
|
-
rescue com.rabbitmq.client.AuthenticationFailureException
|
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
|
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
|
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
|
-
@
|
583
|
-
|
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
|
data/lib/march_hare/version.rb
CHANGED
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.
|
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-
|
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:
|