euston-rabbitmq 1.2.3-java → 1.2.4-java
Sign up to get free protection for your applications and to get access to all the features.
- data/euston-rabbitmq.gemspec +4 -3
- data/lib/euston-rabbitmq.rb +1 -0
- data/lib/euston-rabbitmq/euston/event_handler_binder.rb +10 -7
- data/lib/euston-rabbitmq/euston/event_handler_queue_declarer.rb +25 -0
- data/lib/euston-rabbitmq/reflection/handler_reference.rb +3 -1
- data/lib/euston-rabbitmq/version.rb +1 -1
- metadata +38 -31
data/euston-rabbitmq.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'euston-rabbitmq'
|
3
|
-
s.version = '1.2.
|
3
|
+
s.version = '1.2.4'
|
4
4
|
s.platform = RUBY_PLATFORM.to_s == 'java' ? 'java' : Gem::Platform::RUBY
|
5
5
|
s.authors = ['Lee Henson', 'Guy Boertje']
|
6
6
|
s.email = ['lee.m.henson@gmail.com', 'guyboertje@gmail.com']
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
lib/euston-rabbitmq/euston/command_handler_binder.rb
|
18
18
|
lib/euston-rabbitmq/euston/errors.rb
|
19
19
|
lib/euston-rabbitmq/euston/event_handler_binder.rb
|
20
|
+
lib/euston-rabbitmq/euston/event_handler_queue_declarer.rb
|
20
21
|
lib/euston-rabbitmq/euston/exchanges.rb
|
21
22
|
lib/euston-rabbitmq/euston/handler_binder.rb
|
22
23
|
lib/euston-rabbitmq/euston/queues.rb
|
@@ -53,8 +54,8 @@ Gem::Specification.new do |s|
|
|
53
54
|
s.add_dependency 'hot_bunnies', '~> 1.3.0' if RUBY_PLATFORM.to_s == 'java'
|
54
55
|
s.add_dependency 'safely', '~> 0.3.0'
|
55
56
|
|
56
|
-
s.add_development_dependency 'awesome_print', '~> 0.
|
57
|
-
s.add_development_dependency 'fuubar', '~>
|
57
|
+
s.add_development_dependency 'awesome_print', '~> 1.0.2'
|
58
|
+
s.add_development_dependency 'fuubar', '~> 1.0.0'
|
58
59
|
s.add_development_dependency 'rabbitmqadmin-cli', '~> 1.0.0'
|
59
60
|
s.add_development_dependency 'rake', '~> 0.9.2'
|
60
61
|
s.add_development_dependency 'rspec', '~> 2.6.0'
|
data/lib/euston-rabbitmq.rb
CHANGED
@@ -23,4 +23,5 @@ require 'euston-rabbitmq/euston/queues'
|
|
23
23
|
require 'euston-rabbitmq/euston/handler_binder'
|
24
24
|
require 'euston-rabbitmq/euston/command_handler_binder'
|
25
25
|
require 'euston-rabbitmq/euston/event_handler_binder'
|
26
|
+
require 'euston-rabbitmq/euston/event_handler_queue_declarer'
|
26
27
|
require 'euston-rabbitmq/euston/retrying_subscription'
|
@@ -4,22 +4,25 @@ module Euston
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def ensure_bindings_exist_for_reference reference
|
7
|
-
queue_name = reference.name.to_s.underscore
|
8
|
-
|
9
|
-
@log.debug "Ensuring event handler queue exists: #{queue_name}"
|
10
|
-
|
11
|
-
queue = get_queue @channel, queue_name
|
12
|
-
|
13
7
|
prefix = '__event_handler__'
|
14
8
|
|
15
9
|
methods = reference.handler.public_instance_methods(false)
|
16
10
|
methods = methods.select { |method| method.to_s.start_with? prefix }
|
17
11
|
methods = methods.map { |method| method.to_s[prefix.length, method.to_s.length - prefix.length] }
|
18
12
|
methods = methods.map { |method| method.split('__').first }
|
13
|
+
methods.uniq!
|
19
14
|
|
20
15
|
exchange = get_exchange @channel, :events
|
21
16
|
|
22
|
-
methods.
|
17
|
+
return if methods.empty?
|
18
|
+
|
19
|
+
queue_name = reference.queue_name
|
20
|
+
|
21
|
+
@log.debug "Ensuring event handler queue exists: #{queue_name}"
|
22
|
+
|
23
|
+
queue = get_queue @channel, queue_name
|
24
|
+
|
25
|
+
methods.each do |method|
|
23
26
|
routing_key = "events.#{method}"
|
24
27
|
|
25
28
|
@log.debug "Ensuring routing key exists for queue #{queue_name}: #{routing_key}"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Euston
|
2
|
+
module RabbitMq
|
3
|
+
module EventHandlerQueueDeclarer
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def event_queue name
|
8
|
+
@event_queue_name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def event_queue_name
|
12
|
+
@event_queue_name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module AggregateRoot
|
19
|
+
include Euston::RabbitMq::EventHandlerQueueDeclarer
|
20
|
+
end
|
21
|
+
|
22
|
+
module EventHandler
|
23
|
+
include Euston::RabbitMq::EventHandlerQueueDeclarer
|
24
|
+
end
|
25
|
+
end
|
@@ -3,9 +3,11 @@ module Euston
|
|
3
3
|
class HandlerReference
|
4
4
|
def initialize namespace, handler, name
|
5
5
|
@namespace, @handler, @name = namespace, handler, name
|
6
|
+
@queue_name = handler.event_queue_name if handler.respond_to? :event_queue_name
|
7
|
+
@queue_name = handler.to_s.split('::').pop.underscore if @queue_name.nil?
|
6
8
|
end
|
7
9
|
|
8
|
-
attr_reader :namespace, :handler, :name
|
10
|
+
attr_reader :namespace, :handler, :name, :queue_name
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: euston-rabbitmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.4
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Lee Henson
|
@@ -10,149 +10,149 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-02-29 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
version_requirements: &
|
17
|
+
version_requirements: &4056 !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.0.10
|
22
22
|
none: false
|
23
|
-
requirement: *
|
23
|
+
requirement: *4056
|
24
24
|
prerelease: false
|
25
25
|
type: :runtime
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: euston
|
28
|
-
version_requirements: &
|
28
|
+
version_requirements: &4074 !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.2.0
|
33
33
|
none: false
|
34
|
-
requirement: *
|
34
|
+
requirement: *4074
|
35
35
|
prerelease: false
|
36
36
|
type: :runtime
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: euston-eventstore
|
39
|
-
version_requirements: &
|
39
|
+
version_requirements: &4090 !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.2.0
|
44
44
|
none: false
|
45
|
-
requirement: *
|
45
|
+
requirement: *4090
|
46
46
|
prerelease: false
|
47
47
|
type: :runtime
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: hash-keys
|
50
|
-
version_requirements: &
|
50
|
+
version_requirements: &4106 !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
55
|
none: false
|
56
|
-
requirement: *
|
56
|
+
requirement: *4106
|
57
57
|
prerelease: false
|
58
58
|
type: :runtime
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: hollywood
|
61
|
-
version_requirements: &
|
61
|
+
version_requirements: &4122 !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: 1.0.0
|
66
66
|
none: false
|
67
|
-
requirement: *
|
67
|
+
requirement: *4122
|
68
68
|
prerelease: false
|
69
69
|
type: :runtime
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: i18n
|
72
|
-
version_requirements: &
|
72
|
+
version_requirements: &4138 !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 0.5.0
|
77
77
|
none: false
|
78
|
-
requirement: *
|
78
|
+
requirement: *4138
|
79
79
|
prerelease: false
|
80
80
|
type: :runtime
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: hot_bunnies
|
83
|
-
version_requirements: &
|
83
|
+
version_requirements: &4154 !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: 1.3.0
|
88
88
|
none: false
|
89
|
-
requirement: *
|
89
|
+
requirement: *4154
|
90
90
|
prerelease: false
|
91
91
|
type: :runtime
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: safely
|
94
|
-
version_requirements: &
|
94
|
+
version_requirements: &4170 !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: 0.3.0
|
99
99
|
none: false
|
100
|
-
requirement: *
|
100
|
+
requirement: *4170
|
101
101
|
prerelease: false
|
102
102
|
type: :runtime
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: awesome_print
|
105
|
-
version_requirements: &
|
105
|
+
version_requirements: &4186 !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 1.0.2
|
110
110
|
none: false
|
111
|
-
requirement: *
|
111
|
+
requirement: *4186
|
112
112
|
prerelease: false
|
113
113
|
type: :development
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: fuubar
|
116
|
-
version_requirements: &
|
116
|
+
version_requirements: &4204 !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
120
|
+
version: 1.0.0
|
121
121
|
none: false
|
122
|
-
requirement: *
|
122
|
+
requirement: *4204
|
123
123
|
prerelease: false
|
124
124
|
type: :development
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rabbitmqadmin-cli
|
127
|
-
version_requirements: &
|
127
|
+
version_requirements: &4220 !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 1.0.0
|
132
132
|
none: false
|
133
|
-
requirement: *
|
133
|
+
requirement: *4220
|
134
134
|
prerelease: false
|
135
135
|
type: :development
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: rake
|
138
|
-
version_requirements: &
|
138
|
+
version_requirements: &4236 !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: 0.9.2
|
143
143
|
none: false
|
144
|
-
requirement: *
|
144
|
+
requirement: *4236
|
145
145
|
prerelease: false
|
146
146
|
type: :development
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: rspec
|
149
|
-
version_requirements: &
|
149
|
+
version_requirements: &4252 !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - ~>
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: 2.6.0
|
154
154
|
none: false
|
155
|
-
requirement: *
|
155
|
+
requirement: *4252
|
156
156
|
prerelease: false
|
157
157
|
type: :development
|
158
158
|
description: JRuby RabbitMq bindings
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/euston-rabbitmq/euston/command_handler_binder.rb
|
171
171
|
- lib/euston-rabbitmq/euston/errors.rb
|
172
172
|
- lib/euston-rabbitmq/euston/event_handler_binder.rb
|
173
|
+
- lib/euston-rabbitmq/euston/event_handler_queue_declarer.rb
|
173
174
|
- lib/euston-rabbitmq/euston/exchanges.rb
|
174
175
|
- lib/euston-rabbitmq/euston/handler_binder.rb
|
175
176
|
- lib/euston-rabbitmq/euston/queues.rb
|
@@ -201,17 +202,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
202
|
requirements:
|
202
203
|
- - ! '>='
|
203
204
|
- !ruby/object:Gem::Version
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
hash: 2
|
204
208
|
version: '0'
|
205
209
|
none: false
|
206
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
211
|
requirements:
|
208
212
|
- - ! '>='
|
209
213
|
- !ruby/object:Gem::Version
|
214
|
+
segments:
|
215
|
+
- 0
|
216
|
+
hash: 2
|
210
217
|
version: '0'
|
211
218
|
none: false
|
212
219
|
requirements: []
|
213
220
|
rubyforge_project:
|
214
|
-
rubygems_version: 1.8.
|
221
|
+
rubygems_version: 1.8.15
|
215
222
|
signing_key:
|
216
223
|
specification_version: 3
|
217
224
|
summary: RabbitMq bindings for Euston.
|