cph-cachet / carp.core-kotlin

Infrastructure-agnostic framework for distributed data collection.
https://carp.cachet.dk/core/
MIT License
21 stars 3 forks source link

Consider using Reaktive for implementing domain events #126

Open Whathecode opened 4 years ago

Whathecode commented 4 years ago

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 commented 4 years ago

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

Whathecode commented 3 years ago

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.