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

JAMES-3142 Rely on event sourcing to correct current group registration #3303

Closed
wants to merge 9 commits into from

Conversation

chibenwa
Copy link
Member

@chibenwa chibenwa commented Apr 16, 2020

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).

@chibenwa
Copy link
Member Author

test this please

1 similar comment
@chibenwa
Copy link
Member Author

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.
Copy link

@mbaechler mbaechler left a 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) {

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 {

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.

@chibenwa chibenwa closed this Apr 17, 2020
@chibenwa
Copy link
Member Author

Thanks for these design considerations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants