pub_sub_model_sync 1.0.beta2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +43 -0
  3. data/CHANGELOG.md +18 -4
  4. data/Gemfile.lock +2 -6
  5. data/README.md +198 -122
  6. data/docs/notifications-diagram.png +0 -0
  7. data/lib/pub_sub_model_sync/base.rb +0 -20
  8. data/lib/pub_sub_model_sync/config.rb +2 -3
  9. data/lib/pub_sub_model_sync/message_processor.rb +32 -9
  10. data/lib/pub_sub_model_sync/message_publisher.rb +18 -14
  11. data/lib/pub_sub_model_sync/payload.rb +15 -12
  12. data/lib/pub_sub_model_sync/{publisher.rb → payload_builder.rb} +16 -11
  13. data/lib/pub_sub_model_sync/publisher_concern.rb +29 -27
  14. data/lib/pub_sub_model_sync/railtie.rb +0 -1
  15. data/lib/pub_sub_model_sync/run_subscriber.rb +17 -13
  16. data/lib/pub_sub_model_sync/runner.rb +3 -5
  17. data/lib/pub_sub_model_sync/service_base.rb +6 -33
  18. data/lib/pub_sub_model_sync/service_google.rb +2 -2
  19. data/lib/pub_sub_model_sync/service_kafka.rb +2 -2
  20. data/lib/pub_sub_model_sync/subscriber_concern.rb +11 -9
  21. data/lib/pub_sub_model_sync/transaction.rb +7 -3
  22. data/lib/pub_sub_model_sync/version.rb +1 -1
  23. data/lib/pub_sub_model_sync.rb +1 -1
  24. data/samples/README.md +50 -0
  25. data/samples/app1/Dockerfile +13 -0
  26. data/samples/app1/Gemfile +37 -0
  27. data/samples/app1/Gemfile.lock +171 -0
  28. data/samples/app1/README.md +24 -0
  29. data/samples/app1/Rakefile +6 -0
  30. data/samples/app1/app/models/application_record.rb +3 -0
  31. data/samples/app1/app/models/concerns/.keep +0 -0
  32. data/samples/app1/app/models/post.rb +19 -0
  33. data/samples/app1/app/models/user.rb +29 -0
  34. data/samples/app1/bin/bundle +114 -0
  35. data/samples/app1/bin/rails +5 -0
  36. data/samples/app1/bin/rake +5 -0
  37. data/samples/app1/bin/setup +33 -0
  38. data/samples/app1/bin/spring +14 -0
  39. data/samples/app1/config/application.rb +40 -0
  40. data/samples/app1/config/boot.rb +4 -0
  41. data/samples/app1/config/credentials.yml.enc +1 -0
  42. data/samples/app1/config/database.yml +25 -0
  43. data/samples/app1/config/environment.rb +5 -0
  44. data/samples/app1/config/environments/development.rb +63 -0
  45. data/samples/app1/config/environments/production.rb +105 -0
  46. data/samples/app1/config/environments/test.rb +57 -0
  47. data/samples/app1/config/initializers/application_controller_renderer.rb +8 -0
  48. data/samples/app1/config/initializers/backtrace_silencers.rb +8 -0
  49. data/samples/app1/config/initializers/cors.rb +16 -0
  50. data/samples/app1/config/initializers/filter_parameter_logging.rb +6 -0
  51. data/samples/app1/config/initializers/inflections.rb +16 -0
  52. data/samples/app1/config/initializers/mime_types.rb +4 -0
  53. data/samples/app1/config/initializers/pubsub.rb +4 -0
  54. data/samples/app1/config/initializers/wrap_parameters.rb +14 -0
  55. data/samples/app1/config/locales/en.yml +33 -0
  56. data/samples/app1/config/master.key +1 -0
  57. data/samples/app1/config/puma.rb +43 -0
  58. data/samples/app1/config/routes.rb +3 -0
  59. data/samples/app1/config/spring.rb +6 -0
  60. data/samples/app1/config.ru +6 -0
  61. data/samples/app1/db/migrate/20210513080700_create_users.rb +12 -0
  62. data/samples/app1/db/migrate/20210513134332_create_posts.rb +11 -0
  63. data/samples/app1/db/schema.rb +34 -0
  64. data/samples/app1/db/seeds.rb +7 -0
  65. data/samples/app1/docker-compose.yml +32 -0
  66. data/samples/app1/log/.keep +0 -0
  67. data/samples/app2/Dockerfile +13 -0
  68. data/samples/app2/Gemfile +37 -0
  69. data/samples/app2/Gemfile.lock +171 -0
  70. data/samples/app2/README.md +24 -0
  71. data/samples/app2/Rakefile +6 -0
  72. data/samples/app2/app/models/application_record.rb +9 -0
  73. data/samples/app2/app/models/concerns/.keep +0 -0
  74. data/samples/app2/app/models/customer.rb +28 -0
  75. data/samples/app2/app/models/post.rb +10 -0
  76. data/samples/app2/bin/bundle +114 -0
  77. data/samples/app2/bin/rails +5 -0
  78. data/samples/app2/bin/rake +5 -0
  79. data/samples/app2/bin/setup +33 -0
  80. data/samples/app2/bin/spring +14 -0
  81. data/samples/app2/config/application.rb +40 -0
  82. data/samples/app2/config/boot.rb +4 -0
  83. data/samples/app2/config/credentials.yml.enc +1 -0
  84. data/samples/app2/config/database.yml +25 -0
  85. data/samples/app2/config/environment.rb +5 -0
  86. data/samples/app2/config/environments/development.rb +63 -0
  87. data/samples/app2/config/environments/production.rb +105 -0
  88. data/samples/app2/config/environments/test.rb +57 -0
  89. data/samples/app2/config/initializers/application_controller_renderer.rb +8 -0
  90. data/samples/app2/config/initializers/backtrace_silencers.rb +8 -0
  91. data/samples/app2/config/initializers/cors.rb +16 -0
  92. data/samples/app2/config/initializers/filter_parameter_logging.rb +6 -0
  93. data/samples/app2/config/initializers/inflections.rb +16 -0
  94. data/samples/app2/config/initializers/mime_types.rb +4 -0
  95. data/samples/app2/config/initializers/pubsub.rb +4 -0
  96. data/samples/app2/config/initializers/wrap_parameters.rb +14 -0
  97. data/samples/app2/config/locales/en.yml +33 -0
  98. data/samples/app2/config/master.key +1 -0
  99. data/samples/app2/config/puma.rb +43 -0
  100. data/samples/app2/config/routes.rb +3 -0
  101. data/samples/app2/config/spring.rb +6 -0
  102. data/samples/app2/config.ru +6 -0
  103. data/samples/app2/db/development.sqlite3 +0 -0
  104. data/samples/app2/db/migrate/20210513080956_create_customers.rb +10 -0
  105. data/samples/app2/db/migrate/20210513135203_create_posts.rb +10 -0
  106. data/samples/app2/db/schema.rb +31 -0
  107. data/samples/app2/db/seeds.rb +7 -0
  108. data/samples/app2/docker-compose.yml +20 -0
  109. data/samples/app2/log/.keep +0 -0
  110. metadata +92 -6
  111. 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: 50a27cf5815a6b9be1f38f399e47569d403831d61dec25b7b4ffdc126f6f450e
