evt-messaging 1.4.0.0 → 2.5.1.2

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: d4e0aa73d808a4999c6cdac274d1e598f428e839d6e43dfc162e6e29d0460dc3
4
- data.tar.gz: 8ae2506bf2c46e4c9fa266fbee2207eea81b6812f5cd6b4ec99b9b4e0fe514e5
3
+ metadata.gz: 0b88d9fc2f126343b5373d93c22046df73c920bdfba1921e1c606ee2929d8240
4
+ data.tar.gz: 46ca26755b68db2c9c4eb9427e530bfc6579857ef93a298912e4774ada3521af
5
5
  SHA512:
6
- metadata.gz: 62321d4c0015f5216d980bfc23e0508a899e136e0f98e6cd75a16051cf0f740d3ad0447b40b70d901e565dc91aa344c6d7f5a006d1b3ddbe68e42f63f0e5a73a
7
- data.tar.gz: 621abd69a36e4e05fd9f68f97f3bb824ddf115beb05df917d477b337833768a88db7915628533fab5aa12451915e336c91cd0ce89d308ec32823865db30bd0bb
6
+ metadata.gz: c753037cf3097102bbc9a7fe3a52eaa95a7cc63213caeaa8e23d7580f3a8ea616e6161e073f726289c8ee0be84a4b592719584b62b840c3fb01e956f5be63d30
7
+ data.tar.gz: 15f5370691d0868a5730de4683fbc1a1993673d0ff2a6ea49bf79f98dc104a2cb67ce5cf3df2177566b8dfde8718931d86800c68815667e6cd7b368c3e65449f
@@ -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,36 @@ 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_position.nil? && preceding_metadata.position.nil?
68
+ return false
69
+ end
70
+
71
+ if causation_message_global_position.nil? && preceding_metadata.global_position.nil?
72
+ return false
73
+ end
74
+
75
+ if causation_message_stream_name != preceding_metadata.stream_name
76
+ return false
77
+ end
78
+
79
+ if causation_message_position != preceding_metadata.position
80
+ return false
81
+ end
82
+
83
+ if causation_message_global_position != preceding_metadata.global_position
84
+ return false
85
+ end
86
+
87
+ if reply_stream_name != preceding_metadata.reply_stream_name
88
+ return false
89
+ end
90
+
91
+ true
67
92
  end
68
93
 
69
94
  def clear_reply_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
@@ -13,13 +13,21 @@ module Messaging
13
13
  end
14
14
  end
15
15
 
16
- def stream_name(id, category=nil, type: nil, types: nil)
17
- if id == nil
16
+ def stream_name(stream_id=nil, stream_category=nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil)
17
+ if stream_id.nil? && cardinal_id.nil? && id.nil? && ids.nil?
18
18
  raise Error, "ID must not be omitted from stream name"
19
19
  end
20
20
 
21
- category ||= self.category
22
- MessageStore::StreamName.stream_name(category, id, type: type, types: types)
21
+ stream_category ||= category
22
+ if stream_category.nil?
23
+ if not self.respond_to?(:category)
24
+ raise Error, "Category must not be omitted from stream name"
25
+ else
26
+ stream_category = self.category
27
+ end
28
+ end
29
+
30
+ MessageStore::StreamName.stream_name(stream_category, stream_id, cardinal_id: cardinal_id, id: id, ids: ids, type: type, types: types)
23
31
  end
24
32
 
25
33
  def category_stream_name(category=nil, type: nil, types: nil)
@@ -51,6 +59,14 @@ module Messaging
51
59
  MessageStore::StreamName.get_category(stream_name)
52
60
  end
53
61
 
62
+ def self.category?(stream_name)
63
+ MessageStore::StreamName.category?(stream_name)
64
+ end
65
+
66
+ def self.get_entity_name(stream_name)
67
+ MessageStore::StreamName.get_entity_name(stream_name)
68
+ end
69
+
54
70
  def self.get_id(stream_name)
55
71
  MessageStore::StreamName.get_id(stream_name)
56
72
  end
@@ -58,5 +74,17 @@ module Messaging
58
74
  def self.get_ids(stream_name)
59
75
  MessageStore::StreamName.get_ids(stream_name)
60
76
  end
77
+
78
+ def self.get_cardinal_id(stream_name)
79
+ MessageStore::StreamName.get_cardinal_id(stream_name)
80
+ end
81
+
82
+ def self.get_type(stream_name)
83
+ MessageStore::StreamName.get_type(stream_name)
84
+ end
85
+
86
+ def self.get_types(stream_name)
87
+ MessageStore::StreamName.get_types(stream_name)
88
+ end
61
89
  end
62
90
  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: 1.4.0.0
4
+ version: 2.5.1.2
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-11-03 00:00:00.000000000 Z
11
+ date: 2020-07-25 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