-
Notifications
You must be signed in to change notification settings - Fork 63
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
JAMES-3142 Rely on event sourcing to correct current group registration #3303
Conversation
test this please |
1 similar comment
test this please |
…oups The unbinding subscriber need to retrieve the actually performed bindings in order to enforce the binded groups to be the required groups. This means that groups will also be eventually unregistered upon errors.
…oups The unbinding subscriber need to retrieve the actually performed bindings in order to enforce the binded groups to be the required groups. This means that groups will also be eventually unregistered upon errors.
By moving the registered group detection to the emitter, and maintaining the diff between registered and required groups throughout the aggregate we are able to achieve retries of failed unbind without emmitting events on the happy scenario (required groups = registered group & no change), limiting history growth.
c095e21
to
398eeaa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation defeats the purpose of ES.
I really think that we should not try to solve the diverging projection concern with anything else than projection rebuilding.
this.eventStore); | ||
} | ||
|
||
public Mono<Void> start(ImmutableSet<Group> requiredGroups) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need your aggregate to build your command, that looks like a design violation.
|
||
import com.google.common.collect.ImmutableSet; | ||
|
||
public class RegisteredGroupListenerChangeEvent implements Event { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not describing events (like groupAdded
or groupRemoved
) but a state, it's not event sourcing anymore.
Thanks for these design considerations |
Follow up of discussions happening here #3280
Vocabulary:
required groups: the groups that the event bus uses, and that should be eventually registered.
registered groups: the groups actually registered within rabbitMQ (the queue exists and is bound to the main exchange)
The goal of GroupUnregistringManager is to make the required groups converge with the registered groups.
From the required groups, the GroupUnregistringManager loads the registered groups, and manages the vision of required/registered groups via the aggregate. A subscriber actually binds/unbinds as needed the exchange to make the two ensembles converge.
Keeping track of required and registered groups within the same aggregate is handy from an auditing purpose.
Also, it allows firering an event only when needed (updating the history or fixing a divergence).