carnivore-nsq 0.1.14 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/carnivore-nsq.gemspec +1 -1
- data/lib/carnivore-nsq/nsq.rb +22 -3
- data/lib/carnivore-nsq/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3b7fae9cfe352e849c07b62024e2f8d38620ab5
|
4
|
+
data.tar.gz: 9c16d5be35a89d929df90629a86c6b06a9afd396
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade94f7e66bc8552c726f0b23f5bc4627357a86ce9206a41de82d5d1430a681ab3d1f28512c33cb7c3cce304cce4a70a8ca46ae277be9bbf70a7b278ca85ef6e
|
7
|
+
data.tar.gz: 801f9fce9954b3a4e4cac1da8cf2c6d13fed96597ee8b8577f8398cf61c544b23d0ffdacf0424bfb97d9c9e18c7a4294c8ebadb4e71f2c0b45a9d32a9e3f0aa7
|
data/CHANGELOG.md
CHANGED
data/carnivore-nsq.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = 'Carnivore NSQ source'
|
11
11
|
s.require_path = 'lib'
|
12
12
|
s.license = 'Apache 2.0'
|
13
|
-
s.add_dependency 'carnivore', '
|
13
|
+
s.add_dependency 'carnivore', '> 0.3.8'
|
14
14
|
s.add_dependency 'krakow', '>= 0.3.6'
|
15
15
|
s.files = Dir['lib/**/*'] + %w(carnivore-nsq.gemspec README.md CHANGELOG.md CONTRIBUTING.md LICENSE)
|
16
16
|
end
|
data/lib/carnivore-nsq/nsq.rb
CHANGED
@@ -57,14 +57,27 @@ module Carnivore
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
# Clean up custom actors on teardown
|
61
|
+
def teardown_cleanup
|
62
|
+
[reader, writer].each do |r_con|
|
63
|
+
if(r_con && r_con.alive?)
|
64
|
+
begin
|
65
|
+
r_con.terminate
|
66
|
+
rescue Celluloid::Task::TerminatedError
|
67
|
+
warn 'Terminated task error when cleaning NSQ connections. Moving on.'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
super
|
72
|
+
end
|
73
|
+
|
60
74
|
# Build the consumer connection
|
61
75
|
def build_consumer
|
62
76
|
consumer_args = Smash.new(
|
63
77
|
:nsqlookupd => lookupd,
|
64
78
|
:topic => topic,
|
65
79
|
:channel => channel,
|
66
|
-
:max_in_flight => args.fetch(:max_in_flight, 100)
|
67
|
-
:notifier => waiter
|
80
|
+
:max_in_flight => args.fetch(:max_in_flight, 100)
|
68
81
|
).merge(reader_args)
|
69
82
|
@reader = Krakow::Consumer.new(consumer_args)
|
70
83
|
link @reader
|
@@ -121,7 +134,13 @@ module Carnivore
|
|
121
134
|
#
|
122
135
|
# @return [String]
|
123
136
|
def receive(*_)
|
124
|
-
Celluloid::Future.new{ consumer.queue.pop }.value
|
137
|
+
msg = Celluloid::Future.new{ consumer.queue.pop }.value
|
138
|
+
begin
|
139
|
+
content = MultiJson.load(msg.message)
|
140
|
+
rescue MultiJson::ParseError
|
141
|
+
content = msg.message
|
142
|
+
end
|
143
|
+
{:raw => msg, :content => content}
|
125
144
|
end
|
126
145
|
|
127
146
|
# Send message
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carnivore
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.3.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.3.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: krakow
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|