4
- data.tar.gz: 3a97f970d4f0ca08387b59b6da53e0be9f2ce3429db3baf41b5f60b004300b6f
3
+ metadata.gz: 84f478587ccd28d92b653744e72d338cf53818e5286544ff2c6e1e982a5a12a7
4
+ data.tar.gz: 32266d8a3ba69cad2e716c4861914b62e87ee96cf226ecf8f67dab3f909d9856
5
5
  SHA512:
6
- metadata.gz: ee52cce7dba866949b64882e385e5b88aabe4725a18fe8b8f4abbf156d50bf2dc840421fd94e2a65a4cc1580c12ff2e086378101cdfbac812745949af1e85c6a
7
- data.tar.gz: ed67b56451d963e63163d1afb03ffd248ad9033bbad9e08b214afc0b15c933608eefb134ca7c67da8c32e55324fe0f1da8dbcc36da440d9f8d5b3c194c41fdf5
6
+ metadata.gz: 02a727027a13d0b55f330395c95f9077568efb74fae3927c941211a4d849910fd6c071dae5fdd9386b3bb34c5257389cd74e4fcf5979e29f665a9b8e9e93aa95
7
+ data.tar.gz: 896f7430fbc83640ef3141a9e24413de69034ebc2d9e6a66987d734e25e9c41e52f03aa23faa494d9f05d0e4628acd058082e729a1de00c513fb0fb1c2cca70e
@@ -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,21 +1,35 @@
1
1
  # Change Log
