Documentation
¶
Overview ¶
Package message provides tools for manipulating Dogma messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Directions = []Direction{ InboundDirection, OutboundDirection, }
Directions is a slice of the valid message direcations.
var Roles = []Role{ CommandRole, EventRole, TimeoutRole, }
Roles is a slice of the valid message roles.
Functions ¶
func ToString ¶
ToString returns a string representation of m.
If m implements Stringer, it returns m.MessageString(). Otherwise, if m implements fmt.Stringer, it returns m.String().
Finally, if m does not implement either of these interfaces, it returns the standard Go "%v" representation of the message.
Types ¶
type Correlation ¶
type Correlation 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
}
Correlation is holds identifiers for a specific message.
func NewCorrelation ¶
func NewCorrelation(id string) Correlation
NewCorrelation returns a correlation for the "root" message with the given ID.
func (Correlation) IsCausedBy ¶
func (c Correlation) IsCausedBy(p Correlation) bool
IsCausedBy returns true if c.MessageID is directly caused by p.
func (Correlation) IsCorrelatedWith ¶
func (c Correlation) IsCorrelatedWith(p Correlation) bool
IsCorrelatedWith returns true if c.MessageID is correlated with p.
func (Correlation) IsRoot ¶
func (c Correlation) IsRoot() bool
IsRoot returns true if this message is the "root" of a message tree.
func (Correlation) MustValidate ¶
func (c Correlation) MustValidate()
MustValidate panics if c is not a valid correlation.
func (Correlation) New ¶
func (c Correlation) New(id string) Correlation
New returns a correlation for a message caused by c.MessageID.
type Direction ¶
type Direction string
Direction is an enumeration of the "direction" a message is flowing, relative to a handler.
func (Direction) MustValidate ¶
func (d Direction) MustValidate()
MustValidate panics if r is not a valid message direction.
type MetaData ¶
type MetaData struct {
Correlation Correlation
Type Type
Role Role
Direction Direction
}
MetaData is a container for common message meta-data .
type Role ¶
type Role string
Role is an enumeration of the roles a message can perform within an engine.
func (Role) Marker ¶
Marker returns a character that identifies the message role when displaying message types.
func (Role) MustValidate ¶
func (r Role) MustValidate()
MustValidate panics if r is not a valid message role.
type Stringer ¶
type Stringer interface {
// MessageString returns a human-readable description of the message.
MessageString() string
}
Stringer is an interface implemented by messages that can describe themselves.
It can be used to provide a more specific message description for message types that already implement fmt.Stringer, such as when the message implementations are generated Protocol Buffers structs.
type Type ¶
type Type interface {
// ReflectType returns the reflect.Type for this message type.
ReflectType() reflect.Type
// String returns a human-readable name for the message type.
// Note that this representation may not be globally unique.
String() string
}
Type is a value that identifies the type of a message.
type TypeSet ¶
type TypeSet map[Type]struct{}
TypeSet is a collection of distinct message types.
func NewTypeSet ¶
NewTypeSet returns a TypeSet containing the given types.
func (TypeSet) Add ¶
Add adds t to s.
It returns true if the type was added, or false if the set already contained the type.
func (TypeSet) AddM ¶
AddM adds TypeOf(m) to s.
It returns true if the type was added, or false if the set already contained the type.