bus

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHandlerAlreadySet is when a handler is already registered for a command.
	ErrHandlerAlreadySet = errors.New("handler is already set")
	// ErrHandlerNotFound is when no handler can be found.
	ErrHandlerNotFound = errors.New("no handlers for command")
)

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields
}

CommandHandler is a command handler that handles commands by routing to the registered CommandHandlers.

func NewCommandHandler

func NewCommandHandler() *CommandHandler

NewCommandHandler creates a CommandHandler.

func (*CommandHandler) HandleCommand

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

HandleCommand handles a command with a handler capable of handling it.

func (*CommandHandler) SetHandler

func (h *CommandHandler) SetHandler(handler eh.CommandHandler, cmdType eh.CommandType) error

SetHandler adds a handler for a specific command.

Jump to

Keyboard shortcuts

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