euston 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/euston.gemspec +2 -3
- data/lib/euston/event_handler.rb +4 -4
- data/lib/euston/version.rb +1 -1
- data/lib/euston.rb +0 -1
- metadata +12 -13
- data/lib/euston/idempotence.rb +0 -27
data/euston.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'euston'
|
3
|
-
s.version = '1.2.
|
4
|
-
s.date = '2011-10-
|
3
|
+
s.version = '1.2.1'
|
4
|
+
s.date = '2011-10-13'
|
5
5
|
s.platform = RUBY_PLATFORM.to_s == 'java' ? 'java' : Gem::Platform::RUBY
|
6
6
|
s.authors = ['Lee Henson', 'Guy Boertje']
|
7
7
|
s.email = ['lee.m.henson@gmail.com', 'guyboertje@gmail.com']
|
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
lib/euston/event_handler.rb
|
30
30
|
lib/euston/event_handler_private_method_names.rb
|
31
31
|
lib/euston/event_headers.rb
|
32
|
-
lib/euston/idempotence.rb
|
33
32
|
lib/euston/null_logger.rb
|
34
33
|
lib/euston/repository.rb
|
35
34
|
lib/euston/version.rb
|
data/lib/euston/event_handler.rb
CHANGED
@@ -10,13 +10,13 @@ module Euston
|
|
10
10
|
module ClassMethods
|
11
11
|
def subscribes type, version = 1, opts = nil, &consumer
|
12
12
|
if self.include? Euston::AggregateRoot
|
13
|
-
|
13
|
+
o = { :id => :id }.merge opts
|
14
14
|
|
15
15
|
self.class.send :define_method, id_from_event_method_name(type, version) do |event|
|
16
|
-
if
|
17
|
-
|
16
|
+
if o[:id].respond_to? :call
|
17
|
+
o[:id].call event
|
18
18
|
else
|
19
|
-
event[
|
19
|
+
event[o[:id]]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/euston/version.rb
CHANGED
data/lib/euston.rb
CHANGED
@@ -35,7 +35,6 @@ require 'euston/event'
|
|
35
35
|
require 'euston/event_handler_private_method_names'
|
36
36
|
require 'euston/event_handler'
|
37
37
|
require 'euston/event_headers'
|
38
|
-
require 'euston/idempotence'
|
39
38
|
require 'euston/null_logger'
|
40
39
|
require 'euston/aggregate_root'
|
41
40
|
require 'euston/repository'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: euston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
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-10-
|
13
|
+
date: 2011-10-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
17
|
-
requirement: &
|
17
|
+
requirement: &81777330 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.9
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *81777330
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &81776220 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.0.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *81776220
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: fuubar
|
39
|
-
requirement: &
|
39
|
+
requirement: &81775260 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.0.0
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *81775260
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &81774780 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 2.6.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *81774780
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: uuid
|
61
|
-
requirement: &
|
61
|
+
requirement: &81774320 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: 2.3.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *81774320
|
70
70
|
description: ''
|
71
71
|
email:
|
72
72
|
- lee.m.henson@gmail.com
|
@@ -93,7 +93,6 @@ files:
|
|
93
93
|
- lib/euston/event_handler.rb
|
94
94
|
- lib/euston/event_handler_private_method_names.rb
|
95
95
|
- lib/euston/event_headers.rb
|
96
|
-
- lib/euston/idempotence.rb
|
97
96
|
- lib/euston/null_logger.rb
|
98
97
|
- lib/euston/repository.rb
|
99
98
|
- lib/euston/version.rb
|
data/lib/euston/idempotence.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module Euston
|
2
|
-
module Idempotence
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
module InstanceMethods
|
6
|
-
def if_unhandled obj, headers
|
7
|
-
return if obj._history.include? headers.id
|
8
|
-
|
9
|
-
obj._history << headers.id
|
10
|
-
|
11
|
-
unless headers.source_message.nil? || obj._history.include?(headers.source_message[:headers][:id])
|
12
|
-
obj._history << headers.source_message[:headers][:id]
|
13
|
-
end
|
14
|
-
|
15
|
-
yield
|
16
|
-
end
|
17
|
-
|
18
|
-
def if_exists_and_unhandled document_type, id, headers
|
19
|
-
document = document_type.find id
|
20
|
-
|
21
|
-
if_unhandled document, headers do
|
22
|
-
yield document
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|