pub_sub_model_sync 1.0.beta1 → 1.1.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 +4 -4
- data/.github/workflows/release.yml +43 -0
- data/CHANGELOG.md +15 -4
- data/Gemfile.lock +11 -15
- data/README.md +184 -111
- data/docs/notifications-diagram.png +0 -0
- data/lib/pub_sub_model_sync/base.rb +0 -20
- data/lib/pub_sub_model_sync/config.rb +2 -3
- data/lib/pub_sub_model_sync/message_processor.rb +32 -9
- data/lib/pub_sub_model_sync/message_publisher.rb +18 -14
- data/lib/pub_sub_model_sync/payload.rb +15 -12
- data/lib/pub_sub_model_sync/{publisher.rb → payload_builder.rb} +16 -11
- data/lib/pub_sub_model_sync/publisher_concern.rb +29 -21
- data/lib/pub_sub_model_sync/railtie.rb +1 -1
- data/lib/pub_sub_model_sync/run_subscriber.rb +17 -13
- data/lib/pub_sub_model_sync/runner.rb +3 -5
- data/lib/pub_sub_model_sync/service_base.rb +5 -32
- data/lib/pub_sub_model_sync/service_google.rb +2 -2
- data/lib/pub_sub_model_sync/service_kafka.rb +2 -2
- data/lib/pub_sub_model_sync/service_rabbit.rb +1 -1
- data/lib/pub_sub_model_sync/subscriber_concern.rb +11 -9
- data/lib/pub_sub_model_sync/transaction.rb +12 -6
- data/lib/pub_sub_model_sync/version.rb +1 -1
- data/lib/pub_sub_model_sync.rb +1 -1
- data/samples/README.md +50 -0
- data/samples/app1/Dockerfile +13 -0
- data/samples/app1/Gemfile +37 -0
- data/samples/app1/Gemfile.lock +171 -0
- data/samples/app1/README.md +24 -0
- data/samples/app1/Rakefile +6 -0
- data/samples/app1/app/models/application_record.rb +3 -0
- data/samples/app1/app/models/concerns/.keep +0 -0
- data/samples/app1/app/models/post.rb +19 -0
- data/samples/app1/app/models/user.rb +29 -0
- data/samples/app1/bin/bundle +114 -0
- data/samples/app1/bin/rails +5 -0
- data/samples/app1/bin/rake +5 -0
- data/samples/app1/bin/setup +33 -0
- data/samples/app1/bin/spring +14 -0
- data/samples/app1/config/application.rb +40 -0
- data/samples/app1/config/boot.rb +4 -0
- data/samples/app1/config/credentials.yml.enc +1 -0
- data/samples/app1/config/database.yml +25 -0
- data/samples/app1/config/environment.rb +5 -0
- data/samples/app1/config/environments/development.rb +63 -0
- data/samples/app1/config/environments/production.rb +105 -0
- data/samples/app1/config/environments/test.rb +57 -0
- data/samples/app1/config/initializers/application_controller_renderer.rb +8 -0
- data/samples/app1/config/initializers/backtrace_silencers.rb +8 -0
- data/samples/app1/config/initializers/cors.rb +16 -0
- data/samples/app1/config/initializers/filter_parameter_logging.rb +6 -0
- data/samples/app1/config/initializers/inflections.rb +16 -0
- data/samples/app1/config/initializers/mime_types.rb +4 -0
- data/samples/app1/config/initializers/pubsub.rb +4 -0
- data/samples/app1/config/initializers/wrap_parameters.rb +14 -0
- data/samples/app1/config/locales/en.yml +33 -0
- data/samples/app1/config/master.key +1 -0
- data/samples/app1/config/puma.rb +43 -0
- data/samples/app1/config/routes.rb +3 -0
- data/samples/app1/config/spring.rb +6 -0
- data/samples/app1/config.ru +6 -0
- data/samples/app1/db/migrate/20210513080700_create_users.rb +12 -0
- data/samples/app1/db/migrate/20210513134332_create_posts.rb +11 -0
- data/samples/app1/db/schema.rb +34 -0
- data/samples/app1/db/seeds.rb +7 -0
- data/samples/app1/docker-compose.yml +32 -0
- data/samples/app1/log/.keep +0 -0
- data/samples/app2/Dockerfile +13 -0
- data/samples/app2/Gemfile +37 -0
- data/samples/app2/Gemfile.lock +171 -0
- data/samples/app2/README.md +24 -0
- data/samples/app2/Rakefile +6 -0
- data/samples/app2/app/models/application_record.rb +9 -0
- data/samples/app2/app/models/concerns/.keep +0 -0
- data/samples/app2/app/models/customer.rb +28 -0
- data/samples/app2/app/models/post.rb +10 -0
- data/samples/app2/bin/bundle +114 -0
- data/samples/app2/bin/rails +5 -0
- data/samples/app2/bin/rake +5 -0
- data/samples/app2/bin/setup +33 -0
- data/samples/app2/bin/spring +14 -0
- data/samples/app2/config/application.rb +40 -0
- data/samples/app2/config/boot.rb +4 -0
- data/samples/app2/config/credentials.yml.enc +1 -0
- data/samples/app2/config/database.yml +25 -0
- data/samples/app2/config/environment.rb +5 -0
- data/samples/app2/config/environments/development.rb +63 -0
- data/samples/app2/config/environments/production.rb +105 -0
- data/samples/app2/config/environments/test.rb +57 -0
- data/samples/app2/config/initializers/application_controller_renderer.rb +8 -0
- data/samples/app2/config/initializers/backtrace_silencers.rb +8 -0
- data/samples/app2/config/initializers/cors.rb +16 -0
- data/samples/app2/config/initializers/filter_parameter_logging.rb +6 -0
- data/samples/app2/config/initializers/inflections.rb +16 -0
- data/samples/app2/config/initializers/mime_types.rb +4 -0
- data/samples/app2/config/initializers/pubsub.rb +4 -0
- data/samples/app2/config/initializers/wrap_parameters.rb +14 -0
- data/samples/app2/config/locales/en.yml +33 -0
- data/samples/app2/config/master.key +1 -0
- data/samples/app2/config/puma.rb +43 -0
- data/samples/app2/config/routes.rb +3 -0
- data/samples/app2/config/spring.rb +6 -0
- data/samples/app2/config.ru +6 -0
- data/samples/app2/db/development.sqlite3 +0 -0
- data/samples/app2/db/migrate/20210513080956_create_customers.rb +10 -0
- data/samples/app2/db/migrate/20210513135203_create_posts.rb +10 -0
- data/samples/app2/db/schema.rb +31 -0
- data/samples/app2/db/seeds.rb +7 -0
- data/samples/app2/docker-compose.yml +20 -0
- data/samples/app2/log/.keep +0 -0
- metadata +92 -6
- data/lib/pub_sub_model_sync/initializers/before_commit.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 815981bccbd5dd0a03a603a2883b18c94bc321b37ed44623df65635ba645ea6f
|
4
|
+
data.tar.gz: b6e1bc85b69ce30df24f27726bb6e9950699799ddb67b313d8d9434284783f28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7f94f4d387baa8143f2fd2686a739bebefe12c247c48e6e85a3c7880efecaf02d5f01eb1770627cb06dbaeb9251f39a0052d715278c57e2c2771ca5fa342f61
|
7
|
+
data.tar.gz: 54a48c91cfc4cea1dd1e40583f9ac737dc324c0007e3bd8acb88599bb0322d1e3535c8d2dfe24d9023ebd51bd4abe9e7687974ee7d17028161757d267ce538b3
|
@@ -0,0 +1,43 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
tags: # triggered once a git tag is published
|
4
|
+
- '*'
|
5
|
+
|
6
|
+
name: Create Release
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Create Release
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- name: Checkout code
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
fetch-depth: 0
|
17
|
+
|
18
|
+
# Changelog action adaptations
|
19
|
+
- name: Create required package.json
|
20
|
+
run: test -f package.json || echo '{}' >package.json
|
21
|
+
- name: Detect Previous Tag (action not detecting very well)
|
22
|
+
run: echo "::set-output name=previous_tag::$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)"
|
23
|
+
id: tag_checker
|
24
|
+
|
25
|
+
- name: Generate Changelog
|
26
|
+
uses: scottbrenner/generate-changelog-action@master
|
27
|
+
id: Changelog
|
28
|
+
with:
|
29
|
+
from-tag: ${{steps.tag_checker.outputs.previous_tag}}
|
30
|
+
to-tag: HEAD
|
31
|
+
|
32
|
+
- name: Create Release
|
33
|
+
id: create_release
|
34
|
+
uses: actions/create-release@latest
|
35
|
+
env:
|
36
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
37
|
+
with:
|
38
|
+
tag_name: ${{ github.ref }}
|
39
|
+
release_name: Release ${{ github.ref }}
|
40
|
+
body: |
|
41
|
+
${{ steps.Changelog.outputs.changelog }}
|
42
|
+
draft: false
|
43
|
+
prerelease: false
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,31 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
# 1.0
|
3
|
+
# 1.1.0 (October 25, 2021)
|
4
|
+
- feat: change `transactions_max_buffer` default value to 1 to deliver notifications once they were called
|
5
|
+
- feat: use `after_commit` instead of `before_commit` callback and remove the horrible AR patch for rails 4
|
6
|
+
|
7
|
+
# 1.0.1 (August 20, 2021)
|
8
|
+
- refactor: improve service exit when running in k8s
|
9
|
+
|
10
|
+
# 1.0 (June 13, 2021)
|
11
|
+
This version includes many changes that was refactored from previous version, and thus it needs manual changes to migrate into this version.
|
4
12
|
- Refactor: Subscribers param renamed `from_action` into `to_action` and added support for block or lambda
|
5
13
|
- Feat: Improved `ps_subscribe` to accept new arguments and support for property mappings
|
6
14
|
- Refactor: Refactored `ps_publish` to be called manually (removes notification assumptions) and accept for new arguments
|
7
|
-
- Feat: Added `
|
15
|
+
- Feat: Added `ps_after_action` to listen CRUD events to send notifications in the expected order
|
8
16
|
- Feat: Added `config.default_topic_name` to define default topic name whe publishing (by default `config.topic_name`)
|
9
17
|
- Refactor: Refactored PubSub Transactions to support rollbacks (any exception inside transactions can automatically cancel all pending notifications: configurable through `config.transactions_use_buffer`)
|
10
18
|
- Feat: Improved CRUD transactions to deliver inner notifications in the expected order to keep data consistency
|
11
19
|
- System refactor: Added subscriber runner
|
12
20
|
- Fix: Class notifications can only be listened by class subscriptions
|
13
21
|
- Refactor: Removed `publish_model_data` to have a unique model publisher `ps_publish`
|
14
|
-
- Refactor: Renamed `ps_before_sync` into `ps_before_publish`, `
|
22
|
+
- Refactor: Renamed `ps_before_sync` into `ps_before_publish`, `ps_after_sync` into `ps_after_publish`
|
15
23
|
- Refactor: Renamed `payload.attributes` into `payload.info`
|
16
24
|
- Feat: Support for plain Ruby Objects (Non ActiveRecord models)
|
17
|
-
- Fix: Retry errors for 5 times before exiting notifications listener
|
25
|
+
- Fix: Retry errors for 5 times before exiting notifications listener
|
26
|
+
- Feat: Added transactions max_buffer
|
27
|
+
- Feat: add `ps_perform_publish` to perform the callback for a specific action
|
28
|
+
- Feat: Removed `ps_skip_sync` callback
|
18
29
|
|
19
30
|
# 0.6.0 (March 03, 2021)
|
20
31
|
- feat: add support to include custom payload headers
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pub_sub_model_sync (1.0
|
4
|
+
pub_sub_model_sync (1.1.0)
|
5
5
|
rails
|
6
6
|
|
7
7
|
GEM
|
@@ -99,8 +99,8 @@ GEM
|
|
99
99
|
googleapis-common-protos-types (>= 1.0.6, < 2.0)
|
100
100
|
googleauth (~> 0.15, >= 0.15.1)
|
101
101
|
grpc (~> 1.36)
|
102
|
-
globalid (0.
|
103
|
-
activesupport (>=
|
102
|
+
globalid (0.5.2)
|
103
|
+
activesupport (>= 5.0)
|
104
104
|
google-cloud-core (1.6.0)
|
105
105
|
google-cloud-env (~> 1.0)
|
106
106
|
google-cloud-errors (~> 1.0)
|
@@ -116,7 +116,6 @@ GEM
|
|
116
116
|
google-cloud-errors (~> 1.0)
|
117
117
|
grpc-google-iam-v1 (>= 0.6.10, < 2.0)
|
118
118
|
google-protobuf (3.17.0)
|
119
|
-
google-protobuf (3.17.0-x86_64-linux)
|
120
119
|
googleapis-common-protos (1.3.11)
|
121
120
|
google-protobuf (~> 3.14)
|
122
121
|
googleapis-common-protos-types (>= 1.0.6, < 2.0)
|
@@ -133,9 +132,6 @@ GEM
|
|
133
132
|
grpc (1.37.1)
|
134
133
|
google-protobuf (~> 3.15)
|
135
134
|
googleapis-common-protos-types (~> 1.0)
|
136
|
-
grpc (1.37.1-x86_64-linux)
|
137
|
-
google-protobuf (~> 3.15)
|
138
|
-
googleapis-common-protos-types (~> 1.0)
|
139
135
|
grpc-google-iam-v1 (0.6.11)
|
140
136
|
google-protobuf (~> 3.14)
|
141
137
|
googleapis-common-protos (>= 1.3.11, < 2.0)
|
@@ -143,27 +139,27 @@ GEM
|
|
143
139
|
i18n (1.8.10)
|
144
140
|
concurrent-ruby (~> 1.0)
|
145
141
|
jwt (2.2.3)
|
146
|
-
loofah (2.
|
142
|
+
loofah (2.12.0)
|
147
143
|
crass (~> 1.0.2)
|
148
144
|
nokogiri (>= 1.5.9)
|
149
145
|
mail (2.7.1)
|
150
146
|
mini_mime (>= 0.1.1)
|
151
|
-
marcel (1.0.
|
147
|
+
marcel (1.0.2)
|
152
148
|
memoist (0.16.2)
|
153
149
|
method_source (1.0.0)
|
154
150
|
mini_mime (1.0.3)
|
155
151
|
minitest (5.14.4)
|
156
152
|
multi_json (1.15.0)
|
157
153
|
multipart-post (2.1.1)
|
158
|
-
nio4r (2.5.
|
159
|
-
nokogiri (1.
|
154
|
+
nio4r (2.5.8)
|
155
|
+
nokogiri (1.12.5-x86_64-linux)
|
160
156
|
racc (~> 1.4)
|
161
157
|
os (1.1.1)
|
162
158
|
parallel (1.20.1)
|
163
159
|
parser (3.0.1.1)
|
164
160
|
ast (~> 2.4.1)
|
165
161
|
public_suffix (4.0.6)
|
166
|
-
racc (1.
|
162
|
+
racc (1.6.0)
|
167
163
|
rack (2.2.3)
|
168
164
|
rack-test (1.1.0)
|
169
165
|
rack (>= 1.0, < 3)
|
@@ -185,7 +181,7 @@ GEM
|
|
185
181
|
rails-dom-testing (2.0.3)
|
186
182
|
activesupport (>= 4.2.0)
|
187
183
|
nokogiri (>= 1.6)
|
188
|
-
rails-html-sanitizer (1.
|
184
|
+
rails-html-sanitizer (1.4.2)
|
189
185
|
loofah (~> 2.3)
|
190
186
|
railties (6.1.3.2)
|
191
187
|
actionpack (= 6.1.3.2)
|
@@ -242,7 +238,7 @@ GEM
|
|
242
238
|
tzinfo (2.0.4)
|
243
239
|
concurrent-ruby (~> 1.0)
|
244
240
|
unicode-display_width (1.7.0)
|
245
|
-
websocket-driver (0.7.
|
241
|
+
websocket-driver (0.7.5)
|
246
242
|
websocket-extensions (>= 0.1.0)
|
247
243
|
websocket-extensions (0.1.5)
|
248
244
|
zeitwerk (2.4.2)
|
@@ -264,4 +260,4 @@ DEPENDENCIES
|
|
264
260
|
sqlite3
|
265
261
|
|
266
262
|
BUNDLED WITH
|
267
|
-
2.2.
|
263
|
+
2.2.29
|