[eventstore] Async EventStore for Kafka
Was wondering if anyone has wrangled with implementing an asynchronous EventStore to user with Kafka and other store engines?
Could we implement some version of the event store that would return some type of promise object and allow for error/success handling?
type AsyncEventStore interface {
// Save appends all events in the event stream to the store.
Save(ctx context.Context, events []Event, originalVersion int) chan<- error
// Load loads all events for the aggregate id from the store.
Load(context.Context, UUID) (chan<- []Event, chan<- error)
}
Food for thought. Comments welcome.
Will try to implement something.
It does sound interesting!
Is there a possibility to wait for the event to be written inside your implementation? It is important that the EventStore.Save() method fully saves the event and increments the version atomically, otherwise there will be no guarantee that the command was successful.
@maxekman Yes, when I woke up today I realised that I could use the async write inside the EventStore.Save. This way we use efficient and reliable writes in kafka and don't break the current implementation of the Store. Will implement something and open a PR for you to check.
Sounds really good, looking forward to see it!
Hi @mumia sounds interesting, anything that we can help with?
Any updates on this?