carp.core-kotlin icon indicating copy to clipboard operation
carp.core-kotlin copied to clipboard

Consider using Reaktive for implementing domain events

Open Whathecode opened this issue 5 years ago • 2 comments
trafficstars

The following Reactive implementation for Kotlin Multiplatform looks fairly mature: https://github.com/badoo/Reaktive

Rather than using our non-reactive event handling in AggregateRoot we could consider using this library.

Whathecode avatar May 12 '20 14:05 Whathecode

Or should we simply use Flow? https://kotlinlang.org/docs/reference/coroutines/flow.html

Whathecode avatar May 14 '20 15:05 Whathecode

Once we implement eventing, we should also consider redirecting events from lower-level components to high-level ones.

For example, StudyProtocol right now is composed by several underlying components, including ParticipantDataConfiguration. One of the main reasons StudyProtocol currently overrides implementations of underlying components is to trigger events based on the results of redirecting calls to them. Concretely, this also means that replaceExpectedParticipantData was implemented in StudyProtocol rather than ParticipantDataConfiguration since it was more straightforward to manage events this way.

Whathecode avatar Dec 12 '20 18:12 Whathecode