execution

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor func(execCtx MessageExecutionCtx) error

Executor is a callback that will be called on received message with context. it should return an error only if internal server error happened, in case of business errors it's best to send a failure event.

type MessageExecutionCtx

type MessageExecutionCtx interface {
	// Message returns received message
	Message() *message.ReceivedMessage
	// Context returns parent execution context. Each message has own time limit in which it must be processed.
	Context() context.Context
	// Valid Deprecated
	Valid() bool
	// Send sends an out coming message to registered endpoints
	Send(message *message.OutcomingMessage, options ...endpoint.DeliveryOption) error
	// Return sends received message to registered endpoints and updates number of returns in headers
	Return(options ...endpoint.DeliveryOption) error
	// Logger returns logger instance with traceId and message uid included as fields
	Logger() log.Logger
}

MessageExecutionCtx is passed to each executor and contains received message, ctx, knows how to send out or return a message.

type MessageExecutionCtxFactory

type MessageExecutionCtxFactory interface {
	CreateCtx(ctx context.Context, message *message.ReceivedMessage) MessageExecutionCtx
}

func NewMessageExecutionCtxFactory

func NewMessageExecutionCtxFactory(router endpoint.Router, logger log.Logger) MessageExecutionCtxFactory

Jump to

Keyboard shortcuts

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