Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify default routing conventions for signal messages #1565

Open
alexander-yevsyukov opened this issue Jan 9, 2025 · 0 comments
Open

Unify default routing conventions for signal messages #1565

alexander-yevsyukov opened this issue Jan 9, 2025 · 0 comments

Comments

@alexander-yevsyukov
Copy link
Contributor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant