cyclone_lariat 0.3.2 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -0
- data/Dockerfile +10 -0
- data/Gemfile.lock +40 -76
- data/README.md +1 -0
- data/Rakefile +6 -2
- data/bin/docker/diff +3 -0
- data/bin/docker/init +38 -0
- data/bin/docker/privatekey +17 -0
- data/bin/docker/rm +5 -0
- data/config/db.example.rb +4 -4
- data/cyclone_lariat.gemspec +2 -3
- data/docker-compose.yml +24 -0
- data/lib/cyclone_lariat/abstract/message.rb +2 -3
- data/lib/cyclone_lariat/messages_mapper.rb +46 -0
- data/lib/cyclone_lariat/messages_repo.rb +9 -30
- data/lib/cyclone_lariat/middleware.rb +1 -1
- data/lib/cyclone_lariat/version.rb +1 -1
- data/lib/cyclone_lariat.rb +1 -0
- metadata +12 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fcb758ada2c6be765e0ff3c5fc3475d88035797a5c36c79b02e7dd284a91da5
|
4
|
+
data.tar.gz: 4c9a529a78f69cce1b66d173aeba69e2718fa45993f1cdc1ccd76cffb1458d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b8a779be033da93f19b757934de2f9637c5f1dba3c97e300c20750e41000fee5d254d38973f934080176ba238636d2cd2d7c01c3ca5d8bbced1a68e352e882e
|
7
|
+
data.tar.gz: 787adf37f5ade39c034346c7dc84a1041f8b75404b15df7ba8cd3d5c5c926e62c580b45d1bf49e43a5681550dc299a592957a5c4ac30aac7cad76d04cdc32dc7
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.6
|
1
|
+
ruby-2.4.6
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.3.6] - 2022-02-09
|
8
|
+
Changed
|
9
|
+
- Downgrade minimum ruby version to 2.4.0
|
10
|
+
|
11
|
+
## [0.3.3] - 2021-07-14
|
12
|
+
Changed
|
13
|
+
- Bugfix of message equality check
|
14
|
+
|
7
15
|
## [0.3.2] - 2021-06-11
|
8
16
|
Changed
|
9
17
|
- Bugfix
|
data/Dockerfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
FROM ruby:2.6.5-buster
|
2
|
+
RUN apt-get update \
|
3
|
+
&& apt-get install -y --no-install-recommends \
|
4
|
+
postgresql-client
|
5
|
+
WORKDIR /gem
|
6
|
+
COPY lib/cyclone_lariat/version.rb ./lib/cyclone_lariat/version.rb
|
7
|
+
COPY cyclone_lariat.gemspec ./
|
8
|
+
COPY Gemfile* ./
|
9
|
+
RUN bundle install --jobs 20 --retry 5
|
10
|
+
CMD ["rake"]
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cyclone_lariat (0.3.
|
4
|
+
cyclone_lariat (0.3.6)
|
5
5
|
aws-sdk-sns
|
6
6
|
aws-sdk-sqs
|
7
7
|
luna_park (~> 0.11)
|
@@ -9,75 +9,40 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
12
|
+
addressable (2.8.0)
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
ast (2.4.2)
|
15
|
-
aws-eventstream (1.
|
16
|
-
aws-partitions (1.
|
17
|
-
aws-sdk-core (3.
|
15
|
+
aws-eventstream (1.2.0)
|
16
|
+
aws-partitions (1.553.0)
|
17
|
+
aws-sdk-core (3.126.0)
|
18
18
|
aws-eventstream (~> 1, >= 1.0.2)
|
19
|
-
aws-partitions (~> 1, >= 1.
|
19
|
+
aws-partitions (~> 1, >= 1.525.0)
|
20
20
|
aws-sigv4 (~> 1.1)
|
21
21
|
jmespath (~> 1.0)
|
22
|
-
aws-sdk-sns (1.
|
23
|
-
aws-sdk-core (~> 3, >= 3.
|
22
|
+
aws-sdk-sns (1.51.0)
|
23
|
+
aws-sdk-core (~> 3, >= 3.126.0)
|
24
24
|
aws-sigv4 (~> 1.1)
|
25
|
-
aws-sdk-sqs (1.
|
26
|
-
aws-sdk-core (~> 3, >= 3.
|
25
|
+
aws-sdk-sqs (1.50.0)
|
26
|
+
aws-sdk-core (~> 3, >= 3.126.0)
|
27
27
|
aws-sigv4 (~> 1.1)
|
28
|
-
aws-sigv4 (1.
|
28
|
+
aws-sigv4 (1.4.0)
|
29
29
|
aws-eventstream (~> 1, >= 1.0.2)
|
30
30
|
byebug (11.1.3)
|
31
31
|
coderay (1.1.3)
|
32
|
-
concurrent-ruby (1.1.8)
|
33
32
|
crack (0.4.5)
|
34
33
|
rexml
|
35
34
|
database_cleaner-core (2.0.1)
|
36
35
|
database_cleaner-sequel (2.0.0)
|
37
36
|
database_cleaner-core (~> 2.0.0)
|
38
37
|
sequel
|
39
|
-
diff-lcs (1.
|
40
|
-
docile (1.
|
41
|
-
dry-configurable (0.12.1)
|
42
|
-
concurrent-ruby (~> 1.0)
|
43
|
-
dry-core (~> 0.5, >= 0.5.0)
|
44
|
-
dry-container (0.7.2)
|
45
|
-
concurrent-ruby (~> 1.0)
|
46
|
-
dry-configurable (~> 0.1, >= 0.1.3)
|
47
|
-
dry-core (0.5.0)
|
48
|
-
concurrent-ruby (~> 1.0)
|
49
|
-
dry-equalizer (0.3.0)
|
50
|
-
dry-inflector (0.2.0)
|
51
|
-
dry-initializer (3.0.4)
|
52
|
-
dry-logic (1.2.0)
|
53
|
-
concurrent-ruby (~> 1.0)
|
54
|
-
dry-core (~> 0.5, >= 0.5)
|
55
|
-
dry-schema (1.6.2)
|
56
|
-
concurrent-ruby (~> 1.0)
|
57
|
-
dry-configurable (~> 0.8, >= 0.8.3)
|
58
|
-
dry-core (~> 0.5, >= 0.5)
|
59
|
-
dry-initializer (~> 3.0)
|
60
|
-
dry-logic (~> 1.0)
|
61
|
-
dry-types (~> 1.5)
|
62
|
-
dry-types (1.5.1)
|
63
|
-
concurrent-ruby (~> 1.0)
|
64
|
-
dry-container (~> 0.3)
|
65
|
-
dry-core (~> 0.5, >= 0.5)
|
66
|
-
dry-inflector (~> 0.1, >= 0.1.2)
|
67
|
-
dry-logic (~> 1.0, >= 1.0.2)
|
68
|
-
dry-validation (1.6.0)
|
69
|
-
concurrent-ruby (~> 1.0)
|
70
|
-
dry-container (~> 0.7, >= 0.7.1)
|
71
|
-
dry-core (~> 0.4)
|
72
|
-
dry-equalizer (~> 0.2)
|
73
|
-
dry-initializer (~> 3.0)
|
74
|
-
dry-schema (~> 1.5, >= 1.5.2)
|
38
|
+
diff-lcs (1.5.0)
|
39
|
+
docile (1.3.5)
|
75
40
|
hashdiff (1.0.1)
|
76
|
-
jmespath (1.
|
41
|
+
jmespath (1.5.0)
|
77
42
|
luna_park (0.11.1)
|
78
43
|
method_source (1.0.0)
|
79
44
|
parallel (1.20.1)
|
80
|
-
parser (3.0.
|
45
|
+
parser (3.1.0.0)
|
81
46
|
ast (~> 2.4.1)
|
82
47
|
pg (1.2.3)
|
83
48
|
pry (0.13.1)
|
@@ -87,23 +52,23 @@ GEM
|
|
87
52
|
byebug (~> 11.0)
|
88
53
|
pry (~> 0.13.0)
|
89
54
|
public_suffix (4.0.6)
|
90
|
-
rainbow (3.
|
91
|
-
rake (13.0.
|
92
|
-
regexp_parser (2.
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rake (13.0.6)
|
57
|
+
regexp_parser (2.2.0)
|
93
58
|
rexml (3.2.5)
|
94
|
-
rspec (3.
|
95
|
-
rspec-core (~> 3.
|
96
|
-
rspec-expectations (~> 3.
|
97
|
-
rspec-mocks (~> 3.
|
98
|
-
rspec-core (3.
|
99
|
-
rspec-support (~> 3.
|
100
|
-
rspec-expectations (3.
|
59
|
+
rspec (3.11.0)
|
60
|
+
rspec-core (~> 3.11.0)
|
61
|
+
rspec-expectations (~> 3.11.0)
|
62
|
+
rspec-mocks (~> 3.11.0)
|
63
|
+
rspec-core (3.11.0)
|
64
|
+
rspec-support (~> 3.11.0)
|
65
|
+
rspec-expectations (3.11.0)
|
101
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
-
rspec-support (~> 3.
|
103
|
-
rspec-mocks (3.
|
67
|
+
rspec-support (~> 3.11.0)
|
68
|
+
rspec-mocks (3.11.0)
|
104
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
105
|
-
rspec-support (~> 3.
|
106
|
-
rspec-support (3.
|
70
|
+
rspec-support (~> 3.11.0)
|
71
|
+
rspec-support (3.11.0)
|
107
72
|
rubocop (0.93.1)
|
108
73
|
parallel (~> 1.10)
|
109
74
|
parser (>= 2.7.1.5)
|
@@ -113,33 +78,32 @@ GEM
|
|
113
78
|
rubocop-ast (>= 0.6.0)
|
114
79
|
ruby-progressbar (~> 1.7)
|
115
80
|
unicode-display_width (>= 1.4.0, < 2.0)
|
116
|
-
rubocop-ast (1.
|
117
|
-
parser (>=
|
81
|
+
rubocop-ast (1.4.1)
|
82
|
+
parser (>= 2.7.1.5)
|
118
83
|
ruby-progressbar (1.11.0)
|
119
|
-
sequel (5.
|
120
|
-
simplecov (0.
|
84
|
+
sequel (5.53.0)
|
85
|
+
simplecov (0.18.5)
|
121
86
|
docile (~> 1.1)
|
122
87
|
simplecov-html (~> 0.11)
|
123
|
-
simplecov_json_formatter (~> 0.1)
|
124
88
|
simplecov-html (0.12.3)
|
125
|
-
simplecov_json_formatter (0.1.3)
|
126
89
|
timecop (0.9.4)
|
127
|
-
unicode-display_width (1.
|
90
|
+
unicode-display_width (1.8.0)
|
128
91
|
webmock (3.7.6)
|
129
92
|
addressable (>= 2.3.6)
|
130
93
|
crack (>= 0.3.2)
|
131
94
|
hashdiff (>= 0.4.0, < 2.0.0)
|
132
|
-
|
95
|
+
webrick (1.7.0)
|
96
|
+
yard (0.9.27)
|
97
|
+
webrick (~> 1.7.0)
|
133
98
|
|
134
99
|
PLATFORMS
|
135
|
-
|
100
|
+
ruby
|
136
101
|
|
137
102
|
DEPENDENCIES
|
138
|
-
bundler (~>
|
103
|
+
bundler (~> 1.17)
|
139
104
|
byebug (~> 11.1)
|
140
105
|
cyclone_lariat!
|
141
106
|
database_cleaner-sequel (~> 2.0)
|
142
|
-
dry-validation (~> 1.1)
|
143
107
|
pg (~> 1.2)
|
144
108
|
pry (~> 0.13)
|
145
109
|
pry-byebug (~> 3.9)
|
@@ -152,4 +116,4 @@ DEPENDENCIES
|
|
152
116
|
yard (~> 0.9)
|
153
117
|
|
154
118
|
BUNDLED WITH
|
155
|
-
|
119
|
+
1.17.3
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rake'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
4
8
|
|
5
9
|
# tasks from lib directory
|
6
10
|
Dir[File.expand_path('lib/tasks/**/*.rake', __dir__)].each do |entity|
|
7
|
-
|
8
|
-
load entity
|
11
|
+
print "#{entity} : "
|
12
|
+
puts load entity
|
9
13
|
end
|
10
14
|
|
11
15
|
task default: %i[spec] # rubocop]
|
data/bin/docker/diff
ADDED
data/bin/docker/init
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Initialize project to use Docker and prepare app in Docker
|
2
|
+
#
|
3
|
+
# WARNING
|
4
|
+
# if your default ssh key `id_rsa` is protected by password,
|
5
|
+
# you need to create a new key without password only for Github (and authorize this key in github)
|
6
|
+
# @example
|
7
|
+
# `ssh-keygen -b 4096 -f ~/.ssh/id_rsa_git -N ""`
|
8
|
+
#
|
9
|
+
# And define a name of new key when calling this script.
|
10
|
+
# @example:
|
11
|
+
# `bin/docker-init id_rsa_git`
|
12
|
+
|
13
|
+
bin/docker-privatekey $@
|
14
|
+
|
15
|
+
echo "> Preparing volume directories"
|
16
|
+
mkdir local
|
17
|
+
mkdir local/postgres
|
18
|
+
mkdir local/postgres/pgdata
|
19
|
+
grep -q "# docker-compose" .gitignore || echo "\n# docker-compose\n/local/\n/privatekey" >> .gitignore
|
20
|
+
|
21
|
+
echo "> Build"
|
22
|
+
docker compose down
|
23
|
+
docker compose build
|
24
|
+
docker compose up -d
|
25
|
+
|
26
|
+
# Restart because of some problems with PG first startup
|
27
|
+
echo "> Restart"
|
28
|
+
docker compose down
|
29
|
+
docker compose up -d
|
30
|
+
|
31
|
+
echo "> Wait for pg startup"
|
32
|
+
sleep 10
|
33
|
+
|
34
|
+
echo "> Create databases"
|
35
|
+
docker compose exec app rake db:create
|
36
|
+
docker compose exec app rake db:create INSTANCE=test
|
37
|
+
docker compose exec app rake db:migrate
|
38
|
+
docker compose exec app rake db:migrate INSTANCE=test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Note:
|
2
|
+
# Docker needs for ssh privatekey to fetch data from github
|
3
|
+
# To do that, this script creates hardlink to privatekey
|
4
|
+
#
|
5
|
+
# WARNING
|
6
|
+
# privatekey MUST NOT be protected by password
|
7
|
+
# If your `id_rsa` is protected by password, you need to create new key without password (for example, `id_rsa_git`)
|
8
|
+
# And use that key when running this script:
|
9
|
+
# `bin/docker-init id_rsa_git`
|
10
|
+
|
11
|
+
if test "$@"
|
12
|
+
then privatekey_name="$@"
|
13
|
+
else privatekey_name="id_rsa"
|
14
|
+
fi
|
15
|
+
|
16
|
+
echo "> Trying to create link 'privatekey'"
|
17
|
+
ln ~/.ssh/$privatekey_name privatekey && echo "> Created link to '~/.ssh/$privatekey_name' named 'privatekey'"
|
data/bin/docker/rm
ADDED
data/config/db.example.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
DB_CONF = {
|
4
4
|
adapter: 'postgresql',
|
5
|
-
host: 'host',
|
6
|
-
username: 'postgres',
|
7
|
-
password: 'password',
|
8
|
-
database: 'cyclone-lariat-test'
|
5
|
+
host: ENV.fetch('DB_HOST', 'host'),
|
6
|
+
username: ENV.fetch('DB_USER', 'postgres'),
|
7
|
+
password: ENV.fetch('DB_PASSWORD', 'password'),
|
8
|
+
database: ENV.fetch('DB_NAME', 'cyclone-lariat-test')
|
9
9
|
}.freeze
|
data/cyclone_lariat.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = 'Shoryuken middleware for LunaPark based application.'
|
14
14
|
spec.homepage = 'https://am-team.github.io/cyclone_lariat/#/'
|
15
15
|
spec.license = 'MIT'
|
16
|
-
spec.required_ruby_version = '>= 2.
|
16
|
+
spec.required_ruby_version = '>= 2.4.0'
|
17
17
|
|
18
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -36,10 +36,9 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_dependency 'aws-sdk-sqs'
|
37
37
|
spec.add_dependency 'luna_park', '~> 0.11'
|
38
38
|
|
39
|
-
spec.add_development_dependency 'bundler', '~>
|
39
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
40
40
|
spec.add_development_dependency 'byebug', '~> 11.1'
|
41
41
|
spec.add_development_dependency 'database_cleaner-sequel', '~> 2.0'
|
42
|
-
spec.add_development_dependency 'dry-validation', '~> 1.1'
|
43
42
|
spec.add_development_dependency 'pg', '~> 1.2'
|
44
43
|
spec.add_development_dependency 'pry', '~> 0.13'
|
45
44
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
version: "3.9"
|
2
|
+
|
3
|
+
services:
|
4
|
+
app:
|
5
|
+
build: .
|
6
|
+
volumes:
|
7
|
+
- .:/gem
|
8
|
+
command: /bin/bash -c "while true; do sleep 1; done"
|
9
|
+
links:
|
10
|
+
- pg
|
11
|
+
environment:
|
12
|
+
- DB_HOST=pg
|
13
|
+
- DB_USER=ruby
|
14
|
+
- DB_PASSWORD=ruby
|
15
|
+
restart: always
|
16
|
+
|
17
|
+
pg:
|
18
|
+
image: postgres
|
19
|
+
volumes:
|
20
|
+
- ./local/postgres/pgdata:/var/lib/postgresql/data/pgdata
|
21
|
+
environment:
|
22
|
+
POSTGRES_USER: ruby
|
23
|
+
POSTGRES_PASSWORD: ruby
|
24
|
+
PGDATA: /var/lib/postgresql/data/pgdata
|
@@ -56,11 +56,10 @@ module CycloneLariat
|
|
56
56
|
publisher == other.publisher &&
|
57
57
|
type == other.type &&
|
58
58
|
client_error&.message == other.client_error&.message &&
|
59
|
-
client_error&.details == other.client_error&.details &&
|
60
59
|
version == other.version &&
|
61
60
|
sent_at.to_i == other.sent_at.to_i &&
|
62
|
-
received_at.to_i == other.received_at.to_i
|
63
|
-
|
61
|
+
received_at.to_i == other.received_at.to_i &&
|
62
|
+
processed_at.to_i == other.processed_at.to_i
|
64
63
|
end
|
65
64
|
|
66
65
|
def to_json(*args)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CycloneLariat
|
4
|
+
class MessagesMapper
|
5
|
+
class << self
|
6
|
+
def from_row(row)
|
7
|
+
return if row.nil?
|
8
|
+
|
9
|
+
row[:data] = hash_from_json_column(row[:data])
|
10
|
+
row[:client_error_details] = hash_from_json_column(row[:client_error_details]) if row[:client_error_details]
|
11
|
+
row
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_row(input)
|
15
|
+
{
|
16
|
+
uuid: input.uuid,
|
17
|
+
kind: input.kind,
|
18
|
+
type: input.type,
|
19
|
+
publisher: input.publisher,
|
20
|
+
data: JSON.generate(input.data),
|
21
|
+
client_error_message: input.client_error&.message,
|
22
|
+
client_error_details: JSON.generate(input.client_error&.details),
|
23
|
+
version: input.version,
|
24
|
+
sent_at: input.sent_at
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def hash_from_json_column(data)
|
31
|
+
return JSON.parse(data) if data.is_a?(String)
|
32
|
+
|
33
|
+
if pg_json_extension_enabled?
|
34
|
+
return data.to_h if data.is_a?(Sequel::Postgres::JSONHash)
|
35
|
+
return JSON.parse(data.to_s) if data.is_a?(Sequel::Postgres::JSONString)
|
36
|
+
end
|
37
|
+
|
38
|
+
raise ArgumentError, "Unknown type of `#{data}`"
|
39
|
+
end
|
40
|
+
|
41
|
+
def pg_json_extension_enabled?
|
42
|
+
Object.const_defined?('Sequel::Postgres::JSONHash')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'event'
|
4
|
+
require_relative 'messages_mapper'
|
4
5
|
|
5
6
|
module CycloneLariat
|
6
7
|
class MessagesRepo
|
@@ -11,17 +12,7 @@ module CycloneLariat
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def create(msg)
|
14
|
-
dataset.insert(
|
15
|
-
uuid: msg.uuid,
|
16
|
-
kind: msg.kind,
|
17
|
-
type: msg.type,
|
18
|
-
publisher: msg.publisher,
|
19
|
-
data: JSON.generate(msg.data),
|
20
|
-
client_error_message: msg.client_error&.message,
|
21
|
-
client_error_details: JSON.generate(msg.client_error&.details),
|
22
|
-
version: msg.version,
|
23
|
-
sent_at: msg.sent_at
|
24
|
-
)
|
15
|
+
dataset.insert MessagesMapper.to_row(msg)
|
25
16
|
end
|
26
17
|
|
27
18
|
def exists?(uuid:)
|
@@ -36,34 +27,22 @@ module CycloneLariat
|
|
36
27
|
end
|
37
28
|
|
38
29
|
def find(uuid:)
|
39
|
-
|
40
|
-
return nil
|
30
|
+
row = dataset.where(uuid: uuid).first
|
31
|
+
return if row.nil?
|
41
32
|
|
42
|
-
|
43
|
-
if raw[:client_error_details]
|
44
|
-
raw[:client_error_details] = JSON.parse(raw[:client_error_details], symbolize_names: true)
|
45
|
-
end
|
46
|
-
build raw
|
33
|
+
build MessagesMapper.from_row(row)
|
47
34
|
end
|
48
35
|
|
49
36
|
def each_unprocessed
|
50
|
-
dataset.where(processed_at: nil).each do |
|
51
|
-
|
52
|
-
if raw[:client_error_details]
|
53
|
-
raw[:client_error_details] = JSON.parse(raw[:client_error_details], symbolize_names: true)
|
54
|
-
end
|
55
|
-
msg = build raw
|
37
|
+
dataset.where(processed_at: nil).each do |row|
|
38
|
+
msg = build MessagesMapper.from_row(row)
|
56
39
|
yield(msg)
|
57
40
|
end
|
58
41
|
end
|
59
42
|
|
60
43
|
def each_with_client_errors
|
61
|
-
dataset.where { (processed_at !~ nil) & (client_error_message !~ nil) }.each do |
|
62
|
-
|
63
|
-
if raw[:client_error_details]
|
64
|
-
raw[:client_error_details] = JSON.parse(raw[:client_error_details], symbolize_names: true)
|
65
|
-
end
|
66
|
-
msg = build raw
|
44
|
+
dataset.where { (processed_at !~ nil) & (client_error_message !~ nil) }.each do |row|
|
45
|
+
msg = build MessagesMapper.from_row(row)
|
67
46
|
yield(msg)
|
68
47
|
end
|
69
48
|
end
|
@@ -31,7 +31,7 @@ module CycloneLariat
|
|
31
31
|
attr_reader :errors_notifier, :message_notifier, :events_repo
|
32
32
|
|
33
33
|
def receive_message(body)
|
34
|
-
body[:Message] ? JSON.parse(body[:Message], symbolize_names: true
|
34
|
+
body[:Message] ? JSON.parse(body[:Message], symbolize_names: true) : body
|
35
35
|
end
|
36
36
|
|
37
37
|
def store_in_dataset(event)
|
data/lib/cyclone_lariat.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative 'cyclone_lariat/sns_client'
|
4
4
|
require_relative 'cyclone_lariat/errors'
|
5
5
|
require_relative 'cyclone_lariat/event'
|
6
|
+
require_relative 'cyclone_lariat/messages_mapper'
|
6
7
|
require_relative 'cyclone_lariat/messages_repo'
|
7
8
|
require_relative 'cyclone_lariat/middleware'
|
8
9
|
require_relative 'cyclone_lariat/version'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyclone_lariat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kudrin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-sns
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '1.17'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '1.17'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: byebug
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,20 +95,6 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '2.0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: dry-validation
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '1.1'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.1'
|
112
98
|
- !ruby/object:Gem::Dependency
|
113
99
|
name: pg
|
114
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,14 +249,20 @@ files:
|
|
263
249
|
- ".ruby-gemset"
|
264
250
|
- ".ruby-version"
|
265
251
|
- CHANGELOG.md
|
252
|
+
- Dockerfile
|
266
253
|
- Gemfile
|
267
254
|
- Gemfile.lock
|
268
255
|
- README.md
|
269
256
|
- Rakefile
|
257
|
+
- bin/docker/diff
|
258
|
+
- bin/docker/init
|
259
|
+
- bin/docker/privatekey
|
260
|
+
- bin/docker/rm
|
270
261
|
- config/db.example.rb
|
271
262
|
- cyclone_lariat.gemspec
|
272
263
|
- db/migrate/01_add_uuid_extensions.rb
|
273
264
|
- db/migrate/02_add_events.rb
|
265
|
+
- docker-compose.yml
|
274
266
|
- docs/_imgs/diagram.png
|
275
267
|
- docs/_imgs/lariat.jpg
|
276
268
|
- lib/cyclone_lariat.rb
|
@@ -279,6 +271,7 @@ files:
|
|
279
271
|
- lib/cyclone_lariat/command.rb
|
280
272
|
- lib/cyclone_lariat/errors.rb
|
281
273
|
- lib/cyclone_lariat/event.rb
|
274
|
+
- lib/cyclone_lariat/messages_mapper.rb
|
282
275
|
- lib/cyclone_lariat/messages_repo.rb
|
283
276
|
- lib/cyclone_lariat/middleware.rb
|
284
277
|
- lib/cyclone_lariat/sns_client.rb
|
@@ -298,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
291
|
requirements:
|
299
292
|
- - ">="
|
300
293
|
- !ruby/object:Gem::Version
|
301
|
-
version: 2.
|
294
|
+
version: 2.4.0
|
302
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
296
|
requirements:
|
304
297
|
- - ">="
|