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

kcqrs/eventstore: load multiple aggregates by single key #46

Open
mgenov opened this issue Nov 12, 2018 · 0 comments
Open

kcqrs/eventstore: load multiple aggregates by single key #46

mgenov opened this issue Nov 12, 2018 · 0 comments

Comments

@mgenov
Copy link
Member

mgenov commented Nov 12, 2018

It would be valuable if EventStore is able to load multiple aggregates by providing single key.

For example the API will look like

// Returns all events of all aggregates related to the provided key.
// The result may contain: License, Location, Addreess and etc aggreegates
val events = eventStore.getEventsByKey("Customer:123") 

// Returns all Licenses attached to the provided customer
val licenses = eventStore.getAggregatesByKey("Customer:123", LicenseAggregate.key);

For small collections it will ensure that data is consistent and will skip view creation at some places.

Here is a prototype of the message definition which could be persisted in the datastore:

message RowEvents {
  
  string rowId = 1;

  repeated AggregateEvent events = 2;
}

message AggregateEvent {

  string aggregateId = 1;

  string aggregateType = 2;

  int64 timestamp = 3;

  string identityId = 4;
  
  bytes payload = 5;
}
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

No branches or pull requests

1 participant