Skip to content

feat: Transform event and metadata of replicated event#32650

Merged
patriknw merged 6 commits intomainfrom
wip-res-transform-patriknw
Feb 17, 2025
Merged

feat: Transform event and metadata of replicated event#32650
patriknw merged 6 commits intomainfrom
wip-res-transform-patriknw

Conversation

@patriknw
Copy link
Contributor

No description provided.

*/
@ApiMayChange
@InternalStableApi
def withReplicatedEventTransformation(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have this as internal api, since it's needed for a rather special thing in Akka runtime.

val metadataEntriesFromReplicatedEvent =
event.metadata match {
case None => Nil
case Some(_: ReplicatedEventMetadata) => Nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new replicatedEventMetadata will anyway override any existing ReplicatedEventMetadata

val addTransformation
: EventSourcedBehavior[Command, String, State] => EventSourcedBehavior[Command, String, State] =
_.withReplicatedEventTransformation { (_, event) =>
(event.toUpperCase, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some metadata test coverage as well for good measure?

@patriknw patriknw force-pushed the wip-res-transform-patriknw branch from 4a5af69 to e375880 Compare February 14, 2025 16:05
@patriknw
Copy link
Contributor Author

added metadata test and found some things that were not correct: e375880

@patriknw patriknw merged commit 3cac79d into main Feb 17, 2025
5 checks passed
@patriknw patriknw deleted the wip-res-transform-patriknw branch February 17, 2025 10:06
@patriknw patriknw added this to the 2.10.2 milestone Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants