rabbit_feed 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbd44e51378b933adbf33ef5b981628cc4f0471e
|
4
|
+
data.tar.gz: 120f6141be92381289476244240d70e8f641bda3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97b69fe484666ba92d018ef8a8f63e9821cc221134568833404dec7f4bef18ee2a70bf5dd71dbfe13c10f2aadfc4f2d3b8f350b7a127d9a4736534bd1b9e432
|
7
|
+
data.tar.gz: 98b830cf47fba91cbb18c537edd6a46310f9c73687072fccc39f30749a5cb5173aad9b5cabaca984c9b75d538d79375187db5c6386ab8d455fbf97d33218818e
|
data/Gemfile.lock
CHANGED
@@ -56,10 +56,13 @@ module RabbitFeed
|
|
56
56
|
|
57
57
|
def handle_event event
|
58
58
|
event_rule = events[event.name]
|
59
|
-
raise RoutingError.new "No routing defined for application with name: #{event.application} for events named: #{event.name}" unless event_rule.present?
|
60
59
|
event_rule.handle_event event
|
61
60
|
end
|
62
61
|
|
62
|
+
def handles_event? event
|
63
|
+
events.has_key? event.name
|
64
|
+
end
|
65
|
+
|
63
66
|
def validate!
|
64
67
|
raise ConfigurationError.new "Bad application specification for #{name}: #{errors.messages}" if invalid?
|
65
68
|
end
|
@@ -86,8 +89,8 @@ module RabbitFeed
|
|
86
89
|
end
|
87
90
|
|
88
91
|
def handle_event event
|
89
|
-
application = find_application event
|
90
|
-
raise RoutingError.new "No routing defined for application with name: #{event.application}" unless application.present?
|
92
|
+
application = find_application event
|
93
|
+
raise RoutingError.new "No routing defined for application with name: #{event.application} for events named: #{event.name}" unless application.present?
|
91
94
|
application.handle_event event
|
92
95
|
end
|
93
96
|
|
@@ -107,8 +110,11 @@ module RabbitFeed
|
|
107
110
|
@catch_all_application = application
|
108
111
|
end
|
109
112
|
|
110
|
-
def find_application
|
111
|
-
named_applications[
|
113
|
+
def find_application event
|
114
|
+
candidate_applications = [named_applications[event.application], catch_all_application].compact
|
115
|
+
candidate_applications.detect do |application|
|
116
|
+
application.handles_event? event
|
117
|
+
end
|
112
118
|
end
|
113
119
|
end
|
114
120
|
end
|
data/lib/rabbit_feed/version.rb
CHANGED
@@ -43,6 +43,7 @@ module RabbitFeed
|
|
43
43
|
events = [
|
44
44
|
double(:event, application: 'dummy_1', name: 'event_1', payload: 1),
|
45
45
|
double(:event, application: 'dummy_1', name: 'event_2', payload: 2),
|
46
|
+
double(:event, application: 'dummy_1', name: 'event_4', payload: 4),
|
46
47
|
double(:event, application: 'dummy_2', name: 'event_3', payload: 3),
|
47
48
|
double(:event, application: 'none', name: 'event_4', payload: 4),
|
48
49
|
]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbit_feed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simply Business
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|