evt-message_store-postgres 2.4.3.0 → 2.4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9afe602df7bc11f064fb1f2ee2db10d297ef473b56d8d596f043731720610b89
|
4
|
+
data.tar.gz: e281822fa90831def64c49046adeb0732ed42239ff6c2797741094da8b745b15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b4471ecd79e6e7b0ebad9b2cfc5f9b71c4fd0b4e3f59e59669980c14d97748cec2a04db2257343bd8f0cc0cc8347ba481f65727005b58f370fde018ea8eeb1
|
7
|
+
data.tar.gz: 6dd9d99f28d3d5cd8cb66227d76997b0860866728902de5705b25b6737e12454c77ad930a9782a61ce2b04e2562a38be45042bd8f04d65f90a75a226f4521cf4
|
@@ -2,14 +2,14 @@ module MessageStore
|
|
2
2
|
module Postgres
|
3
3
|
module Controls
|
4
4
|
module Put
|
5
|
-
def self.call(instances: nil, stream_name: nil, message_data: nil, message: nil, category: nil)
|
5
|
+
def self.call(instances: nil, stream_name: nil, message_data: nil, message: nil, category: nil, type: nil)
|
6
6
|
instances ||= 1
|
7
7
|
stream_name ||= StreamName.example(category: category)
|
8
8
|
message_data ||= message
|
9
9
|
|
10
10
|
message_specified = !message_data.nil?
|
11
11
|
|
12
|
-
message_data ||= MessageData::Write.example
|
12
|
+
message_data ||= MessageData::Write.example(type: type)
|
13
13
|
|
14
14
|
position = nil
|
15
15
|
instances.times do
|
@@ -11,10 +11,10 @@ module MessageStore
|
|
11
11
|
Session.configure(self, session: session)
|
12
12
|
end
|
13
13
|
|
14
|
-
def call(stream_name)
|
14
|
+
def call(stream_name, type: nil)
|
15
15
|
logger.trace(tag: :get) { "Getting last message data (Stream Name: #{stream_name})" }
|
16
16
|
|
17
|
-
result = get_result(stream_name)
|
17
|
+
result = get_result(stream_name, type)
|
18
18
|
|
19
19
|
return nil if result.nil?
|
20
20
|
|
@@ -26,14 +26,11 @@ module MessageStore
|
|
26
26
|
message_data
|
27
27
|
end
|
28
28
|
|
29
|
-
def get_result(stream_name)
|
29
|
+
def get_result(stream_name, type)
|
30
30
|
logger.trace(tag: :get) { "Getting last record (Stream: #{stream_name})" }
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
parameter_values = [
|
35
|
-
stream_name
|
36
|
-
]
|
32
|
+
parameter_values = parameter_values(stream_name, type)
|
33
|
+
sql_command = sql_command(type)
|
37
34
|
|
38
35
|
result = session.execute(sql_command, parameter_values)
|
39
36
|
|
@@ -44,12 +41,38 @@ module MessageStore
|
|
44
41
|
result
|
45
42
|
end
|
46
43
|
|
47
|
-
def
|
48
|
-
parameters =
|
44
|
+
def sql_command(type)
|
45
|
+
parameters = parameters(type)
|
49
46
|
|
50
47
|
"SELECT * FROM get_last_stream_message(#{parameters});"
|
51
48
|
end
|
52
49
|
|
50
|
+
def parameters(type)
|
51
|
+
parameters = "$1::varchar"
|
52
|
+
|
53
|
+
# Backwards compatibility with versions of message-db that do not
|
54
|
+
# support the type parameter - Aaron, Scott, Tue Jul 12 2022
|
55
|
+
if not type.nil?
|
56
|
+
parameters << ", $2::varchar"
|
57
|
+
end
|
58
|
+
|
59
|
+
parameters
|
60
|
+
end
|
61
|
+
|
62
|
+
def parameter_values(stream_name, type)
|
63
|
+
parameter_values = [
|
64
|
+
stream_name
|
65
|
+
]
|
66
|
+
|
67
|
+
# Backwards compatibility with versions of message-db that do not
|
68
|
+
# support the type parameter - Aaron, Scott, Tue Jul 12 2022
|
69
|
+
if not type.nil?
|
70
|
+
parameter_values << type
|
71
|
+
end
|
72
|
+
|
73
|
+
parameter_values
|
74
|
+
end
|
75
|
+
|
53
76
|
def convert(record)
|
54
77
|
logger.trace(tag: :get) { "Converting record to message data" }
|
55
78
|
|
@@ -91,8 +91,12 @@ module MessageStore
|
|
91
91
|
alias :open? :connected?
|
92
92
|
|
93
93
|
def close
|
94
|
+
if connection.nil?
|
95
|
+
return
|
96
|
+
end
|
97
|
+
|
94
98
|
connection.close
|
95
|
-
connection = nil
|
99
|
+
self.connection = nil
|
96
100
|
end
|
97
101
|
|
98
102
|
def reset
|
@@ -108,8 +112,6 @@ module MessageStore
|
|
108
112
|
connect
|
109
113
|
end
|
110
114
|
|
111
|
-
executed_time = nil
|
112
|
-
|
113
115
|
if params.nil?
|
114
116
|
connection.exec(sql_command).tap do
|
115
117
|
self.executed_time = clock.now
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-message_store-postgres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: scripts
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-message_store
|