simplepubsub 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/simplepubsub.rb +32 -11
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb381f1a9193783cec4ec0e89707d8cf09ea4b59
|
4
|
+
data.tar.gz: f7073225dd5c8429af8cdc86fd107e494022f033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a80c6ee14fa0364868a3160570c103629d2ed2702f83cb5917b231bb07ad7114c54a5e08837afaabd128f4a04fdc14b1861d7fe6ac2103810de04ce5e260169
|
7
|
+
data.tar.gz: ad4f5f78400633816e44c4e2d8757f5805396342623a6629a6361225d03e3323f0528d88f294736c7caabd52b6184f8cc26ad6e6b1419ac37dd9a7143f61db25
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/simplepubsub.rb
CHANGED
@@ -7,7 +7,7 @@ require 'drb'
|
|
7
7
|
require 'dws-registry'
|
8
8
|
|
9
9
|
|
10
|
-
USER_AGENT = 'SimplePubSub client 0.
|
10
|
+
USER_AGENT = 'SimplePubSub client 0.4.0'
|
11
11
|
|
12
12
|
module SimplePubSub
|
13
13
|
|
@@ -25,29 +25,39 @@ module SimplePubSub
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def initialize(
|
29
|
-
@
|
28
|
+
def initialize(hostname)
|
29
|
+
@hostname = hostname
|
30
30
|
end
|
31
31
|
|
32
32
|
def get(topic, &get_proc)
|
33
33
|
|
34
34
|
DRb.start_service nil, Echo.new(&get_proc)
|
35
|
-
|
36
|
-
"
|
37
|
-
|
38
|
-
DRb.thread.join
|
35
|
+
|
36
|
+
obj = DRbObject.new nil, "druby://#{@hostname}:59000"
|
37
|
+
obj.subscribe(topic, DRb.uri)
|
38
|
+
DRb.thread.join
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def publish(topic, message)
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
{|x| x.read}
|
44
|
+
DRb.start_service
|
45
|
+
obj = DRbObject.new nil, "druby://#{@hostname}:59000"
|
46
|
+
obj.deliver topic, message
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
50
|
+
attr_reader :remote_obj
|
51
|
+
|
52
|
+
# generally used by the web server
|
53
|
+
#
|
54
|
+
def initialize(hostname)
|
55
|
+
|
56
|
+
DRb.start_service
|
57
|
+
# attach to the DRb server via a URI given on the command line
|
58
|
+
@remote_obj = DRbObject.new nil, "druby://#{hostname}:59000"
|
59
|
+
end
|
60
|
+
|
51
61
|
def self.connect(base_url)
|
52
62
|
yield(PubSub.new base_url)
|
53
63
|
end
|
@@ -106,6 +116,17 @@ module SimplePubSub
|
|
106
116
|
end
|
107
117
|
'done'
|
108
118
|
end
|
119
|
+
|
120
|
+
def start()
|
121
|
+
|
122
|
+
# start up the DRb service
|
123
|
+
DRb.start_service 'druby://:59000', self
|
124
|
+
|
125
|
+
# wait for the DRb service to finish before exiting
|
126
|
+
DRb.thread.join
|
127
|
+
|
128
|
+
'done'
|
129
|
+
end
|
109
130
|
|
110
131
|
def subscribe(topic, uri)
|
111
132
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplepubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
i0PBE6fLwlIMk8jNNUcX3J1csSMgLNTwE8CwrlSZE8sueHj0pQzICM7lF0gGREO6
|
32
32
|
hQHD0LljU3MusQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2013-
|
34
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dws-registry
|
metadata.gz.sig
CHANGED
Binary file
|