evt-messaging 2.5.6.0 → 2.5.7.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: 4ed32a3950086fa459ebb29d4343df38845f3ce1d4a559205bb5fcd6d8c42c40
4
- data.tar.gz: 6187c2a9da83c38d5f003259a1ecf59b96fcf88aaaa16ca3b5ec03723a6ff806
3
+ metadata.gz: 4a5c611f9683e1398927dd4223a8cba0f1520ff54523aef003ccd5d86a00ab0a
4
+ data.tar.gz: 1263fa3a97c59fcaabe62b4f0699fb3128117be0fd847f7df3dbd4419f6a8a0a
5
5
  SHA512:
6
- metadata.gz: 56c25adccd43baa313b05d76aa3b2e8f82977be4e898c0680ae38ba479e009d88a31caa4deb50adc59fc3ebce58dc74e46f87dee6a44f8bfd2facb3bedb0c94a
7
- data.tar.gz: 6e375228008283d4bc40f7495658223ca789afabc6c99d86805bee419c6b42dbfd06850e3ddc771a30f7c5ff46289ae2485d3e14fa2c5076a4c5cd4057434344
6
+ metadata.gz: 78f3bdccb3a7fdb31a46426223810cc9b6ef5108c4ac803ba1ba54cb2452a6e5a0bbe7e8209eaed03f8c35192bba484cd5d7983e26ff0f4544934a14eec936a0
7
+ data.tar.gz: 29ecd80c4d0a941b29d8b1081f21032ca3d82c8327c0e7fe8777555d77401e03d1e6d7f7f9bf2e63dc2ccb43415391ad1160a8b6f80965d404213922e93075ce
@@ -7,6 +7,7 @@ require 'messaging/stream_name'
7
7
 
8
8
  require 'messaging/message'
9
9
  require 'messaging/message/metadata'
10
+ require 'messaging/message/metadata/property'
10
11
  require 'messaging/message/copy'
11
12
  require 'messaging/message/follow'
12
13
  require 'messaging/message/sequence_accessor'
@@ -7,9 +7,10 @@ require 'messaging/controls/random'
7
7
  require 'messaging/controls/time'
8
8
  require 'messaging/controls/id'
9
9
  require 'messaging/controls/stream_name'
10
+ require 'messaging/controls/properties'
11
+ require 'messaging/controls/metadata'
10
12
  require 'messaging/controls/message_data'
11
13
  require 'messaging/controls/message'
12
- require 'messaging/controls/metadata'
13
14
  require 'messaging/controls/batch'
14
15
  require 'messaging/controls/write'
15
16
  require 'messaging/controls/settings'
@@ -2,6 +2,10 @@ module Messaging
2
2
  module Controls
3
3
  module Metadata
4
4
  def self.example
5
+ data = self.data
6
+
7
+ data[:properties] = Properties.example
8
+
5
9
  Messaging::Message::Metadata.build(data)
6
10
  end
7
11
 
@@ -49,16 +53,8 @@ module Messaging
49
53
  "#{causation_message_stream_name}/#{causation_message_position}"
50
54
  end
51
55
 
52
- # def self.properties
53
- # {
54
- # some_property: 'some property value'
55
- # }
56
- # end
57
-
58
56
  def self.properties
59
- [
60
- Messaging::Message::Metadata::Property.new(:some_property, 'some property value')
61
- ]
57
+ Properties.example
62
58
  end
63
59
 
64
60
  def self.time
@@ -79,7 +75,7 @@ module Messaging
79
75
 
80
76
  reply_stream_name: reply_stream_name,
81
77
 
82
- properties: properties,
78
+ properties: Properties.data,
83
79
 
84
80
  time: time,
85
81
 
