euston-rabbitmq 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'euston-rabbitmq'
3
- s.version = '1.2.3'
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.4.0'
57
- s.add_development_dependency 'fuubar', '~> 0.0.0'
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'
@@ -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.uniq.each do |method|
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
@@ -1,5 +1,5 @@
1
1
  module Euston
2
2
  module RabbitMq
3
- VERSION = "1.2.3"
3
+ VERSION = "1.2.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: euston-rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-12-13 00:00:00.000000000 Z
13
+ date: 2012-02-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &70300704979420 !ruby/object:Gem::Requirement
17
+ requirement: &70292547439480 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.10
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70300704979420
25
+ version_requirements: *70292547439480
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: euston
28
- requirement: &70300704978940 !ruby/object:Gem::Requirement
28
+ requirement: &70292547438640 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70300704978940
36
+ version_requirements: *70292547438640
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: euston-eventstore
39
- requirement: &70300704978480 !ruby/object:Gem::Requirement
39
+ requirement: &70292547437920 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.2.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70300704978480
47
+ version_requirements: *70292547437920
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: hash-keys
50
- requirement: &70300704978020 !ruby/object:Gem::Requirement
50
+ requirement: &70292547437100 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.0.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70300704978020
58
+ version_requirements: *70292547437100
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: hollywood
61
- requirement: &70300704977560 !ruby/object:Gem::Requirement
61
+ requirement: &70292547436040 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70300704977560
69
+ version_requirements: *70292547436040
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: i18n
72
- requirement: &70300704977100 !ruby/object:Gem::Requirement
72
+ requirement: &70292547435240 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.5.0
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70300704977100
80
+ version_requirements: *70292547435240
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: safely
83
- requirement: &70300704976620 !ruby/object:Gem::Requirement
83
+ requirement: &70292547434380 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,32 +88,32 @@ dependencies:
88
88
  version: 0.3.0
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *70300704976620
91
+ version_requirements: *70292547434380
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: awesome_print
94
- requirement: &70300704976160 !ruby/object:Gem::Requirement
94
+ requirement: &70292547433880 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
98
98
  - !ruby/object:Gem::Version
99
- version: 0.4.0
99
+ version: 1.0.2
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70300704976160
102
+ version_requirements: *70292547433880
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: fuubar
105
- requirement: &70300704975700 !ruby/object:Gem::Requirement
105
+ requirement: &70292547433360 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 0.0.0
110
+ version: 1.0.0
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70300704975700
113
+ version_requirements: *70292547433360
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: rabbitmqadmin-cli
116
- requirement: &70300704975240 !ruby/object:Gem::Requirement
116
+ requirement: &70292547432780 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ~>
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 1.0.0
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70300704975240
124
+ version_requirements: *70292547432780
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
- requirement: &70300704974780 !ruby/object:Gem::Requirement
127
+ requirement: &70292547432220 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ~>
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: 0.9.2
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70300704974780
135
+ version_requirements: *70292547432220
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec
138
- requirement: &70300704974320 !ruby/object:Gem::Requirement
138
+ requirement: &70292547431520 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ~>
@@ -143,7 +143,7 @@ dependencies:
143
143
  version: 2.6.0
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *70300704974320
146
+ version_requirements: *70292547431520
147
147
  description: JRuby RabbitMq bindings
148
148
  email:
149
149
  - lee.m.henson@gmail.com
@@ -159,6 +159,7 @@ files:
159
159
  - lib/euston-rabbitmq/euston/command_handler_binder.rb
160
160
  - lib/euston-rabbitmq/euston/errors.rb
161
161
  - lib/euston-rabbitmq/euston/event_handler_binder.rb
162
+ - lib/euston-rabbitmq/euston/event_handler_queue_declarer.rb
162
163
  - lib/euston-rabbitmq/euston/exchanges.rb
163
164
  - lib/euston-rabbitmq/euston/handler_binder.rb
164
165
  - lib/euston-rabbitmq/euston/queues.rb
@@ -192,15 +193,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
193
  - - ! '>='
193
194
  - !ruby/object:Gem::Version
194
195
  version: '0'
196
+ segments:
197
+ - 0
198
+ hash: -1997316586014769473
195
199
  required_rubygems_version: !ruby/object:Gem::Requirement
196
200
  none: false
197
201
  requirements:
198
202
  - - ! '>='
199
203
  - !ruby/object:Gem::Version
200
204
  version: '0'
205
+ segments:
206
+ - 0
207
+ hash: -1997316586014769473
201
208
  requirements: []
202
209
  rubyforge_project:
203
- rubygems_version: 1.8.10
210
+ rubygems_version: 1.8.17
204
211
  signing_key:
205
212
  specification_version: 3
206
213
  summary: RabbitMq bindings for Euston.