sensu-transport 2.1.0 → 2.2.0
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/sensu/transport/rabbitmq.rb +9 -0
- data/sensu-transport.gemspec +1 -1
- data/spec/rabbitmq_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9e2efea48fe1374767d24f2bf1fe5e196e84b2e
|
4
|
+
data.tar.gz: 6175da2fa7df37256fc506f350e8c210220027ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553bd1fd716d1e9d4db0d8e1c6bec9ffd8979dfe9052516c4a24356100184a66851b1d6aed00a00a36096aa64961c1b9ce8390a3a510bcffe1f4cb741e579dd5
|
7
|
+
data.tar.gz: d21146d0ffbaf397dee465dae275cf9af269dc13892c276e6544faeeb7562c72c4d1d1570c4139acc33e2fe88b0b8b4980dead7b46bd9f150f3184d6535b6bd8
|
@@ -123,6 +123,11 @@ module Sensu
|
|
123
123
|
Proc.new { reconnect }
|
124
124
|
end
|
125
125
|
|
126
|
+
def connection_error(error)
|
127
|
+
@logger.error("[amqp] Detected TCP connection failure: #{error}") if @logger
|
128
|
+
reconnect
|
129
|
+
end
|
130
|
+
|
126
131
|
def connect_with_eligible_options(&callback)
|
127
132
|
options = next_connection_options
|
128
133
|
@connection = AMQP.connect(options)
|
@@ -136,6 +141,10 @@ module Sensu
|
|
136
141
|
@connection.on_tcp_connection_loss(&reconnect_callback)
|
137
142
|
@connection.on_skipped_heartbeats(&reconnect_callback)
|
138
143
|
setup_channel(options)
|
144
|
+
rescue EventMachine::ConnectionError => error
|
145
|
+
connection_error(error)
|
146
|
+
rescue Java::JavaLang::RuntimeException => error
|
147
|
+
connection_error(error)
|
139
148
|
end
|
140
149
|
|
141
150
|
def setup_channel(options={})
|
data/sensu-transport.gemspec
CHANGED
data/spec/rabbitmq_spec.rb
CHANGED
@@ -108,6 +108,15 @@ describe "Sensu::Transport::RabbitMQ" do
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
it "can handle eventmachine connection errors" do
|
112
|
+
async_wrapper do
|
113
|
+
expect {
|
114
|
+
@transport.connect(:host => "2def33c3-cfbb-4993-b5ee-08d47f6d8793")
|
115
|
+
}.not_to raise_error
|
116
|
+
async_done
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
111
120
|
it "can be configured for multiple brokers" do
|
112
121
|
async_wrapper do
|
113
122
|
@transport.connect([{:port => 5672}, {:port => 5672}])
|