anschel 0.7.10 → 0.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/anschel/input/rabbitmq.rb +49 -1
- data/lib/anschel/main.rb +0 -2
- data/lib/anschel/output/device.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdf130bb128d999dc9450067c9633f83d9526c38
|
4
|
+
data.tar.gz: 23e6e0352befe82127788fee394d833dcc2abbe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c699d8b18cf952003b5623dc070bff72a8104dbcea3742e4f8322c149c953a00be2006338aef9c664266b1e3aee94d1168535791077a0d02718e91f25e631a3
|
7
|
+
data.tar.gz: bed1c3540726189cc64ce303d26ff46671da086323e7e13cb942cdecd631ee4003e49fa582931ed3de647462743aa3ecee6ac2323b0076715dae0cc695d319f1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.11
|
@@ -7,7 +7,11 @@ module Anschel
|
|
7
7
|
class Input
|
8
8
|
class RabbitMQ < Base
|
9
9
|
def initialize output, config, stats, log
|
10
|
-
connection_defaults = {
|
10
|
+
connection_defaults = {
|
11
|
+
heartbeat_interval: 30,
|
12
|
+
connection_timeout: 10,
|
13
|
+
automatically_recover: false
|
14
|
+
}
|
11
15
|
|
12
16
|
exchange_defaults = {
|
13
17
|
type: 'x-consistent-hash',
|
@@ -29,11 +33,14 @@ module Anschel
|
|
29
33
|
connection = ::MarchHare.connect \
|
30
34
|
connection_defaults.merge(config[:connection] || {})
|
31
35
|
|
36
|
+
handle_errors connection, log
|
37
|
+
|
32
38
|
exchange_name = config[:exchange].delete(:name)
|
33
39
|
|
34
40
|
@threads = config[:queues].map do |queue_name, queue_config|
|
35
41
|
Thread.new do
|
36
42
|
channel = connection.create_channel
|
43
|
+
channel.prefetch = config[:prefetch] || 256
|
37
44
|
|
38
45
|
exchange = channel.exchange exchange_name, \
|
39
46
|
exchange_defaults.merge(config[:exchange])
|
@@ -62,6 +69,47 @@ module Anschel
|
|
62
69
|
@threads.map(&:kill)
|
63
70
|
@stopped = true
|
64
71
|
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# Ensure broker errors results in logs and exits appropriately. Seems like
|
76
|
+
# the March Hare is catching exceptions under the hood, so we can't just
|
77
|
+
# raise within these callbacks, and we're stuck with this jankiness
|
78
|
+
def handle_errors connection, log
|
79
|
+
shutdown = false
|
80
|
+
blocked = false
|
81
|
+
|
82
|
+
connection.on_blocked { |reason| blocked = reason }
|
83
|
+
|
84
|
+
connection.on_unblocked { blocked = nil }
|
85
|
+
|
86
|
+
connection.on_shutdown { |_, reason| shutdown = reason }
|
87
|
+
|
88
|
+
Thread.new do
|
89
|
+
loop do
|
90
|
+
sleep 1
|
91
|
+
|
92
|
+
if shutdown
|
93
|
+
log.fatal \
|
94
|
+
event: 'input-rabbitmq-shutdown',
|
95
|
+
reason: shutdown
|
96
|
+
raise RuntimeError
|
97
|
+
end
|
98
|
+
|
99
|
+
if blocked
|
100
|
+
log.warn \
|
101
|
+
event: 'input-rabbitmq-blocked',
|
102
|
+
reason: blocked
|
103
|
+
|
104
|
+
elsif blocked.nil?
|
105
|
+
log.warn \
|
106
|
+
event: 'input-rabbitmq-unblocked'
|
107
|
+
end
|
108
|
+
|
109
|
+
blocked = false
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
65
113
|
end
|
66
114
|
end
|
67
115
|
end
|
data/lib/anschel/main.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anschel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '2.
|
102
|
+
version: '2.15'
|
103
103
|
name: march_hare
|
104
104
|
prerelease: false
|
105
105
|
type: :runtime
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
110
|
+
version: '2.15'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|