evt-messaging 2.5.0.0 → 2.5.2.0

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: dfa84e5e49bc05354a719fbef76a8f88c314ab7ad21865ec808f152b13306299
4
- data.tar.gz: 6c8235883fbbb8da61a89444ea6526110dca1d5efbdb3c1cca34cd638b96bf0d
3
+ metadata.gz: 89ca33e5b0fa877f3ef134f979c220da8ef94caa5fa7b9fe4cb761773ff4ba01
4
+ data.tar.gz: 16504c4203a82f7bef3fd5901d3926bd3d33adbfc569c2925b97d32f18b5a8a9
5
5
  SHA512:
6
- metadata.gz: dc15ac017bb788605373ee661243aef54790e10333c81cab3bf98a7df8a6c222d13dfa5a55cc4df42e87031b47ed6a5e5f8e3c457721b55a2ced8cffa364d950
7
- data.tar.gz: 36469f93f6a716018d27a8527135414c6ac8042b66d9a2012636beeff12fb72c6f58caccda6bb8c59aad26234756557ba1f70aafa0ddbb72cd486424d7da25a4
6
+ metadata.gz: 151352d092b0fad0c1f06c495d0e5a32ab46a6c4ae927f859b520f6ed1c4e1697ee2b0b4fe34ccc86967c1ad4cdb13a3ec9391879fce82755f37e843f144365a
7
+ data.tar.gz: 01c1ac37c1f4cf65e3fc6836f90245927e3257595203ca3b5016f43e5bb4745ae817248cd5c926fc790fb13f0e78b25d11f84d4c30a8af275646600ef2a2b4ac
@@ -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_attributes
130
+ [
131
+ :stream_name,
132
+ :position,
133
+ :global_position
134
+ ]
135
+ end
136
+
137
+ def self.causation_attributes
138
+ [
139
+ :causation_message_stream_name,
140
+ :causation_message_position,
141
+ :causation_message_global_position
142
+ ]
143
+ end
144
+
145
+ def self.origin_attributes
146
+ [
147
+ :correlation_stream_name,
148
+ :reply_stream_name
149
+ ]
150
+ end
151
+
152
+ def self.workflow_attributes
153
+ causation_attributes + origin_attributes
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.0
4
+ version: 2.5.2.0
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: 2019-12-10 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
@@ -44,7 +44,6 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - lib/loader.rb
48
47
  - lib/messaging.rb
49
48
  - lib/messaging/category.rb
50
49
  - lib/messaging/controls.rb
@@ -92,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
94
93
  requirements: []
95
- rubygems_version: 3.0.1
94
+ rubygems_version: 3.1.2
96
95
  signing_key:
97
96
  specification_version: 4
98
97
  summary: Common primitives for platform-specific messaging implementations for Eventide
@@ -1 +0,0 @@
1
- lib/messaging.rb