nsq-ruby 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/lib/nsq/consumer.rb +8 -4
- data/lib/nsq/discovery.rb +1 -1
- data/lib/nsq/frames/message.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +6 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e154c268c869f718aa9942e54f23dc6d62b7299ac26a1facb91f7f5d6d324c
|
4
|
+
data.tar.gz: 164655c96eb9730b5396c1b50000378fabf4f9e97c54dff358f33bcff6c0e7dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f89d563ed42364550a1a301040e78ea758e563c0f867404b3d11b25f0d54917e10abfa754018c2d940fcc193dae3475e6e164544b7a141c67136e8a0d29fff68
|
7
|
+
data.tar.gz: 1b4400f790a5c16c07dd34d58e468a11e71c2026eb0567dba0584bac20d2cbe9beb227a897b69832ae0774e405cad064ed65cf318b74414ac62cf2c165586216
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ nsq-ruby is a simple NSQ client library written in Ruby.
|
|
17
17
|
```Ruby
|
18
18
|
require 'nsq'
|
19
19
|
producer = Nsq::Producer.new(
|
20
|
-
nsqd: '127.0.0.1:4150',
|
20
|
+
nsqd: '127.0.0.1:4150', # or ['127.0.0.1:4150']
|
21
21
|
topic: 'some-topic'
|
22
22
|
)
|
23
23
|
|
@@ -77,7 +77,7 @@ For example, if you'd like to publish messages to a single nsqd.
|
|
77
77
|
|
78
78
|
```Ruby
|
79
79
|
producer = Nsq::Producer.new(
|
80
|
-
nsqd: '6.7.8.9:4150',
|
80
|
+
nsqd: '6.7.8.9:4150', # or ['6.7.8.9:4150']
|
81
81
|
topic: 'topic-of-great-esteem'
|
82
82
|
)
|
83
83
|
```
|
@@ -177,6 +177,14 @@ reconnect.
|
|
177
177
|
This is automatically called `at_exit`, but it's good practice to close your
|
178
178
|
producers when you're done with them.
|
179
179
|
|
180
|
+
**Note:** This terminates the connection to NSQ immediately. If you're writing
|
181
|
+
messages faster than they can be sent to NSQ, you may have messages in the
|
182
|
+
producer's internal queue. Calling `#terminate` before they're sent will cause
|
183
|
+
these messages to be lost. After you write your last message, consider sleeping
|
184
|
+
for a second before you call `#terminate`.
|
185
|
+
|
186
|
+
|
187
|
+
|
180
188
|
|
181
189
|
## Consumer
|
182
190
|
|
@@ -391,7 +399,7 @@ millions of messages a day.
|
|
391
399
|
|
392
400
|
## MIT License
|
393
401
|
|
394
|
-
Copyright (C)
|
402
|
+
Copyright (C) 2018 Wistia, Inc.
|
395
403
|
|
396
404
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
397
405
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -410,4 +418,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
410
418
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
411
419
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
412
420
|
SOFTWARE.
|
413
|
-
|
data/lib/nsq/consumer.rb
CHANGED
@@ -27,7 +27,7 @@ module Nsq
|
|
27
27
|
|
28
28
|
# This is where we keep a record of our active nsqd connections
|
29
29
|
# The key is a string with the host and port of the instance (e.g.
|
30
|
-
# '127.0.0.1:4150') and the
|
30
|
+
# '127.0.0.1:4150') and the value is the Connection instance.
|
31
31
|
@connections = {}
|
32
32
|
|
33
33
|
if !@nsqlookupds.empty?
|
@@ -36,10 +36,14 @@ module Nsq
|
|
36
36
|
topic: @topic,
|
37
37
|
interval: @discovery_interval
|
38
38
|
)
|
39
|
+
|
40
|
+
elsif opts[:nsqd]
|
41
|
+
nsqds = [opts[:nsqd]].flatten
|
42
|
+
max_per_conn = max_in_flight_per_connection(nsqds.size)
|
43
|
+
nsqds.each{|d| add_connection(d, max_in_flight: max_per_conn)}
|
44
|
+
|
39
45
|
else
|
40
|
-
|
41
|
-
# in this case let's connect to an nsqd instance directly
|
42
|
-
add_connection(opts[:nsqd] || '127.0.0.1:4150', max_in_flight: @max_in_flight)
|
46
|
+
add_connection('127.0.0.1:4150', max_in_flight: @max_in_flight)
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
data/lib/nsq/discovery.rb
CHANGED
data/lib/nsq/frames/message.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsq-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wistia
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: jeweler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.0'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: nsq-cluster
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,7 +65,7 @@ homepage: http://github.com/wistia/nsq-ruby
|
|
93
65
|
licenses:
|
94
66
|
- MIT
|
95
67
|
metadata: {}
|
96
|
-
post_install_message:
|
68
|
+
post_install_message:
|
97
69
|
rdoc_options: []
|
98
70
|
require_paths:
|
99
71
|
- lib
|
@@ -108,9 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
80
|
- !ruby/object:Gem::Version
|
109
81
|
version: '0'
|
110
82
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
83
|
+
rubygems_version: 3.1.6
|
84
|
+
signing_key:
|
114
85
|
specification_version: 4
|
115
86
|
summary: Ruby client library for NSQ
|
116
87
|
test_files: []
|