wampus 0.0.4 → 0.0.5
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
- data/lib/wampus/backends/redis.rb +6 -13
- data/lib/wampus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb58f22049d9f09a70845982e65ed973ab1d05a
|
4
|
+
data.tar.gz: 9c5e02435c5282da1145a002b67c1792a74f3211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fab955b9b85aa6fb3a99fe7c325ddd1637e7b7bd73c8b3913b4827d289be06829c677d3a1b0066d0b2955fb0cf5d9219d5f25d86a9211bdf6be7c44d5e4607e0
|
7
|
+
data.tar.gz: e6ca9efc648328ec02d8d43cef3309869eff6c78934ba7ea85eda40d195412602bef68bb9fbabdd43cc0230cd434ba0b5cff51c63acc96c45d138c3b22ffc2bc
|
@@ -51,23 +51,19 @@ module Wampus
|
|
51
51
|
Thread.new do
|
52
52
|
@subscriber.subscribe(@events_namespace) do |on|
|
53
53
|
on.message do |channel, message|
|
54
|
-
|
54
|
+
handle_message_from_redis(message)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
62
|
-
|
61
|
+
def dispatch_event(topic_uri, payload, excluded, included)
|
62
|
+
@redis.publish @events_namespace, [SecureRandom.uuid, topic_uri, payload, excluded, included].to_json
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
66
66
|
|
67
|
-
def create_event_on_redis(connection_id, topic_uri, payload, excluded, included)
|
68
|
-
@redis.publish @events_namespace, [SecureRandom.uuid, connection_id, topic_uri, payload, excluded, included].to_json
|
69
|
-
end
|
70
|
-
|
71
67
|
def subscribe_to_events
|
72
68
|
Thread.new do
|
73
69
|
@subscriber.subscribe(@events_ns) do |on|
|
@@ -80,17 +76,14 @@ module Wampus
|
|
80
76
|
|
81
77
|
def handle_message_from_redis(message)
|
82
78
|
begin
|
83
|
-
|
79
|
+
msg_id, uri, payload, excluded, included = JSON.parse(message)
|
84
80
|
|
85
|
-
connection = find_connections(:id => connection_id).first
|
86
81
|
topic = topic_for_uri uri
|
87
82
|
|
88
83
|
return unless topic
|
89
84
|
|
90
|
-
topic.subscribers(
|
91
|
-
|
92
|
-
connection.write event_msg(topic.uri, payload)
|
93
|
-
end
|
85
|
+
topic.subscribers(excluded, included).each do |subscriber|
|
86
|
+
subscriber.write event_msg(topic.uri, payload)
|
94
87
|
end
|
95
88
|
rescue => error
|
96
89
|
# TODO Handle Error
|
data/lib/wampus/version.rb
CHANGED