You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2025-09-12-evolving-event-names-and-payloads-in-rails-event-store-without-breaking-history.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ We decided to create a custom `Transformations::RefundToReturnEventMapper`and in
66
66
67
67
### Key components
68
68
69
-
1. Event class name transformation
69
+
####Event class name transformation
70
70
71
71
```ruby
72
72
class_map = {
@@ -111,7 +111,7 @@ module Transformations
111
111
end
112
112
```
113
113
114
-
2. Payload data transformation
114
+
####Payload data transformation
115
115
116
116
As you probably notice there's also a call to `transform_payload`, here's how it works:
117
117
@@ -159,7 +159,7 @@ As described in [this post](https://blog.arkency.com/4-strategies-when-you-need-
159
159
160
160
After investigating its capabilities, we discovered that upcast can indeed handle both event class name changes and payload transformation through lambda functions. However, we chose to stick with our custom mapper approach for several practical reasons:
161
161
162
-
1. Pipeline integration complexity
162
+
###Pipeline integration complexity
163
163
164
164
RES upcast works beautifully as a standalone solution, but doesn't integrate cleanly with the transformation pipeline we needed:
165
165
@@ -176,7 +176,7 @@ RES upcast works beautifully as a standalone solution, but doesn't integrate cle
176
176
177
177
We needed `DomainEvent.new`, `SymbolizeMetadataKeys.new`, and `PreserveTypes.new` transformations, but upcast's `Default` mapper isn't designed to work within a transformation pipeline.
178
178
179
-
2. Excessive boilerplate when using lambdas
179
+
###Excessive boilerplate when using lambdas
180
180
181
181
Lambdas could be used to handle paload transformation, however using upcast with lambdas required significant boilerplate code for each event type:
182
182
@@ -205,7 +205,7 @@ Without the transformation pipeline, we'd lose the automatic benefits of:
205
205
206
206
We'd need to reimplement these features manually in each lambda.
207
207
208
-
3. Code organization and maintainability
208
+
###Code organization and maintainability
209
209
210
210
Our custom mapper provides better separation of concerns:
211
211
- single responsibility: one class handles all transformation logic
0 commit comments