carnivore-nsq 0.1.0 → 0.1.2
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/CHANGELOG.md +4 -0
- data/carnivore-nsq.gemspec +1 -1
- data/lib/carnivore-nsq/nsq.rb +19 -9
- data/lib/carnivore-nsq/version.rb +1 -1
- 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: 3f438ef33ef48c7cb9b12163e34dd75290f54e6a
|
|
4
|
+
data.tar.gz: 61d4d61a28c6ff00bba7b3efcc742ae483541d08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6fb5b893a745c1e79e920d2978ad8103edf02027b685e8e7afb1254435afdfffb81cf4828f51531cfb2b3cbaf26ea1981252c2fe0a54c8f454139fa97798ba8
|
|
7
|
+
data.tar.gz: 8404088689a552641f78b7faa7a6ec6ab03ee65099ed0e47aca6c9d716adf8809c98cb0509541167b1524d0d3729534aefce815c812452f21b4e05b3eb0ddfc5
|
data/CHANGELOG.md
CHANGED
data/carnivore-nsq.gemspec
CHANGED
|
@@ -11,6 +11,6 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.require_path = 'lib'
|
|
12
12
|
s.license = 'Apache 2.0'
|
|
13
13
|
s.add_dependency 'carnivore', '>= 0.1.8'
|
|
14
|
-
s.add_dependency 'krakow'
|
|
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
|
@@ -14,36 +14,44 @@ module Carnivore
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
def setup(args={})
|
|
17
|
-
@args = args.
|
|
17
|
+
@args = args.to_smash
|
|
18
18
|
@lookupd = (default_lookupds + [args[:lookupd]]).flatten.compact.uniq
|
|
19
19
|
@http_transmit = args[:http_transmit]
|
|
20
20
|
@producer_args = args[:producer]
|
|
21
21
|
@topic = args[:topic]
|
|
22
22
|
@channel = args[:channel] || 'default'
|
|
23
|
-
@reader_args = args[:reader_opts] ||
|
|
23
|
+
@reader_args = args[:reader_opts] || Smash.new
|
|
24
24
|
@waiter = Celluloid::Condition.new
|
|
25
25
|
Krakow::Utils::Logging.level = (Carnivore::Config.get(:krakow, :logging, :level) || :info).to_sym
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def connect
|
|
29
|
-
|
|
30
|
-
consumer_args =
|
|
29
|
+
unless(lookupd.empty?)
|
|
30
|
+
consumer_args = Smash.new(
|
|
31
31
|
:nsqlookupd => lookupd,
|
|
32
32
|
:topic => topic,
|
|
33
33
|
:channel => channel,
|
|
34
34
|
:max_in_flight => 1,
|
|
35
35
|
:notifier => waiter
|
|
36
|
-
|
|
36
|
+
).merge(reader_args)
|
|
37
37
|
@reader = Krakow::Consumer.new(consumer_args)
|
|
38
38
|
info "Reader connection for #{topic}:#{channel} established #{reader}"
|
|
39
39
|
end
|
|
40
40
|
if(producer_args)
|
|
41
|
-
@writer = Krakow::Producer.new(
|
|
41
|
+
@writer = Krakow::Producer.new(
|
|
42
|
+
producer_args.merge(
|
|
43
|
+
Smash.new(
|
|
44
|
+
:topic => topic
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
)
|
|
42
48
|
info "Producer TCP connection for #{topic} established #{writer}"
|
|
43
49
|
elsif(http_transmit)
|
|
44
50
|
@writer = Krakow::Producer::Http.new(
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
Smash.new(
|
|
52
|
+
:endpoint => http_transmit,
|
|
53
|
+
:topic => topic
|
|
54
|
+
)
|
|
47
55
|
)
|
|
48
56
|
info "Producer HTTP connection for #{topic} established #{writer}"
|
|
49
57
|
end
|
|
@@ -82,7 +90,9 @@ module Carnivore
|
|
|
82
90
|
lookupds = nil
|
|
83
91
|
if(File.exists?(json_path))
|
|
84
92
|
begin
|
|
85
|
-
lookupds = MultiJson.load(
|
|
93
|
+
lookupds = MultiJson.load(
|
|
94
|
+
File.read(json_path)
|
|
95
|
+
).to_smash[:lookupds]
|
|
86
96
|
rescue MultiJson::LoadError => e
|
|
87
97
|
error "Failed to load nsqlookupd file from system: #{e}"
|
|
88
98
|
end
|
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.2
|
|
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-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: carnivore
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.3.6
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 0.3.6
|
|
41
41
|
description: Carnivore NSQ source
|
|
42
42
|
email: chrisroberts.code@gmail.com
|
|
43
43
|
executables: []
|