Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶ added in v0.9.0
type Error struct { // Err is the error that happened when projecting the event. Err error // Saga is the saga where the error happened. Saga string }
Error is an error in the projector.
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler is a CQRS saga handler to run a Saga implementation.
func NewEventHandler ¶
func NewEventHandler(saga Saga, commandHandler eh.CommandHandler) *EventHandler
NewEventHandler creates a new EventHandler.
func (*EventHandler) HandleEvent ¶
HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface.
func (*EventHandler) HandlerType ¶ added in v0.4.0
func (h *EventHandler) HandlerType() eh.EventHandlerType
HandlerType implements the HandlerType method of the eventhorizon.EventHandler interface.
type Saga ¶
type Saga interface { // SagaType returns the type of the saga. SagaType() Type // RunSaga handles an event in the saga that can return commands. // If an error is returned from the saga, the event will be run again. RunSaga(context.Context, eh.Event, eh.CommandHandler) error }
Saga is an interface for a CQRS saga that listens to events and generate commands. It is used for any long lived transaction and can be used to react on multiple events.
Click to show internal directories.
Click to hide internal directories.