march_hare 2.7.0-java → 2.8.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ext/rabbitmq-client.jar +0 -0
- data/lib/march_hare/channel.rb +5 -0
- data/lib/march_hare/consumers/base.rb +1 -1
- data/lib/march_hare/session.rb +46 -0
- data/lib/march_hare/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10b9d00ad30cfe685795276ba8bd53d6cc5af312
|
4
|
+
data.tar.gz: acc9c65925a91800f6a68a1732e15d52eda372ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae3150965e1d9081ea8ff628fbb4ce23848c88a0fd5c1e28b992d6db54f8eea920e8d7775db8689afc886c3e4a48a0632765d7ce891db327f4731ecfe2b3070
|
7
|
+
data.tar.gz: 4572abefa55fec760696be30d3bad7707da9120b3e91e7c4ba7816bdf94f40823da08319f03523315f144f56dbaf8075915a2db224bb36a1c61a383c6f8cd73a
|
data/lib/ext/rabbitmq-client.jar
CHANGED
Binary file
|
data/lib/march_hare/channel.rb
CHANGED
@@ -151,6 +151,11 @@ module MarchHare
|
|
151
151
|
alias id channel_number
|
152
152
|
alias number channel_number
|
153
153
|
|
154
|
+
# @return [Boolean] true if the channel is open
|
155
|
+
def open?
|
156
|
+
@delegate.open?
|
157
|
+
end
|
158
|
+
|
154
159
|
# Closes the channel.
|
155
160
|
#
|
156
161
|
# Closed channels can no longer be used. Closed channel id is
|
data/lib/march_hare/session.rb
CHANGED
@@ -7,6 +7,11 @@ module MarchHare
|
|
7
7
|
java_import com.rabbitmq.client.ConnectionFactory
|
8
8
|
java_import com.rabbitmq.client.Connection
|
9
9
|
java_import com.rabbitmq.client.BlockedListener
|
10
|
+
java_import com.rabbitmq.client.NullTrustManager
|
11
|
+
|
12
|
+
java_import javax.net.ssl.SSLContext
|
13
|
+
java_import javax.net.ssl.KeyManagerFactory
|
14
|
+
java_import java.security.KeyStore
|
10
15
|
|
11
16
|
# Connection to a RabbitMQ node.
|
12
17
|
#
|
@@ -64,6 +69,32 @@ module MarchHare
|
|
64
69
|
when String then
|
65
70
|
if options[:trust_manager]
|
66
71
|
cf.use_ssl_protocol(tls, options[:trust_manager])
|
72
|
+
elsif (key_cert = tls_key_certificate_path_from(options)) && (key_cert_password = tls_key_certificate_password_from(options))
|
73
|
+
sslContext = SSLContext.get_instance(tls)
|
74
|
+
certificate_password = key_cert_password.to_java.to_char_array
|
75
|
+
begin
|
76
|
+
input_stream = File.new(key_cert).to_inputstream
|
77
|
+
key_store = KeyStore.get_instance('PKCS12')
|
78
|
+
key_store.load(input_stream, certificate_password)
|
79
|
+
|
80
|
+
key_manager_factory = KeyManagerFactory.get_instance("SunX509")
|
81
|
+
key_manager_factory.init(key_store, certificate_password)
|
82
|
+
|
83
|
+
key_managers = key_manager_factory.get_key_managers
|
84
|
+
|
85
|
+
sslContext.init(key_managers, [NullTrustManager.new].to_java('javax.net.ssl.TrustManager'), nil)
|
86
|
+
|
87
|
+
cf.use_ssl_protocol(sslContext)
|
88
|
+
# catch all exceptions from java
|
89
|
+
rescue Java::JavaLang::Exception => e
|
90
|
+
message = e.message
|
91
|
+
message << "\n"
|
92
|
+
message << e.backtrace.join("\n")
|
93
|
+
|
94
|
+
raise SSLContextException.new(message)
|
95
|
+
ensure
|
96
|
+
input_stream.close if input_stream
|
97
|
+
end
|
67
98
|
else
|
68
99
|
cf.use_ssl_protocol(tls)
|
69
100
|
end
|
@@ -73,6 +104,11 @@ module MarchHare
|
|
73
104
|
new(cf, options)
|
74
105
|
end
|
75
106
|
|
107
|
+
|
108
|
+
class SSLContextException < StandardError
|
109
|
+
end
|
110
|
+
|
111
|
+
|
76
112
|
# @return [Array<MarchHare::Channel>] Channels opened on this connection
|
77
113
|
attr_reader :channels
|
78
114
|
|
@@ -444,6 +480,16 @@ module MarchHare
|
|
444
480
|
end
|
445
481
|
end
|
446
482
|
|
483
|
+
# @private
|
484
|
+
def tls_key_certificate_path_from(opts)
|
485
|
+
opts[:tls_key_cert] || opts[:ssl_key_cert] || opts[:tls_key_cert_path] || opts[:ssl_key_cert_path] || opts[:tls_key_certificate_path] || opts[:ssl_key_certificate_path]
|
486
|
+
end
|
487
|
+
|
488
|
+
# @private
|
489
|
+
def tls_key_certificate_password_from(opts)
|
490
|
+
opts[:cert_password] || opts[:certificate_password]
|
491
|
+
end
|
492
|
+
|
447
493
|
# Ruby blocks-based BlockedListener that handles
|
448
494
|
# connection.blocked and connection.unblocked.
|
449
495
|
# @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: 2.
|
4
|
+
version: 2.8.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:
|
12
|
+
date: 2015-01-31 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:
|
@@ -60,4 +60,3 @@ signing_key:
|
|
60
60
|
specification_version: 4
|
61
61
|
summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client
|
62
62
|
test_files: []
|
63
|
-
has_rdoc:
|