beetle 2.2.0 → 2.2.1
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/RELEASE_NOTES.rdoc +3 -0
- data/lib/beetle/subscriber.rb +9 -1
- data/lib/beetle/version.rb +1 -1
- data/test/beetle/message_test.rb +4 -3
- data/test/beetle/subscriber_test.rb +7 -0
- 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: 84342deeb60438e7eb1b8b5d1fc5c2785d0cb149c05d27783fd1a5415ca89fb9
|
4
|
+
data.tar.gz: fd6983f951df29e06446ac5923881d03055198b8d3d71fa7d0d60ab9e626ed7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16c5d3f44758b727bdaa85c27c9c574773568c358f7265cbf09c63f90f1bfef340ec5fae75013fc91a54252af4f81b33ab3cf332f91fde0aec2708a640dcde47
|
7
|
+
data.tar.gz: f601c50aaa542975cbf7a79b58f166825216ec496291989237f8904115b1260faaa6c8dd7e89586882150ac82c4f4f78209969347785571e09971d85dc5b2f17
|
data/RELEASE_NOTES.rdoc
CHANGED
data/lib/beetle/subscriber.rb
CHANGED
@@ -217,7 +217,8 @@ module Beetle
|
|
217
217
|
{
|
218
218
|
:host => current_host, :port => current_port, :logging => false,
|
219
219
|
:user => @client.config.user, :pass => @client.config.password, :vhost => @client.config.vhost,
|
220
|
-
:on_tcp_connection_failure => on_tcp_connection_failure
|
220
|
+
:on_tcp_connection_failure => on_tcp_connection_failure,
|
221
|
+
:on_possible_authentication_failure => on_possible_authentication_failure,
|
221
222
|
}
|
222
223
|
end
|
223
224
|
|
@@ -228,6 +229,13 @@ module Beetle
|
|
228
229
|
end
|
229
230
|
end
|
230
231
|
|
232
|
+
def on_possible_authentication_failure
|
233
|
+
Proc.new do |settings|
|
234
|
+
logger.error "Beetle: possible authentication failure, or server overloaded: #{server_from_settings(settings)}. shutting down!"
|
235
|
+
stop!
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
231
239
|
def on_tcp_connection_loss(connection, settings)
|
232
240
|
# reconnect in 10 seconds, without enforcement
|
233
241
|
logger.warn "Beetle: lost connection: #{server_from_settings(settings)}. reconnecting."
|
data/lib/beetle/version.rb
CHANGED
data/test/beetle/message_test.rb
CHANGED
@@ -377,9 +377,10 @@ module Beetle
|
|
377
377
|
assert_equal RC::ExceptionsLimitReached, message.__send__(:process_internal, proc)
|
378
378
|
end
|
379
379
|
|
380
|
+
class RegisteredException < StandardError; end
|
381
|
+
|
380
382
|
test "a message should not be acked if the handler crashes and the exception has been registered" do
|
381
383
|
header = header_with_params({})
|
382
|
-
RegisteredException = Class.new(StandardError)
|
383
384
|
message = Message.new("somequeue", header, 'foo', :timeout => 10.seconds, :exceptions => 2,
|
384
385
|
:retry_on => [RegisteredException], :store => @store)
|
385
386
|
assert !message.attempts_limit_reached?
|
@@ -394,10 +395,10 @@ module Beetle
|
|
394
395
|
assert_equal RC::HandlerCrash, message.__send__(:process_internal, proc)
|
395
396
|
end
|
396
397
|
|
398
|
+
class OtherException < StandardError; end
|
399
|
+
|
397
400
|
test "a message should be acked if the handler crashes and the exception has not been registered" do
|
398
401
|
header = header_with_params({})
|
399
|
-
RegisteredException = Class.new(StandardError)
|
400
|
-
OtherException = Class.new(StandardError)
|
401
402
|
message = Message.new("somequeue", header, 'foo', :timeout => 10.seconds, :exceptions => 2,
|
402
403
|
:retry_on => [RegisteredException], :store => @store)
|
403
404
|
assert !message.attempts_limit_reached?
|
@@ -428,6 +428,13 @@ module Beetle
|
|
428
428
|
cb.call(@settings)
|
429
429
|
end
|
430
430
|
|
431
|
+
test "possible authentication failure causes subscriber to exit" do
|
432
|
+
cb = @sub.send(:on_possible_authentication_failure)
|
433
|
+
@sub.expects(:stop!)
|
434
|
+
@sub.logger.expects(:error).with("Beetle: possible authentication failure, or server overloaded: mickey:42. shutting down!")
|
435
|
+
cb.call({:host => "mickey", :port => 42})
|
436
|
+
end
|
437
|
+
|
431
438
|
test "tcp connection loss handler tries to reconnect" do
|
432
439
|
connection = mock("connection")
|
433
440
|
connection.expects(:reconnect).with(false, 10)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beetle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2018-07
|
15
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: uuid4r
|