hot_bunnies 2.0.0.pre4-java → 2.0.0.pre6-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hot_bunnies.rb +1 -0
- data/lib/hot_bunnies/consumers.rb +2 -0
- data/lib/hot_bunnies/exceptions.rb +10 -3
- data/lib/hot_bunnies/session.rb +6 -1
- data/lib/hot_bunnies/version.rb +1 -1
- metadata +2 -2
data/lib/hot_bunnies.rb
CHANGED
@@ -2,6 +2,12 @@ module HotBunnies
|
|
2
2
|
class Exception < StandardError
|
3
3
|
end
|
4
4
|
|
5
|
+
class NetworkException < Exception
|
6
|
+
end
|
7
|
+
|
8
|
+
class ConnectionRefused < NetworkException
|
9
|
+
end
|
10
|
+
|
5
11
|
class ChannelLevelException < Exception
|
6
12
|
attr_reader :channel_close
|
7
13
|
|
@@ -60,6 +66,9 @@ module HotBunnies
|
|
60
66
|
class UnexpectedFrame < ConnectionLevelException
|
61
67
|
end
|
62
68
|
|
69
|
+
class ChannelAlreadyClosed < Exception
|
70
|
+
end
|
71
|
+
|
63
72
|
|
64
73
|
|
65
74
|
# Converts RabbitMQ Java client exceptions
|
@@ -77,9 +86,7 @@ module HotBunnies
|
|
77
86
|
c
|
78
87
|
end
|
79
88
|
when com.rabbitmq.client.AlreadyClosedException then
|
80
|
-
|
81
|
-
|
82
|
-
puts cmd.method.class.inspect
|
89
|
+
ChannelAlreadyClosed.new(e.reason)
|
83
90
|
when com.rabbitmq.client.ShutdownSignalException then
|
84
91
|
cmd = e.reason
|
85
92
|
|
data/lib/hot_bunnies/session.rb
CHANGED
@@ -38,13 +38,16 @@ module HotBunnies
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
|
41
42
|
new(cf)
|
42
43
|
end
|
43
44
|
|
44
45
|
|
45
46
|
def initialize(connection_factory)
|
46
47
|
@cf = connection_factory
|
47
|
-
@connection =
|
48
|
+
@connection = converting_rjc_exceptions_to_ruby do
|
49
|
+
self.new_connection
|
50
|
+
end
|
48
51
|
@channels = ConcurrentHashMap.new
|
49
52
|
end
|
50
53
|
|
@@ -159,6 +162,8 @@ module HotBunnies
|
|
159
162
|
def converting_rjc_exceptions_to_ruby(&block)
|
160
163
|
begin
|
161
164
|
block.call
|
165
|
+
rescue java.net.ConnectException => e
|
166
|
+
raise ConnectionRefused.new("Connection to #{@cf.host}:#{@cf.port} refused")
|
162
167
|
rescue com.rabbitmq.client.PossibleAuthenticationFailureException => e
|
163
168
|
raise PossibleAuthenticationFailureError.new(@cf.username, @cf.virtual_host, @cf.password.bytesize)
|
164
169
|
end
|
data/lib/hot_bunnies/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hot_bunnies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.pre6
|
5
5
|
prerelease: 6
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
|
16
16
|
email:
|