mishudark/eventhus

Questions about implementation details

Closed this issue · 5 comments

Hi,
I'm using your repo as a foundation to implement event-sourcing. While experimenting with it I faced with following issues:

  1. Why it should not be possible to create an event without to specify a version in the command? Other event-store libs like https://github.com/envato/event_sourcery provide the exact version match optionally.
  2. For every aggregate, we need to set the ID
    a.ID = event.AggregateID
    the same for
    event.AggregateID = c.AggregateID
    . This can be easily abstracted.

Btw: Are you using this lib in production? There is a lot of room for improvements (error handling in commandbus, retry-mechanism, graceful shutdown of connections, logging). From my understanding, this project is just a playground for you right?

I could solve most of the issues and implemented a SQL integration with https://gorm.io/. If anybody is interested in it I will take the time to create a PR against v2.

there is a v2 running on production for a medium size project, you can find this version under v2 branch, that includes better error handling

https://github.com/mishudark/eventhus/tree/v2

this branch contains the improved implementation that is planned to be released on Q1 2020

Hi @mishudark my points are still valid for v2.

  1. to create an event without a command aggregateID is possible, ie: CreateAccound should create an event with a new ID

  2. Error handling is done trough a failure.go impl, of course there is room for improvement on graceful shutdown, the idea is that failure should go to a bus, and developer should route this one to the appropriate place(s3, stackdriver, syslog, fluentd)

PR are welcome specially to add SQL support and error output handlers

  1. I think you're right I rechecked the code.
  2. I would handle it with an overall structured logging strategy.