2
2
 
3
- # 1.0.beta (May 13, 2021)
3
+ # 1.1.1 (October 25, 2021)
4
+ - feat: include `ordering_key topic_name` when delivering a notification for debugging purposes
5
+ - doc: improve docs
6
+
7
+ # 1.1.0 (October 25, 2021)
8
+ - feat: change `transactions_max_buffer` default value to 1 to deliver notifications once they were called
9
+ - feat: use `after_commit` instead of `before_commit` callback and remove the horrible AR patch for rails 4
10
+
11
+ # 1.0.1 (August 20, 2021)
12
+ - refactor: improve service exit when running in k8s
13
+
14
+ # 1.0 (June 13, 2021)
15
+ This version includes many changes that was refactored from previous version, and thus it needs manual changes to migrate into this version.
4
16
  - Refactor: Subscribers param renamed `from_action` into `to_action` and added support for block or lambda
5
17
  - Feat: Improved `ps_subscribe` to accept new arguments and support for property mappings
6
18
  - Refactor: Refactored `ps_publish` to be called manually (removes notification assumptions) and accept for new arguments
7
- - Feat: Added `ps_on_crud_event` to listen CRUD events to send notifications in the expected order
19
+ - Feat: Added `ps_after_action` to listen CRUD events to send notifications in the expected order
8
20
  - Feat: Added `config.default_topic_name` to define default topic name whe publishing (by default `config.topic_name`)
9
21
  - Refactor: Refactored PubSub Transactions to support rollbacks (any exception inside transactions can automatically cancel all pending notifications: configurable through `config.transactions_use_buffer`)
10
22
  - Feat: Improved CRUD transactions to deliver inner notifications in the expected order to keep data consistency
11
23
  - System refactor: Added subscriber runner
12
24
  - Fix: Class notifications can only be listened by class subscriptions
13
25
  - Refactor: Removed `publish_model_data` to have a unique model publisher `ps_publish`
14
- - Refactor: Renamed `ps_before_sync` into `ps_before_publish`, `ps_skip_sync` into `ps_skip_publish`, `ps_after_sync` into `ps_after_publish`
26
+ - Refactor: Renamed `ps_before_sync` into `ps_before_publish`, `ps_after_sync` into `ps_after_publish`
15
27
  - Refactor: Renamed `payload.attributes` into `payload.info`
16
28
  - Feat: Support for plain Ruby Objects (Non ActiveRecord models)
17
29
  - Fix: Retry errors for 5 times before exiting notifications listener
18
- - Feat: Added transactions max_buffer
30
+ - Feat: Added transactions max_buffer
31
+ - Feat: add `ps_perform_publish` to perform the callback for a specific action
32
+ - Feat: Removed `ps_skip_sync` callback
19
33
 
20
34
  # 0.6.0 (March 03, 2021)
21
35
  - 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.beta2)
4
+ pub_sub_model_sync (1.1.1)
5
5
  rails
6
6
 
7
7
  GEM
@@ -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)
@@ -264,4 +260,4 @@ DEPENDENCIES
264
260
  sqlite3
265
261
 
266
262
  BUNDLED WITH
267
- 2.2.17
263
+ 2.2.29