saga

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (h *EventHandler) HandleEvent(ctx context.Context, event eh.Event) error

HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface.

func (*EventHandler) HandlerType added in v0.5.1

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.
	RunSaga(context.Context, eh.Event) []eh.Command
}

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.

type Type

type Type string

Type is the type of a saga, used as its unique identifier.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL