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 {
message.Correlation
// 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 ¶
NewCommand constructs a new envelope containing the given command message.
t is the time at which the message was created.
func NewEvent ¶
NewEvent constructs a new envelope containing the given event message.
t is the time at which the message was created.
func (*Envelope) NewCommand ¶
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 ¶
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 handler.Type
// InstanceID is the ID of the aggregate or process instance that
// produced this message.
//
// It is empty if HandlerType is neither handler.AggregateType nor
// handler.ProcessType.
InstanceID string
}
Origin describes the hanlder that produced a message in an envelope.