dionysus-rb 0.1.0 → 0.2.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: 51b0fe501a9678e2fc887a1525a40a0ddc6e04d9a2d49e8211305370eef4e843
4
- data.tar.gz: 82597c73fa710cbac12f091e6f8c26462aae3dfc7572de180cbc474c70cedf1a
3
+ metadata.gz: bf3312592aa3f39392dc5ea53bb55a026cdf1dbde5cce0fc598f50a99d1d499e
4
+ data.tar.gz: 0c302683ed17704b861bd1d08eb3d87f549e7102af46acd23cccd1be0163c329
5
5
  SHA512:
6
- metadata.gz: c7f05381d3fc7e3eba08e4666a46b71e1bc52425d56a3a0d46c5fde4287fdcc77bc64c4521d4f76307849e1cb017e07ab9d612dc127c72bc3fe5e23d919c994e
7
- data.tar.gz: 13e9c0664deb5453e9510c0cba835222cb487ff3511696bdcfce4ec09f8677eb16fd4b25bafd4748275cc0533bd62ac3a524761d673d368666153ff79892cb40
6
+ metadata.gz: d788ee2c0aadac5bd2d8510517f941043ef032cb22d049ed8457a5ce68a26cd799ef4370fd58cb89f2999ade8e4dfd174fcebe39d42ed702f4e235060dc877f1
7
+ data.tar.gz: a3e25434d96c3579b6185b9e6cfd6d6bd4e87aba52eb7e5e8b7736addf25aada4964bbf1ada59d9c4ccf0051b5b251bfe207669ce08d4852836ca35e8e5dc1d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0]
4
+ - Fix creation of outbox records when updating a record that was soft-deleted
5
+
3
6
  ## [0.1.0]
4
7
 
5
8
  - Turn private gem `bookingsync-prometheus` into `dionysus-rb` and release it publicly
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dionysus-rb (0.1.0)
4
+ dionysus-rb (0.2.0)
5
5
  activerecord (>= 5)
6
6
  activesupport (>= 3.2)
7
7
  concurrent-ruby
data/README.md CHANGED
@@ -24,8 +24,8 @@ If bundler is not being used to manage dependencies, install the gem by executin
24
24
 
25
25
  Please read [this article first](https://www.smily.com/engineering/integration-patterns-for-distributed-architecture-how-we-use-kafka-in-smily-and-why) to understand the context how this gem was built. Also, it's just recently been made public, so some part of the docs might require clarification. If you find any section like that, don't hesitate to submit an issue.
26
26
 
27
- ### TODO - update the article is published.
28
- Also, [read this article], which is an introduction to the gem.
27
+
28
+ Also, [read this article](https://www.smily.com/engineering/integration-patterns-for-distributed-architecture-intro-to-dionysus-rb), which is an introduction to the gem.
29
29
 
30
30
 
31
31
  Any application can be both consumer and the producer of Karafka events, so let's take a look how to handle configuration for both scenario.
@@ -115,7 +115,7 @@ end
115
115
 
116
116
 
117
117
  There are a couple of important things to understand here.
118
- - A namespace might be used for versioning so that you can have e.g., `v3` and v4` format working at the same time and consumers consumings from different ones as they need. Namespace is a part of the topic name, in the example above the following topics are declared: `v3_accounts`, `v3_rentals`, `v3_bookings`, `v3_los_records`. Most likely you will need to create them manually in the production environement, depending the Kafka cluster configuration.
118
+ - A namespace might be used for versioning so that you can have e.g., `v3` and `v4` format working at the same time and consumers consumings from different ones as they need. Namespace is a part of the topic name, in the example above the following topics are declared: `v3_accounts`, `v3_rentals`, `v3_bookings`, `v3_los_records`. Most likely you will need to create them manually in the production environement, depending the Kafka cluster configuration.
119
119
  - `topic` is a declaration of Kafka `topics`. To understand more about topics and what would be some rule of thumbs when designing them, please [read this article](https://www.smily.com/engineering/integration-patterns-for-distributed-architecture-intro-to-kafka).
120
120
  - Some entities might have attributes depending on other entities (computed properties) or might need to be always published together (kind of like Domain-Driven Design Aggregate). For these cases, use `with` directive which is an equivalent of sideloading from REST APIs. E.g., Booking could have `final_price` attribute that depends on other models, like BookingsFee or BookingsTax, which contribute to that price. Publishing these items separately, e.g. first Bookings Fee first and then Booking with the changed final price might lead to inconsistency on the consumer side where `final_price` value doesn't match the value that would be obtained by summing all elements of the price. That's why all these records need to be published together. That's what `with` option is supposed to cover: `publish Booking, with: [BookingsFee, BookingsTax]`. Thanks to that declaration, any update to Booking or change its dependencies (BookingsFee, BookingsTax) such as creation/update/deletion will result in publishing `booking_updated` event.
121
121
 
@@ -1203,4 +1203,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Bookin
1203
1203
  ## License
1204
1204
 
1205
1205
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1206
- ["NAME_OF_THE_APP"]:
@@ -82,10 +82,10 @@ class Dionysus::Producer::Outbox
82
82
  def event_type_for_update_of_soft_deletable_record_for_soft_delete_state_change(publishable)
83
83
  if publishable.previous_changes_uncanceled?
84
84
  :created
85
- elsif publishable.previous_changes_canceled?
85
+ elsif publishable.previous_changes_canceled? || publishable.previous_changes_still_canceled?
86
86
  :destroyed
87
- elsif publishable.previous_changes_still_canceled? || publishable.previous_changed_still_visible?
88
- nil
87
+ elsif publishable.previous_changed_still_visible?
88
+ raise "that should never happen: a cannot be still visible when it was soft-deleted"
89
89
  else
90
90
  raise "that should never happen"
91
91
  end
@@ -95,7 +95,7 @@ class Dionysus::Producer::Outbox
95
95
  if publishable.visible? || (publishable.soft_deleted? && publishable.dionysus_publish_updates_after_soft_delete?)
96
96
  :updated
97
97
  elsif publishable.soft_deleted?
98
- nil
98
+ nil # deliberately not returning any event because the record is configured as such
99
99
  else
100
100
  raise "that should never happen"
101
101
  end
@@ -3,5 +3,5 @@
3
3
  module Dionysus
4
4
  module Version
5
5
  end
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dionysus-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Galanciak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord