In concurrent systems, domain events are typically handled asynchronously. In Go, a simple approach for asynchronous event handling can be implemented via channels, but the issue is that if something bad happens for handling an event, or worst, for the whole program, the event will be lost.
How asynchronous domain events can be handled properly in a Go program, i.e.:
- When an event handler fails, the event should not be purged from the event queue, in order to be handled properly in a later time.
- If the whole program goes down, the events have to be recovered and processed accordingly.