carnivore-nsq 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/carnivore-nsq/nsq.rb +34 -5
- data/lib/carnivore-nsq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e399157a914d9409adf05677cc934b54f4d3a9b6
|
4
|
+
data.tar.gz: 31c2b2bcbfd04ca660829e41aba0519e67956d21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 657c05e4620f97360586a772857db9dd5b6c6298cce8b73d39b83346d3c2af5f7a62f6d9b8932e96159945ffc9cd95255a8da672458dbedf80d6fa914c42cc43
|
7
|
+
data.tar.gz: 86a14b6e8b833323dbc026342f70767a2333f9e20a333f092111da2ef9b75c7305c1cbfd510ef4b39cd8f33ebcc44ee59d629ab2312d7d7f84af4f4190dc84b2
|
data/CHANGELOG.md
CHANGED
data/lib/carnivore-nsq/nsq.rb
CHANGED
@@ -5,7 +5,7 @@ module Carnivore
|
|
5
5
|
class Source
|
6
6
|
class Nsq < Source
|
7
7
|
|
8
|
-
trap_exit :
|
8
|
+
trap_exit :trapper
|
9
9
|
|
10
10
|
# @return [String] default path for global lookupd configuration
|
11
11
|
DEFAULT_LOOKUPD_PATH = '/etc/carnivore/nsq.json'
|
@@ -31,19 +31,38 @@ module Carnivore
|
|
31
31
|
Krakow::Utils::Logging.level = (Carnivore::Config.get(:krakow, :logging, :level) || :info).to_sym
|
32
32
|
end
|
33
33
|
|
34
|
-
#
|
34
|
+
# Recover from exit if unexpected or tear down conenctions if requested
|
35
35
|
#
|
36
36
|
# @param obj [Celluloid::Actor] failed actor
|
37
37
|
# @param exception [Exception] actor exception
|
38
|
-
def
|
38
|
+
def trapper(obj, exception)
|
39
39
|
if(exception)
|
40
40
|
exclusive do
|
41
41
|
warn 'Consumer failure detected. Forcing termination and rebuilding.'
|
42
|
-
|
42
|
+
begin
|
43
|
+
@reader.terminate
|
44
|
+
rescue => e
|
45
|
+
warn "Consumer error suppressed on termination: #{e.class} - #{e}"
|
46
|
+
end
|
43
47
|
@reader = nil
|
44
48
|
build_consumer
|
45
49
|
info "Consumer connection for #{topic}:#{channel} re-established #{reader}"
|
46
50
|
end
|
51
|
+
else
|
52
|
+
if(@reader)
|
53
|
+
begin
|
54
|
+
@reader.terminate
|
55
|
+
rescue => e
|
56
|
+
warn "Consumer error suppressed on termination: #{e.class} - #{e}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
if(@writer)
|
60
|
+
begin
|
61
|
+
@writer.terminate
|
62
|
+
rescue => e
|
63
|
+
warn "Producer error suppressed on termination: #{e.class} - #{e}"
|
64
|
+
end
|
65
|
+
end
|
47
66
|
end
|
48
67
|
end
|
49
68
|
|
@@ -127,9 +146,13 @@ module Carnivore
|
|
127
146
|
begin
|
128
147
|
unless(consumer.confirm(message[:message]))
|
129
148
|
error "Failed to confirm payload from source! (#{e})"
|
149
|
+
false
|
150
|
+
else
|
151
|
+
true
|
130
152
|
end
|
131
153
|
rescue Krakow::Error::LookupFailed => e
|
132
154
|
error "Failed to confirm payload from source! (#{e})"
|
155
|
+
false
|
133
156
|
end
|
134
157
|
end
|
135
158
|
|
@@ -138,7 +161,13 @@ module Carnivore
|
|
138
161
|
# @param message [Carnivore::Message]
|
139
162
|
# @return [TrueClass]
|
140
163
|
def touch(message)
|
141
|
-
|
164
|
+
begin
|
165
|
+
message[:message].touch
|
166
|
+
true
|
167
|
+
rescue Krakow::Error::LookupFailed => e
|
168
|
+
error "Failed to touch payload from source! (#{e})"
|
169
|
+
false
|
170
|
+
end
|
142
171
|
end
|
143
172
|
|
144
173
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carnivore-nsq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carnivore
|