AxonFramework / AxonFramework

Framework for Evolutionary Message-Driven Microservices on the JVM
https://axoniq.io/
Apache License 2.0
3.32k stars 788 forks source link

Adjust the `MessageStream` to allow other things than `Messages` #3129

Open smcvb opened 2 weeks ago

smcvb commented 2 weeks ago

Enhancement Description

It would be beneficial if we adjust the MessageStream API to support other objects than only Message implementations. One of the more apparent use cases of this flexibility is the opportunity to adjust the stream of TrackingEventMessages, as is used abundantly right now, into a stream of TrackingToken-to-Message instances. In other words, to have the stream allow for pairs.

While working on #3101 and hitting the event streaming side of things, getting rid of the TrackedEventMessage would clean-up the API. Furthermore, it would allow for distinct signals to live inside the stream, like the consistency marker, as is needed for event sourcing.

Current Behaviour

The MessageStream expects items that are implementations of the Message interface.

Wanted Behaviour

That the MessageStream allows any generic type.

Possible Workarounds

Not use the MessageStream.