krakow 0.2.0 → 0.2.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.
- data/CHANGELOG.md +3 -0
- data/lib/krakow/consumer.rb +5 -4
- data/lib/krakow/discovery.rb +2 -2
- data/lib/krakow/version.rb +1 -1
- metadata +1 -2
data/CHANGELOG.md
CHANGED
data/lib/krakow/consumer.rb
CHANGED
@@ -12,19 +12,20 @@ module Krakow
|
|
12
12
|
def initialize(args={})
|
13
13
|
super
|
14
14
|
required! :topic, :channel
|
15
|
-
optional :host, :port, :nslookupd, :max_in_flight, :backoff_interval, :discovery_interval, :notifier, :connection_features
|
15
|
+
optional :host, :port, :nslookupd, :nsqlookupd, :max_in_flight, :backoff_interval, :discovery_interval, :notifier, :connection_features
|
16
16
|
arguments[:max_in_flight] ||= 1
|
17
17
|
arguments[:discovery_interval] ||= 30
|
18
18
|
arguments[:connection_features] ||= {}
|
19
|
+
arguments[:nsqlookupd] ||= arguments[:nslookupd]
|
19
20
|
@connections = {}
|
20
21
|
@distribution = Distribution::Default.new(
|
21
22
|
:max_in_flight => max_in_flight,
|
22
23
|
:backoff_interval => backoff_interval
|
23
24
|
)
|
24
25
|
@queue = Queue.new
|
25
|
-
if(
|
26
|
-
debug "Connections will be established via lookup #{
|
27
|
-
@discovery = Discovery.new(:
|
26
|
+
if(nsqlookupd)
|
27
|
+
debug "Connections will be established via lookup #{nsqlookupd.inspect}"
|
28
|
+
@discovery = Discovery.new(:nsqlookupd => nsqlookupd)
|
28
29
|
init!
|
29
30
|
every(discovery_interval){ init! }
|
30
31
|
elsif(host && port)
|
data/lib/krakow/discovery.rb
CHANGED
@@ -9,13 +9,13 @@ module Krakow
|
|
9
9
|
|
10
10
|
def initialize(args={})
|
11
11
|
super
|
12
|
-
required! :
|
12
|
+
required! :nsqlookupd
|
13
13
|
end
|
14
14
|
|
15
15
|
# topic:: Topic name
|
16
16
|
# Return list of end points with given topic name available
|
17
17
|
def lookup(topic)
|
18
|
-
result = [
|
18
|
+
result = [nsqlookupd].flatten.map do |location|
|
19
19
|
uri = URI.parse(location)
|
20
20
|
uri.path = '/lookup'
|
21
21
|
uri.query = "topic=#{topic}&ts=#{Time.now.to_i}"
|
data/lib/krakow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: krakow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- Gemfile
|
137
137
|
- README.md
|
138
138
|
- krakow.gemspec
|
139
|
-
- krakow-0.2.0.gem
|
140
139
|
- CHANGELOG.md
|
141
140
|
- Gemfile.lock
|
142
141
|
homepage: http://github.com/chrisroberts/krakow
|