simplepubsub 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/simplepubsub.rb +37 -33
- 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: ae7553c303ff5df3f6d11c22139545578859b406
|
4
|
+
data.tar.gz: 8d73b563bdc82f7310283d79373209f5fa8d633c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4329603a8f15a84e48943d2c5dc2cbcc749c342aed1ad8bb63cfa4dbc4b96e45834be0f24ebb439090d6dcc583d60aec9fe39580a62b849b2befb853e0c79536
|
7
|
+
data.tar.gz: 6ac2a06f64e8ee0727a787aa5c0823b045353c35aa82d0a6e036c2e1888ec21850b9e720ef5cae1676bf9c42e135d619f00e9efcb7d83b64d64b604b12e6938b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/simplepubsub.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
require 'open-uri'
|
6
6
|
require 'drb'
|
7
7
|
require 'dws-registry'
|
8
|
+
require 'socket'
|
8
9
|
|
9
|
-
|
10
|
-
USER_AGENT = 'SimplePubSub client 0.4.0'
|
10
|
+
USER_AGENT = 'SimplePubSub client 0.4'
|
11
11
|
|
12
12
|
module SimplePubSub
|
13
13
|
|
@@ -67,7 +67,7 @@ module SimplePubSub
|
|
67
67
|
|
68
68
|
attr_reader :subscribers, :bridges
|
69
69
|
|
70
|
-
def initialize(
|
70
|
+
def initialize(raw_reg='simplepubsub.xml')
|
71
71
|
|
72
72
|
|
73
73
|
h = {DWSRegistry: ->{raw_reg}, String: ->{DWSRegistry.new raw_reg}}
|
@@ -77,7 +77,7 @@ module SimplePubSub
|
|
77
77
|
# try to read the subscribers
|
78
78
|
topics = @reg.get_key 'hkey_apps/simplepubsub/subscription_topics'
|
79
79
|
|
80
|
-
@hostname =
|
80
|
+
@hostname = Socket.gethostname
|
81
81
|
@subscribers, @bridges = {'#' => []}, {'#' => {}}
|
82
82
|
|
83
83
|
if topics then
|
@@ -165,43 +165,47 @@ module SimplePubSub
|
|
165
165
|
|
166
166
|
topic_subscribers.each do |uri|
|
167
167
|
|
168
|
-
next if @subscribers['#'].include? uri
|
169
|
-
echo = DRbObject.new nil, uri
|
168
|
+
next if @subscribers['#'].include? uri
|
170
169
|
|
171
|
-
|
172
|
-
echo.
|
173
|
-
rescue DRb::DRbConnError => e
|
170
|
+
Thread.new {
|
171
|
+
echo = DRbObject.new nil, uri
|
174
172
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
173
|
+
begin
|
174
|
+
echo.message topic, msg
|
175
|
+
rescue DRb::DRbConnError => e
|
176
|
+
|
177
|
+
@subscribers[topic].delete uri
|
178
|
+
|
179
|
+
if @subscribers[topic].empty? then
|
180
|
+
@subscribers.delete topic
|
181
|
+
key = "hkey_apps/simplepubsub/subscription_topics/%s" % [topic]
|
182
|
+
else
|
183
|
+
key = "hkey_apps/simplepubsub/subscription_topics/%s/subscribers/%s" % \
|
184
|
+
[topic, uri[/[^\/]+$/].sub(':','')]
|
185
|
+
end
|
186
|
+
|
187
|
+
@reg.delete_key key
|
188
|
+
|
189
|
+
end
|
190
|
+
}
|
188
191
|
|
189
192
|
end
|
190
193
|
end
|
191
194
|
|
192
195
|
@subscribers['#'].each do |uri|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
begin
|
197
|
-
echo.message topic, msg
|
198
|
-
rescue DRb::DRbConnError => e
|
196
|
+
Thread.new {
|
197
|
+
echo = DRbObject.new nil, uri
|
199
198
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
199
|
+
begin
|
200
|
+
echo.message topic, msg
|
201
|
+
rescue DRb::DRbConnError => e
|
202
|
+
|
203
|
+
@subscribers['#'].delete uri
|
204
|
+
key = "hkey_apps/simplepubsub/subscription_all_topics/subscribers/%s" % \
|
205
|
+
[uri[/[^\/]+$/].sub(':','')]
|
206
|
+
@reg.delete_key key
|
207
|
+
end
|
208
|
+
}
|
205
209
|
|
206
210
|
end
|
207
211
|
end
|
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.
|
4
|
+
version: 0.4.1
|
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-07-
|
34
|
+
date: 2013-07-20 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
|