nsq-ruby 0.2.0 → 1.0.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 +13 -0
- data/lib/nsq/frames/message.rb +5 -2
- data/lib/version.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff501ee79a72dddfe0ad95cb66546d9c76ba2cc1
|
4
|
+
data.tar.gz: 6846d94a38a28d8e2a431d955743e6b2b93c4bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7366335b514e4370be9a1d09415f5cdab9256905f7ec04191d81b7e95e1cea49e018e0abf44fa05918d35f52615157284f16dc206a36c5dca75d034ee47e5522
|
7
|
+
data.tar.gz: 79db1e4772c1e50e3be6c477d634dc21b6af712c4f61c90caee56bed7acb5b615922670f7998f629dd242064f8af88728b5ca8f26e4c0ec1f84ae720d5b977c5
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@ nsq-ruby is a simple NSQ client library written in Ruby.
|
|
5
5
|
- The code is straightforward.
|
6
6
|
- It has no dependencies.
|
7
7
|
- It's well tested.
|
8
|
+
- It's being used in production and has processed billions of messages.
|
8
9
|
|
9
10
|
|
10
11
|
## Quick start
|
@@ -199,6 +200,10 @@ most messages this should be 1 (since it will be your first attempt processing
|
|
199
200
|
them). If it's more than 1, that means that you requeued the message or it
|
200
201
|
timed out in flight.
|
201
202
|
|
203
|
+
### `timestamp`
|
204
|
+
|
205
|
+
Returns the time this message was originally sent to NSQ as a `Time` object.
|
206
|
+
|
202
207
|
### `#finish`
|
203
208
|
|
204
209
|
Notify NSQ that you've completed processing of this message.
|
@@ -237,6 +242,7 @@ connection timeout support (0.2.29).
|
|
237
242
|
|
238
243
|
- Discovery via nsqlookupd
|
239
244
|
- Automatic reconnection to nsqd
|
245
|
+
- Producing to all nsqd instances automatically via nsqlookupd
|
240
246
|
|
241
247
|
### Does not support
|
242
248
|
|
@@ -266,6 +272,13 @@ VERBOSE=true rake spec
|
|
266
272
|
```
|
267
273
|
|
268
274
|
|
275
|
+
## Is this production ready?
|
276
|
+
|
277
|
+
Yes! It's used in several critical parts of our infrastructure at
|
278
|
+
[Wistia](http://wistia.com) and currently produces and consumes tens of
|
279
|
+
millions of messages a day.
|
280
|
+
|
281
|
+
|
269
282
|
## Authors
|
270
283
|
|
271
284
|
- Robby Grossman (@freerobby)
|
data/lib/nsq/frames/message.rb
CHANGED
@@ -3,14 +3,13 @@ require_relative 'frame'
|
|
3
3
|
module Nsq
|
4
4
|
class Message < Frame
|
5
5
|
|
6
|
-
attr_reader :timestamp
|
7
6
|
attr_reader :attempts
|
8
7
|
attr_reader :id
|
9
8
|
attr_reader :body
|
10
9
|
|
11
10
|
def initialize(data, connection)
|
12
11
|
super
|
13
|
-
@
|
12
|
+
@timestamp_in_nanoseconds, @attempts, @id, @body = @data.unpack('Q>s>a16a*')
|
14
13
|
@body.force_encoding('UTF-8')
|
15
14
|
end
|
16
15
|
|
@@ -26,5 +25,9 @@ module Nsq
|
|
26
25
|
connection.touch(id)
|
27
26
|
end
|
28
27
|
|
28
|
+
def timestamp
|
29
|
+
Time.at(@timestamp_in_nanoseconds / 1_000_000_000.0)
|
30
|
+
end
|
31
|
+
|
29
32
|
end
|
30
33
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsq-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wistia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
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: 2.0
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nsq-cluster
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.1
|
47
|
+
version: '1.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.1
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.0
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0
|
68
|
+
version: '3.0'
|
69
69
|
description: ''
|
70
70
|
email: dev@wistia.com
|
71
71
|
executables: []
|