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
I have a question about event-sourcing, how can we validate if the Aggregate can be persisted? Like the example that create a User, how to validate that user has already exists? To restore all the aggregate from event is to expensive. And just check usercreatedevent is also not enough, because user maybe change the username or be deleted. hope you can shed some light on it
The text was updated successfully, but these errors were encountered:
Global validations are particularly difficult for event sourcing systems. If you listen to Greg Young's talk, he suggests that you don't really need to do global validation.
That said, we came across the same issue. The way we solved it is in the single package, github.com/altairsix/eventsource/singleton.
Commands that need to guarantee some uniqueness implement singleton.Interface. The singleton package uses a separate dynamodb table to manage the uniqueness of resources.
It could use better documentation, but the general pattern is:
create dynamodb table (pre-requisite)
create event source registry
create singleton instance
using singleton.Registry#Wrap to wrap the Dispatch function
I have a question about event-sourcing, how can we validate if the Aggregate can be persisted? Like the example that create a User, how to validate that user has already exists? To restore all the aggregate from event is to expensive. And just check usercreatedevent is also not enough, because user maybe change the username or be deleted. hope you can shed some light on it
The text was updated successfully, but these errors were encountered: