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
We need to unify the way we route signals in the default scenario.
Current defaults for commands
It's done by the first message field of a command message.
Current defaults for routing events
Currently, these defaults for routing events are set differently depending on the class of a repository.
EventDispatchingRepository and AggregateRepository create event routing with the default via EventRouting.withDefaultByProducerId().
ProjectionRepository descends from EventDispatchingRepository and does not alter the defaults. So it's withDefaultByProducerId() too.
ProcessManagerRepository — which descends from EventDispatchingRepository too — overrides the defaults set by the parent class to EventRoute.byFirstMessageField().
So, now we mostly route by the producer ID stored in EventContext. This is a source of confusion by itself, because it requires remembering the rules by the kind of an entity.
Suggested unification
Always have the default routing by the first message field for all kinds of signals.
Use EventRoute.byProducerId() for EventDispatchingRepository if the type of the first message field does not match the ID of the entities.
The text was updated successfully, but these errors were encountered:
We need to unify the way we route signals in the default scenario.
Current defaults for commands
It's done by the first message field of a command message.
Current defaults for routing events
Currently, these defaults for routing events are set differently depending on the class of a repository.
EventDispatchingRepository
andAggregateRepository
create event routing with the default viaEventRouting.withDefaultByProducerId()
.ProjectionRepository
descends fromEventDispatchingRepository
and does not alter the defaults. So it'swithDefaultByProducerId()
too.ProcessManagerRepository
— which descends fromEventDispatchingRepository
too — overrides the defaults set by the parent class toEventRoute.byFirstMessageField()
.So, now we mostly route by the producer ID stored in
EventContext
. This is a source of confusion by itself, because it requires remembering the rules by the kind of an entity.Suggested unification
EventRoute.byProducerId()
forEventDispatchingRepository
if the type of the first message field does not match the ID of the entities.The text was updated successfully, but these errors were encountered: