envelope

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package envelope provides a container for passing Dogma messages and their meta-data between components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	// MessageID is a unique identifier for the message.
	MessageID string

	// CausationID is the ID of the message that was being handled when the
	// message identified by MessageID was produced.
	CausationID string

	// CorrelationID is the ID of the "root" message that entered the
	// application to cause the message identified by MessageID, either directly
	// or indirectly.
	CorrelationID string

	// Message is the application-defined message that the envelope represents.
	Message dogma.Message

	// Type is the type of the message.
	Type message.Type

	// Role is the message's role.
	Role message.Role

	// CreatedAt is the time at which the message was created.
	CreatedAt time.Time

	// ScheduledFor holds the time at which a timeout message is scheduled to
	// occur. Its value is undefined unless Role is message.TimeoutRole.
	ScheduledFor time.Time

	// Origin describes the message handler that produced this message.
	// It is nil if the message was not produced by a handler.
	Origin *Origin
}

Envelope is a container for a message that is handled by the test engine.

func NewCommand

func NewCommand(
	id string,
	m dogma.Message,
	t time.Time,
) *Envelope

NewCommand constructs a new envelope containing the given command message.

t is the time at which the message was created.

func NewEvent

func NewEvent(
	id string,
	m dogma.Message,
	t time.Time,
) *Envelope

NewEvent constructs a new envelope containing the given event message.

t is the time at which the message was created.

func (*Envelope) NewCommand

func (e *Envelope) NewCommand(
	id string,
	m dogma.Message,
	t time.Time,
	o Origin,
) *Envelope

NewCommand constructs a new envelope as a child of e, indicating that the command message m is caused by e.Message.

t is the time at which the message was created.

func (*Envelope) NewEvent

func (e *Envelope) NewEvent(
	id string,
	m dogma.Message,
	t time.Time,
	o Origin,
) *Envelope

NewEvent constructs a new envelope as a child of e, indicating that the event message m is caused by e.Message.

t is the time at which the message was created.

func (*Envelope) NewTimeout

func (e *Envelope) NewTimeout(
	id string,
	m dogma.Message,
	t time.Time,
	s time.Time,
	o Origin,
) *Envelope

NewTimeout constructs a new envelope as a child of e, indicating that the timeout message m is caused by e.Message.

t is the time at which the message was created. s is the time at which the timeout is scheduled to occur.

type MessageIDGenerator

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

MessageIDGenerator produces sequential message IDs.

func (*MessageIDGenerator) Next

func (g *MessageIDGenerator) Next() string

Next returns the next ID in the sequence.

func (*MessageIDGenerator) Reset

func (g *MessageIDGenerator) Reset()

Reset resets the generator to begin at one (1) again.

type Origin

type Origin struct {
	// HandlerName is the name of the handler that produced this message.
	HandlerName string

	// HandlerType is the type of the handler that produced this message.
	HandlerType configkit.HandlerType

	// InstanceID is the ID of the aggregate or process instance that produced
	// this message.
	//
	// It is empty if HandlerType is neither configkit.AggregateHandlerType nor
	// configkit.ProcessHandlerType.
	InstanceID string
}

Origin describes the handler that produced a message in an envelope.

Jump to

Keyboard shortcuts

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