process

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package process provides an adaptor that exposes Dogma process message handlers as Verity handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct {
	// Identity is the handler's identity.
	Identity *envelopespec.Identity

	// Handler is the process message handler that implements the
	// application-specific message handling logic.
	Handler dogma.ProcessMessageHandler

	// Loader is used to load process instances into memory.
	Loader *Loader

	// Marshaler is used to marshal process instances.
	Marshaler marshalkit.ValueMarshaler

	// Cache is an in-memory cache of process instances.
	Cache cache.Cache

	// Queue is the message queue that stores pending timeout messages.
	Queue *queue.Queue

	// Packer is used to create new parcels for messages produced by the
	// handler.
	Packer *parcel.Packer

	// LoadTimeout is the timeout duration allowed while loading process
	// state.
	LoadTimeout time.Duration

	// Logger is the target for log messages produced within the handler.
	// If it is nil, logging.DefaultLogger is used.
	Logger logging.Logger
}

Adaptor exposes a dogma.ProcessMessageHandler as a handler.Handler.

func (*Adaptor) HandleMessage

func (a *Adaptor) HandleMessage(
	ctx context.Context,
	w handler.UnitOfWork,
	p parcel.Parcel,
) (err error)

HandleMessage handles the message in p.

type Instance

type Instance struct {
	persistence.ProcessInstance
	Root dogma.ProcessRoot
}

Instance is an in-memory representation of the process instance, as stored in the cache.

type Loader

type Loader struct {
	// Repository is the repository used to load process instances.
	Repository persistence.ProcessRepository

	// Marshaler is used to marshal/unmarshal process instances.
	Marshaler marshalkit.ValueMarshaler
}

Loader loads aggregate instances from their historical events.

func (*Loader) Load

func (l *Loader) Load(
	ctx context.Context,
	hk, id string,
	base dogma.ProcessRoot,
) (*Instance, error)

Load loads the aggregate instance with the given ID.

Jump to

Keyboard shortcuts

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