Version: v0.2.0 Latest Latest

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 3 Imported by: 0




This section is empty.


View Source
var ErrNilAggregateStore = errors.New("aggregate store is nil")

ErrNilAggregateStore is when a dispatcher is created with a nil aggregate store.


This section is empty.


type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields

CommandHandler dispatches commands to an aggregate.

The dispatch process is as follows: 1. The handler receives a command. 2. An aggregate is created or loaded using an aggregate store. 3. The aggregate's command handler is called. 4. The aggregate stores events in response to the command. 5. The new events are stored in the event store. 6. The events are published on the event bus after a successful store.

func NewCommandHandler

func NewCommandHandler(t eh.AggregateType, store eh.AggregateStore) (*CommandHandler, error)

NewCommandHandler creates a new CommandHandler for an aggregate type.

func (*CommandHandler) HandleCommand

func (h *CommandHandler) HandleCommand(ctx context.Context, cmd eh.Command) error

HandleCommand handles a command with the registered aggregate. Returns ErrAggregateNotFound if no aggregate could be found.

Jump to

Keyboard shortcuts

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