@@ -0,0 +1,61 @@
1
+ module Messaging
2
+ module Controls
3
+ module Properties
4
+ def self.example
5
+ [
6
+ SomeProperty.example,
7
+ SomeTransientProperty.example
8
+ ]
9
+ end
10
+
11
+ def self.data
12
+ [
13
+ SomeProperty.data,
14
+ SomeTransientProperty.data
15
+ ]
16
+ end
17
+
18
+ module SomeProperty
19
+ def self.example
20
+ Messaging::Message::Metadata::Property.new(name, value)
21
+ end
22
+
23
+ def self.data
24
+ {
25
+ name: name,
26
+ value: value
27
+ }
28
+ end
29
+
30
+ def self.name
31
+ :some_property
32
+ end
33
+
34
+ def self.value
35
+ 'some property value'
36
+ end
37
+ end
38
+
39
+ module SomeTransientProperty
40
+ def self.example
41
+ Messaging::Message::Metadata::Property.new(name, value, true)
42
+ end
43
+
44
+ def self.data
45
+ {
46
+ name: name,
47
+ value: value
48
+ }
49
+ end
50
+
51
+ def self.name
52
+ :some_transient_property
53
+ end
54
+
55
+ def self.value
56
+ 'some transient property value'
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -93,6 +93,8 @@ module Messaging
93
93
 
94
94
  if message_or_message_data.is_a? MessageStore::MessageData::Read
95
95
  name = Messaging::Message::Info.canonize_name(message_or_message_data.type)
96
+ elsif message_or_message_data.is_a? String
97
+ name = Messaging::Message::Info.canonize_name(message_or_message_data)
96
98
  else
97
99
  name = message_or_message_data.message_name
98
100
  end
@@ -140,16 +140,6 @@ module Messaging
140
140
  end
141
141
  alias :correlates? :correlated?
142
142
 
143
- Property = Struct.new(
144
- :name,
145
- :value,
146
- :transient
147
- ) do
148
- def transient?
149
- transient == true
150
- end
151
- end
152
-
153
143
  def set_property(name, value, transient: nil)
154
144
  transient ||= false
155
145
 
@@ -0,0 +1,22 @@
1
+ module Messaging
2
+ module Message
3
+ class Metadata
4
+ Property = Struct.new(
5
+ :name,
6
+ :value,
7
+ :transient
8
+ ) do
9
+ def transient?
10
+ transient == true
11
+ end
12
+
13
+ def ==(other)
14
+ equal =
15
+ name == other.name &&
16
+ value == other.value &&
17
+ !!transient == !!other.transient
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -26,10 +26,12 @@ module Messaging
26
26
 
27
27
  metadata = message.metadata.to_h
28
28
 
29
- metadata[:properties].delete_if { |property| property.transient? }
29
+ properties = metadata[:properties]
30
30
 
31
- if metadata[:properties].empty?
31
+ if properties.empty?
32
32
  metadata.delete(:properties)
33
+ else
34
+ metadata[:properties] = Properties.write(properties)
33
35
  end
34
36
 
35
37
  metadata.delete_if { |k, v| v.nil? }
@@ -39,6 +41,20 @@ module Messaging
39
41
  message_data
40
42
  end
41
43
 
44
+ module Properties
45
+ def self.write(properties)
46
+ properties.map do |property|
47
+ property_hash = property.to_h
48
+
49
+ if not property_hash[:transient]
50
+ property_hash.delete(:transient)
51
+ end
52
+
53
+ property_hash
54
+ end
55
+ end
56
+ end
57
+
42
58
  def self.read(message_data)
43
59
  data = message_data.to_h
44
60
 
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.6.0
4
+ version: 2.5.7.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: 2021-01-04 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-message_store
@@ -67,6 +67,7 @@ files:
67
67
  - lib/messaging/controls/message.rb
68
68
  - lib/messaging/controls/message_data.rb
69
69
  - lib/messaging/controls/metadata.rb
70
+ - lib/messaging/controls/properties.rb
70
71
  - lib/messaging/controls/random.rb
71
72
  - lib/messaging/controls/settings.rb
72
73
  - lib/messaging/controls/stream_name.rb
@@ -81,6 +82,7 @@ files:
81
82
  - lib/messaging/message/follow.rb
82
83
  - lib/messaging/message/import.rb
83
84
  - lib/messaging/message/metadata.rb
85
+ - lib/messaging/message/metadata/property.rb
84
86
  - lib/messaging/message/sequence_accessor.rb
85
87
  - lib/messaging/message/transform.rb
86
88
  - lib/messaging/message_registry.rb
@@ -106,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
108
  - !ruby/object:Gem::Version
107
109
  version: '0'
108
110
  requirements: []
109
- rubygems_version: 3.1.2
111
+ rubygems_version: 3.1.4
110
112
  signing_key:
111
113
  specification_version: 4
112
114
  summary: Common primitives for platform-specific messaging implementations for Eventide