watership 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/watership/subscriber.rb +26 -0
- data/lib/watership/version.rb +1 -1
- data/lib/watership.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba99e78f4a263b2aa1f7f8940e5888210afd404f
|
4
|
+
data.tar.gz: 14b43ac76d64bbb5eab1a32fd24839463ba7f329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a894ef004e496ae153269fe2653f1868a903bdb75c09adfb8e799b55b68bd81a6db0cd93f90e80bb705554f5ffff05e32d5c62c470def032ad2b6084cbe0ea
|
7
|
+
data.tar.gz: 2b0da5493a5d0ee1e1fe64e5e40fe3328831126ae74b59f03362d00ba16af8cd9ddfb49feb98284fec0960cefc7982ac32ae0c4c65995911c7fa493798645b7c
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Watership
|
2
|
+
module Subscriber
|
3
|
+
def perform(payload)
|
4
|
+
raise NotImplementedError
|
5
|
+
end
|
6
|
+
|
7
|
+
def subscribe(name, options = {})
|
8
|
+
options = { block: true, ack: true }.merge(options)
|
9
|
+
|
10
|
+
queue(name).subscribe(options) do |delivery_info, properties, payload|
|
11
|
+
perform(JSON.parse(payload))
|
12
|
+
queue_channel.acknowledge(delivery_info.delivery_tag, false) if options[:ack]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def queue(name)
|
19
|
+
Watership.connect_with_queue(name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def queue_channel
|
23
|
+
Watership.channel
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/watership/version.rb
CHANGED
data/lib/watership.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Scofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- README.md
|
80
80
|
- Rakefile
|
81
81
|
- lib/watership.rb
|
82
|
+
- lib/watership/subscriber.rb
|
82
83
|
- lib/watership/version.rb
|
83
84
|
- watership.gemspec
|
84
85
|
homepage: ''
|