Help us shape the future of Go! Take the 2026 Go Developer Survey

handler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package handler provides utilities for working with Dogma message handlers.

Index

Constants

This section is empty.

Variables

Types is a slice of the valid handler types.

Functions

This section is empty.

Types

type EmptyInstanceIDError

type EmptyInstanceIDError struct {
	HandlerName string
	HandlerType Type
}

EmptyInstanceIDError indicates that an aggregate or process message handler has attempted to route a message to an instance with an empty ID.

func (EmptyInstanceIDError) Error

func (e EmptyInstanceIDError) Error() string

type EventNotRecordedError

type EventNotRecordedError struct {
	HandlerName  string
	InstanceID   string
	WasDestroyed bool
}

EventNotRecordedError indicates that an aggregate instance was created or destroyed without recording an event.

func (EventNotRecordedError) Error

func (e EventNotRecordedError) Error() string

type NilRootError

type NilRootError struct {
	HandlerName string
	HandlerType Type
}

NilRootError indicates that an aggregate or process message handler has returned a nil "root" value from its New() method.

func (NilRootError) Error

func (e NilRootError) Error() string

type Type

type Type string

Type is an enumeration of the types of handlers.

const (
	// AggregateType is the handler type for dogma.AggregateMessageHandler.
	AggregateType Type = "aggregate"

	// ProcessType is the handler type for dogma.ProcessMessageHandler.
	ProcessType Type = "process"

	// IntegrationType is the handler type for dogma.IntegrationMessageHandler.
	IntegrationType Type = "integration"

	// ProjectionType is the handler type for dogma.ProjectionMessageHandler.
	ProjectionType Type = "projection"
)

func ConsumersOf

func ConsumersOf(r message.Role) []Type

ConsumersOf returns the handler types that can consume messages with the given role.

func ProducersOf

func ProducersOf(r message.Role) []Type

ProducersOf returns the handler types that can produces messages with the given role.

func (Type) Consumes

func (t Type) Consumes() []message.Role

Consumes returns the roles of messages that can be consumed by handlers of this type.

func (Type) Is

func (t Type) Is(types ...Type) bool

Is returns true if t is one of the given types.

func (Type) IsConsumerOf

func (t Type) IsConsumerOf(r message.Role) bool

IsConsumerOf returns true if handlers of type t can consume messages with the given role.

func (Type) IsProducerOf

func (t Type) IsProducerOf(r message.Role) bool

IsProducerOf returns true if handlers of type t can produce messages with the given role.

func (Type) MustBe

func (t Type) MustBe(types ...Type)

MustBe panics if t is not one of the given types.

func (Type) MustNotBe

func (t Type) MustNotBe(types ...Type)

MustNotBe panics if t is one of the given types.

func (Type) MustValidate

func (t Type) MustValidate()

MustValidate panics if r is not a valid message role.

func (Type) Produces

func (t Type) Produces() []message.Role

Produces returns the roles of messages that can be produced by handlers of this type.

func (Type) ShortString

func (t Type) ShortString() string

ShortString returns a short (3-character) representation of the handler type.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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