evt-messaging 2.5.0.1 → 2.5.2.1

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
  SHA256:
3
- metadata.gz: 341952091df0e61512d3852e7bde750a6f9020a125dd9294fbb64e33b76bec5d
4
- data.tar.gz: '08df197a8b66f8052a81dddbef4dc686c017c81ec64eb2dcde150f6a64dbb3f3'
3
+ metadata.gz: f7c04e0dec5f4a44a412b02aaa7f4e7c5c1051edd647f521b55d703e525eb752
4
+ data.tar.gz: b179e04fe469d034f8316e669a96d5e763280c79fdc623fd698bae6f68a61b65
5
5
  SHA512:
6
- metadata.gz: 72f42033764a885a25591c1248e313b91825e783498aa6d6d34dfd92cbc2b6bdd1ad410df7d1d81966bac889ec99c2e8d61e1b78ef8026efef2b94c4654cdc67
7
- data.tar.gz: '09dc5f5bfbe574fcadc445511eae2a1bab2f0a936423ecb703c55d60451bbc93af3e6d73c72c0333fd378f80149dd872eac2a125df098dee1ae69b25d0686eda'
6
+ metadata.gz: 1bff39401cf18dfea165571dd3780ced69d6747365629331cfb55e82c0227cd41766706909e1cff24b2292d709b0ff03146b3c7034598f28eec0914a3ade22a6
7
+ data.tar.gz: faf8f7669aaba89923a1baa321fe8a0f24f92191cb0d41ecc35830c68d676d9a923845f9ea3fe4193937de28b3947835983655637b8b7bb58fc786c04852dd4b
@@ -13,6 +13,10 @@ module Messaging
13
13
  1
14
14
  end
15
15
 
16
+ def self.global_position
17
+ 222
18
+ end
19
+
16
20
  def self.causation_message_stream_name
17
21
  "someCausation"
18
22
  end
@@ -22,7 +26,7 @@ module Messaging
22
26
  end
23
27
 
24
28
  def self.causation_message_global_position
25
- 222
29
+ 111
26
30
  end
27
31
 
28
32
  def self.correlation_stream_name
@@ -45,10 +49,6 @@ module Messaging
45
49
  "#{causation_message_stream_name}/#{causation_message_position}"
46
50
  end
47
51
 
48
- def self.global_position
49
- 111
50
- end
51
-
52
52
  def self.time
53
53
  Time::Raw.example
54
54
  end
@@ -7,7 +7,10 @@ module Messaging
7
7
  include Dependency
8
8
  include Virtual
9
9
 
10
- dependency :handler_logger, ::Log
10
+ def handler_logger
11
+ @handler_logger ||= Log.get(self)
12
+ end
13
+ attr_writer :handler_logger
11
14
 
12
15
  extend Build
13
16
  extend Call
@@ -25,7 +28,6 @@ module Messaging
25
28
  def build(strict: nil, session: nil)
26
29
  instance = new
27
30
  instance.strict = strict
28
- Log.configure(instance, attr_name: :handler_logger)
29
31
 
30
32
  if Build.configure_session?(instance)
31
33
  instance.configure(session: session)
@@ -48,12 +50,12 @@ module Messaging
48
50
  return true if parameter_type == :key
49
51
 
50
52
  error_message = "Optional session parameter of configure is not a keyword argument (Type: #{parameter_type.inspect})"
51
- logger.error(tag: :handle) { error_message }
53
+ handler_logger.error(tag: :handle) { error_message }
52
54
  raise ArgumentError, error_message
53
55
  end
54
56
 
55
- def self.logger
56
- @logger ||= Log.build(self)
57
+ def self.handler_logger
58
+ @handler_logger ||= Log.get(self)
57
59
  end
58
60
  end
59
61
 
@@ -59,11 +59,48 @@ module Messaging
59
59
  self.reply_stream_name = preceding_metadata.reply_stream_name
60
60
  end
61
61
 
62
- def follows?(metadata)
63
- causation_message_stream_name == metadata.stream_name &&
64
- causation_message_position == metadata.position &&
65
- causation_message_global_position == metadata.global_position &&
66
- reply_stream_name == metadata.reply_stream_name
62
+ def follows?(preceding_metadata)
63
+ if causation_message_stream_name.nil? && preceding_metadata.stream_name.nil?
64
+ return false
65
+ end
66
+
67
+ if causation_message_stream_name != preceding_metadata.stream_name
68
+ return false
69
+ end
70
+
71
+
72
+ if causation_message_position.nil? && preceding_metadata.position.nil?
73
+ return false
74
+ end
75
+
76
+ if causation_message_position != preceding_metadata.position
77
+ return false
78
+ end
79
+
80
+
81
+ if causation_message_global_position.nil? && preceding_metadata.global_position.nil?
82
+ return false
83
+ end
84
+
85
+ if causation_message_global_position != preceding_metadata.global_position
86
+ return false
87
+ end
88
+
89
+
90
+ if not preceding_metadata.correlation_stream_name.nil?
91
+ if correlation_stream_name != preceding_metadata.correlation_stream_name
92
+ return false
93
+ end
94
+ end
95
+
96
+
97
+ if not preceding_metadata.reply_stream_name.nil?
98
+ if reply_stream_name != preceding_metadata.reply_stream_name
99
+ return false
100
+ end
101
+ end
102
+
103
+ true
67
104
  end
68
105
 
69
106
  def clear_reply_stream_name
@@ -89,6 +126,33 @@ module Messaging
89
126
  end
90
127
  alias :correlates? :correlated?
91
128
 
129
+ def self.source_attribute_names
130
+ [
131
+ :stream_name,
132
+ :position,
133
+ :global_position
134
+ ]
135
+ end
136
+
137
+ def self.causation_attribute_names
138
+ [
139
+ :causation_message_stream_name,
140
+ :causation_message_position,
141
+ :causation_message_global_position
142
+ ]
143
+ end
144
+
145
+ def self.origin_attribute_names
146
+ [
147
+ :correlation_stream_name,
148
+ :reply_stream_name
149
+ ]
150
+ end
151
+
152
+ def self.workflow_attribute_names
153
+ causation_attribute_names + origin_attribute_names
154
+ end
155
+
92
156
  def self.transient_attributes
93
157
  [
94
158
  :stream_name,
@@ -4,12 +4,18 @@ module Messaging
4
4
 
5
5
  include Log::Dependency
6
6
 
7
- def entries
8
- @entries ||= []
7
+ def message_classes
8
+ @message_classes ||= []
9
+ end
10
+
11
+ def message_types
12
+ message_classes.map do |message_class|
13
+ message_class.message_type
14
+ end
9
15
  end
10
16
 
11
17
  def get(message_name)
12
- entries.find do |message_class|
18
+ message_classes.find do |message_class|
13
19
  message_class.message_name == message_name
14
20
  end
15
21
  end
@@ -22,19 +28,19 @@ module Messaging
22
28
  raise Error, error_msg
23
29
  end
24
30
 
25
- entries << message_class
31
+ message_classes << message_class
26
32
 
27
33
  logger.debug { "Registered #{message_class}"}
28
34
 
29
- entries
35
+ message_classes
30
36
  end
31
37
 
32
38
  def registered?(message_class)
33
- entries.include?(message_class)
39
+ message_classes.include?(message_class)
34
40
  end
35
41
 
36
42
  def length
37
- entries.length
43
+ message_classes.length
38
44
  end
39
45
  end
40
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0.1
4
+ version: 2.5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2020-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-message_store
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.0.1
94
+ rubygems_version: 3.1.2
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Common primitives for platform-specific messaging implementations for Eventide