controller

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package controller contains interfaces that the engine uses to consume controllers for each of the message handler types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertUnexpectedMessagePanic added in v0.7.0

func ConvertUnexpectedMessagePanic(
	h configkit.RichHandler,
	iface, method string,
	m dogma.Message,
	fn func(),
)

ConvertUnexpectedMessagePanic calls fn() and converts dogma.UnexpectedMessage values to an controller.UnexpectedMessage value to provide more context about the failure.

Types

type Controller

type Controller interface {
	// Identity returns the identity of the handler that is managed by this
	// controller.
	Identity() configkit.Identity

	// Type returns the name of the handler that is managed by this controller.
	Type() configkit.HandlerType

	// Tick instructs the controller to perform an implementation-defined
	// "tick".
	//
	// It returns the messages produced by the handler that need to be
	// dispatched by the engine.
	//
	// now is the current time, according to the engine, which may not match the
	// system time.
	Tick(
		ctx context.Context,
		obs fact.Observer,
		now time.Time,
	) ([]*envelope.Envelope, error)

	// Handle handles a message.
	//
	// It returns the messages produced by the handler that need to be
	// dispatched by the engine.
	//
	// now is the current time, according to the engine, which may not match the
	// system time.
	Handle(
		ctx context.Context,
		obs fact.Observer,
		now time.Time,
		env *envelope.Envelope,
	) ([]*envelope.Envelope, error)

	// Reset clears the state of the controller.
	Reset()
}

Controller orchestrates the handling of a message by Dogma message handler.

type UnexpectedMessage added in v0.7.0

type UnexpectedMessage struct {
	// Handler is the handler that panicked.
	Handler configkit.RichHandler

	// Interface is the name of the interface containing the method that the
	// controller called resulting in the panic.
	Interface string

	// Method is the name of the method that the controller called resulting in
	// the panic.
	Method string

	// Message is the message that caused the handler to panic.
	Message dogma.Message

	// PanicFunc is the name of the function that panicked, if known.
	PanicFunc string

	// PanicFile is the name of the file where the panic originated, if known.
	PanicFile string

	// PanicLine is the line number within the file where the panic originated,
	// if known.
	PanicLine int
}

UnexpectedMessage is a panic value that provides more context when a handler panics with a dogma.UnexpoectedMessage value.

Directories

Path Synopsis
Package aggregate provides engine components that handle messages that are routed to aggregate message handlers.
Package aggregate provides engine components that handle messages that are routed to aggregate message handlers.
Package integration provides engine components that handle messages that are routed to integration message handlers.
Package integration provides engine components that handle messages that are routed to integration message handlers.
Package process provides engine components that handle messages that are routed to process message handlers.
Package process provides engine components that handle messages that are routed to process message handlers.
Package projection provides engine components that handle messages that are routed to projection message handlers.
Package projection provides engine components that handle messages that are routed to projection message handlers.

Jump to

Keyboard shortcuts

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