Documentation
¶
Overview ¶
Package envelopepb provides the "well-known" Envelope type for representing message envelopes as Protocol Buffers messages.
Index ¶
- Variables
- func Unpack(env *Envelope) (dogma.Message, error)
- func WithBaggage(x proto.Message) interface{ ... }
- func WithExtension(x proto.Message) interface{ ... }
- type Body
- func (x *Body) ClearCreatedAt()
- func (x *Body) ClearMessage()
- func (x *Body) ClearMessageId()
- func (x *Body) ClearScheduledFor()
- func (x *Body) GetBaggage() []*anypb.Any
- func (x *Body) GetCreatedAt() *timestamppb.Timestamp
- func (x *Body) GetExtensions() []*anypb.Any
- func (x *Body) GetIdempotencyKey() string
- func (x *Body) GetMessage() *Message
- func (x *Body) GetMessageId() *uuidpb.UUID
- func (x *Body) GetScheduledFor() *timestamppb.Timestamp
- func (x *Body) HasCreatedAt() bool
- func (x *Body) HasMessage() bool
- func (x *Body) HasMessageId() bool
- func (x *Body) HasScheduledFor() bool
- func (x *Body) MarshalBinary() ([]byte, error)
- func (*Body) ProtoMessage()
- func (x *Body) ProtoReflect() protoreflect.Message
- func (x *Body) Reset()
- func (x *Body) SetBaggage(v []*anypb.Any)
- func (x *Body) SetCreatedAt(v *timestamppb.Timestamp)
- func (x *Body) SetExtensions(v []*anypb.Any)
- func (x *Body) SetIdempotencyKey(v string)
- func (x *Body) SetMessage(v *Message)
- func (x *Body) SetMessageId(v *uuidpb.UUID)
- func (x *Body) SetScheduledFor(v *timestamppb.Timestamp)
- func (x *Body) String() string
- func (x *Body) UnmarshalBinary(data []byte) error
- type BodyBuilder
- func (b *BodyBuilder) Build() *Body
- func (b *BodyBuilder) From(x *Body) *BodyBuilder
- func (b *BodyBuilder) WithBaggage(v []*anypb.Any) *BodyBuilder
- func (b *BodyBuilder) WithCreatedAt(v *timestamppb.Timestamp) *BodyBuilder
- func (b *BodyBuilder) WithExtensions(v []*anypb.Any) *BodyBuilder
- func (b *BodyBuilder) WithIdempotencyKey(v string) *BodyBuilder
- func (b *BodyBuilder) WithMessage(v *Message) *BodyBuilder
- func (b *BodyBuilder) WithMessageId(v *uuidpb.UUID) *BodyBuilder
- func (b *BodyBuilder) WithScheduledFor(v *timestamppb.Timestamp) *BodyBuilder
- type Body_builder
- type EffectPacker
- func (p *EffectPacker) PackCommand(m dogma.Command, options ...PackEffectCommandOption)
- func (p *EffectPacker) PackEvent(m dogma.Event, options ...PackEffectEventOption)
- func (p *EffectPacker) PackTimeout(m dogma.Timeout, options ...PackEffectTimeoutOption)
- func (p *EffectPacker) Seal() (*MultiEnvelope, bool)
- type Envelope
- func (x *Envelope) ClearBody()
- func (x *Envelope) ClearHeader()
- func (x *Envelope) GetBody() *Body
- func (x *Envelope) GetHeader() *Header
- func (x *Envelope) HasBody() bool
- func (x *Envelope) HasHeader() bool
- func (x *Envelope) MarshalBinary() ([]byte, error)
- func (*Envelope) ProtoMessage()
- func (x *Envelope) ProtoReflect() protoreflect.Message
- func (x *Envelope) Reset()
- func (x *Envelope) SetBody(v *Body)
- func (x *Envelope) SetHeader(v *Header)
- func (x *Envelope) String() string
- func (x *Envelope) UnmarshalBinary(data []byte) error
- func (x *Envelope) Validate() error
- type EnvelopeBuilder
- type Envelope_builder
- type Header
- func (x *Header) ClearCausationId()
- func (x *Header) ClearCorrelationId()
- func (x *Header) ClearSource()
- func (x *Header) GetBaggage() []*anypb.Any
- func (x *Header) GetCausationId() *uuidpb.UUID
- func (x *Header) GetCorrelationId() *uuidpb.UUID
- func (x *Header) GetExtensions() []*anypb.Any
- func (x *Header) GetSource() *Source
- func (x *Header) HasCausationId() bool
- func (x *Header) HasCorrelationId() bool
- func (x *Header) HasSource() bool
- func (x *Header) MarshalBinary() ([]byte, error)
- func (*Header) ProtoMessage()
- func (x *Header) ProtoReflect() protoreflect.Message
- func (x *Header) Reset()
- func (x *Header) SetBaggage(v []*anypb.Any)
- func (x *Header) SetCausationId(v *uuidpb.UUID)
- func (x *Header) SetCorrelationId(v *uuidpb.UUID)
- func (x *Header) SetExtensions(v []*anypb.Any)
- func (x *Header) SetSource(v *Source)
- func (x *Header) String() string
- func (x *Header) UnmarshalBinary(data []byte) error
- type HeaderBuilder
- func (b *HeaderBuilder) Build() *Header
- func (b *HeaderBuilder) From(x *Header) *HeaderBuilder
- func (b *HeaderBuilder) WithBaggage(v []*anypb.Any) *HeaderBuilder
- func (b *HeaderBuilder) WithCausationId(v *uuidpb.UUID) *HeaderBuilder
- func (b *HeaderBuilder) WithCorrelationId(v *uuidpb.UUID) *HeaderBuilder
- func (b *HeaderBuilder) WithExtensions(v []*anypb.Any) *HeaderBuilder
- func (b *HeaderBuilder) WithSource(v *Source) *HeaderBuilder
- type Header_builder
- type Message
- func (x *Message) ClearTypeId()
- func (x *Message) GetData() []byte
- func (x *Message) GetDescription() string
- func (x *Message) GetTypeId() *uuidpb.UUID
- func (x *Message) HasTypeId() bool
- func (x *Message) MarshalBinary() ([]byte, error)
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) SetData(v []byte)
- func (x *Message) SetDescription(v string)
- func (x *Message) SetTypeId(v *uuidpb.UUID)
- func (x *Message) String() string
- func (x *Message) UnmarshalBinary(data []byte) error
- type MessageBuilder
- type Message_builder
- type MultiEnvelope
- func (x *MultiEnvelope) ClearHeader()
- func (x *MultiEnvelope) GetBodies() []*Body
- func (x *MultiEnvelope) GetHeader() *Header
- func (x *MultiEnvelope) HasHeader() bool
- func (x *MultiEnvelope) MarshalBinary() ([]byte, error)
- func (*MultiEnvelope) ProtoMessage()
- func (x *MultiEnvelope) ProtoReflect() protoreflect.Message
- func (x *MultiEnvelope) Reset()
- func (x *MultiEnvelope) SetBodies(v []*Body)
- func (x *MultiEnvelope) SetHeader(v *Header)
- func (x *MultiEnvelope) String() string
- func (x *MultiEnvelope) UnmarshalBinary(data []byte) error
- func (x *MultiEnvelope) Validate() error
- type MultiEnvelopeBuilder
- type MultiEnvelope_builder
- type PackCommandOption
- type PackEffectCommandOption
- type PackEffectEventOption
- type PackEffectTimeoutOption
- type PackEffectsOption
- type Packer
- type Source
- func (x *Source) ClearApplication()
- func (x *Source) ClearHandler()
- func (x *Source) ClearSite()
- func (x *Source) GetApplication() *identitypb.Identity
- func (x *Source) GetHandler() *identitypb.Identity
- func (x *Source) GetInstanceId() string
- func (x *Source) GetSite() *identitypb.Identity
- func (x *Source) HasApplication() bool
- func (x *Source) HasHandler() bool
- func (x *Source) HasSite() bool
- func (x *Source) MarshalBinary() ([]byte, error)
- func (*Source) ProtoMessage()
- func (x *Source) ProtoReflect() protoreflect.Message
- func (x *Source) Reset()
- func (x *Source) SetApplication(v *identitypb.Identity)
- func (x *Source) SetHandler(v *identitypb.Identity)
- func (x *Source) SetInstanceId(v string)
- func (x *Source) SetSite(v *identitypb.Identity)
- func (x *Source) String() string
- func (x *Source) UnmarshalBinary(data []byte) error
- type SourceBuilder
- func (b *SourceBuilder) Build() *Source
- func (b *SourceBuilder) From(x *Source) *SourceBuilder
- func (b *SourceBuilder) WithApplication(v *identitypb.Identity) *SourceBuilder
- func (b *SourceBuilder) WithHandler(v *identitypb.Identity) *SourceBuilder
- func (b *SourceBuilder) WithInstanceId(v string) *SourceBuilder
- func (b *SourceBuilder) WithSite(v *identitypb.Identity) *SourceBuilder
- type Source_builder
Constants ¶
This section is empty.
Variables ¶
var File_github_com_dogmatiq_enginekit_protobuf_envelopepb_envelope_proto protoreflect.FileDescriptor
Functions ¶
func Unpack ¶ added in v0.19.0
Unpack returns the message contained within an envelope. TODO: Make `UnpackCommand`, etc.
func WithBaggage ¶ added in v0.22.0
func WithBaggage(x proto.Message) interface { PackCommandOption PackEffectsOption PackEffectCommandOption PackEffectEventOption PackEffectTimeoutOption }
WithBaggage adds x to the envelope's baggage.
Baggage applies to the envelope being packed and is inherited by downstream messages in the causal chain.
func WithExtension ¶ added in v0.22.0
func WithExtension(x proto.Message) interface { PackCommandOption PackEffectsOption PackEffectCommandOption PackEffectEventOption PackEffectTimeoutOption }
WithExtension adds x to the envelope's extensions.
Extensions apply only to the envelope being packed; they are not inherited by downstream messages in the causal chain.
Types ¶
type Body ¶ added in v0.21.0
type Body struct {
// contains filtered or unexported fields
}
Body contains the metadata and encoded form of a single message in an Envelope or MultiEnvelope.
func (*Body) ClearCreatedAt ¶ added in v0.23.0
func (x *Body) ClearCreatedAt()
func (*Body) ClearMessage ¶ added in v0.23.0
func (x *Body) ClearMessage()
func (*Body) ClearMessageId ¶ added in v0.23.0
func (x *Body) ClearMessageId()
func (*Body) ClearScheduledFor ¶ added in v0.23.0
func (x *Body) ClearScheduledFor()
func (*Body) GetBaggage ¶ added in v0.22.0
func (*Body) GetCreatedAt ¶ added in v0.21.0
func (x *Body) GetCreatedAt() *timestamppb.Timestamp
func (*Body) GetExtensions ¶ added in v0.21.0
func (*Body) GetIdempotencyKey ¶ added in v0.21.0
func (*Body) GetMessage ¶ added in v0.21.0
func (*Body) GetMessageId ¶ added in v0.21.0
func (*Body) GetScheduledFor ¶ added in v0.21.0
func (x *Body) GetScheduledFor() *timestamppb.Timestamp
func (*Body) HasCreatedAt ¶ added in v0.23.0
func (*Body) HasMessage ¶ added in v0.23.0
func (*Body) HasMessageId ¶ added in v0.23.0
func (*Body) HasScheduledFor ¶ added in v0.23.0
func (*Body) MarshalBinary ¶ added in v0.21.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Body to implement encoding.BinaryMarshaler.
func (*Body) ProtoMessage ¶ added in v0.21.0
func (*Body) ProtoMessage()
func (*Body) ProtoReflect ¶ added in v0.21.0
func (x *Body) ProtoReflect() protoreflect.Message
func (*Body) SetBaggage ¶ added in v0.22.0
func (*Body) SetCreatedAt ¶ added in v0.21.0
func (x *Body) SetCreatedAt(v *timestamppb.Timestamp)
func (*Body) SetExtensions ¶ added in v0.21.0
func (*Body) SetIdempotencyKey ¶ added in v0.21.0
func (*Body) SetMessage ¶ added in v0.21.0
func (*Body) SetMessageId ¶ added in v0.21.0
func (*Body) SetScheduledFor ¶ added in v0.21.0
func (x *Body) SetScheduledFor(v *timestamppb.Timestamp)
func (*Body) UnmarshalBinary ¶ added in v0.21.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Body to implement encoding.BinaryUnmarshaler.
type BodyBuilder ¶ added in v0.21.0
type BodyBuilder struct {
// contains filtered or unexported fields
}
func NewBodyBuilder ¶ added in v0.21.0
func NewBodyBuilder() *BodyBuilder
NewBodyBuilder returns a builder that constructs Body messages.
func (*BodyBuilder) Build ¶ added in v0.21.0
func (b *BodyBuilder) Build() *Body
Build returns a new Body containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*BodyBuilder) From ¶ added in v0.21.0
func (b *BodyBuilder) From(x *Body) *BodyBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*BodyBuilder) WithBaggage ¶ added in v0.22.0
func (b *BodyBuilder) WithBaggage(v []*anypb.Any) *BodyBuilder
WithBaggage configures the builder to set the Baggage field to v, then returns b.
func (*BodyBuilder) WithCreatedAt ¶ added in v0.21.0
func (b *BodyBuilder) WithCreatedAt(v *timestamppb.Timestamp) *BodyBuilder
WithCreatedAt configures the builder to set the CreatedAt field to v, then returns b.
func (*BodyBuilder) WithExtensions ¶ added in v0.21.0
func (b *BodyBuilder) WithExtensions(v []*anypb.Any) *BodyBuilder
WithExtensions configures the builder to set the Extensions field to v, then returns b.
func (*BodyBuilder) WithIdempotencyKey ¶ added in v0.21.0
func (b *BodyBuilder) WithIdempotencyKey(v string) *BodyBuilder
WithIdempotencyKey configures the builder to set the IdempotencyKey field to v, then returns b.
func (*BodyBuilder) WithMessage ¶ added in v0.21.0
func (b *BodyBuilder) WithMessage(v *Message) *BodyBuilder
WithMessage configures the builder to set the Message field to v, then returns b.
func (*BodyBuilder) WithMessageId ¶ added in v0.21.0
func (b *BodyBuilder) WithMessageId(v *uuidpb.UUID) *BodyBuilder
WithMessageId configures the builder to set the MessageId field to v, then returns b.
func (*BodyBuilder) WithScheduledFor ¶ added in v0.21.0
func (b *BodyBuilder) WithScheduledFor(v *timestamppb.Timestamp) *BodyBuilder
WithScheduledFor configures the builder to set the ScheduledFor field to v, then returns b.
type Body_builder ¶ added in v0.23.0
type Body_builder struct {
// MessageId is a unique identifier for the message in this envelope.
MessageId *uuidpb.UUID
// IdempotencyKey is an application-defined value used to identify a command
// across retries.
//
// It is the zero-value if the message is not a command, or if the producer
// of the message did not provide an idempotency key.
IdempotencyKey string
// CreatedAt is the time at which the envelope was created.
//
// This is typically the point at which the message first enters the engine.
CreatedAt *timestamppb.Timestamp
// ScheduledFor is the time at which a timeout message is scheduled to occur.
//
// It is the zero-value if the message is a command or event.
ScheduledFor *timestamppb.Timestamp
// Message is the encoded representation of the [dogma.Message].
Message *Message
// Extensions is a set of extension values associated with this message.
//
// Any values in [Header.Extensions] are overridden by values in this field
// that have the same type URL.
Extensions []*anypb.Any
// Baggage is a set of extension values associated with this message and/or
// its causal chain.
//
// Any values in [Header.Baggage] are overridden by values in this field
// that have the same type URL.
Baggage []*anypb.Any
// contains filtered or unexported fields
}
func (Body_builder) Build ¶ added in v0.23.0
func (b0 Body_builder) Build() *Body
type EffectPacker ¶ added in v0.22.0
type EffectPacker struct {
// contains filtered or unexported fields
}
An EffectPacker packs messages produced while handling a specific causal message into a MultiEnvelope.
func (*EffectPacker) PackCommand ¶ added in v0.22.0
func (p *EffectPacker) PackCommand(m dogma.Command, options ...PackEffectCommandOption)
PackCommand appends m to the multi-envelope under construction.
func (*EffectPacker) PackEvent ¶ added in v0.22.0
func (p *EffectPacker) PackEvent(m dogma.Event, options ...PackEffectEventOption)
PackEvent appends m to the multi-envelope under construction.
func (*EffectPacker) PackTimeout ¶ added in v0.22.0
func (p *EffectPacker) PackTimeout(m dogma.Timeout, options ...PackEffectTimeoutOption)
PackTimeout appends m to the multi-envelope under construction.
func (*EffectPacker) Seal ¶ added in v0.22.0
func (p *EffectPacker) Seal() (*MultiEnvelope, bool)
Seal returns a MultiEnvelope containing all packed messages, or false if no messages were packed.
type Envelope ¶
type Envelope struct {
// contains filtered or unexported fields
}
Envelope is a container for a Dogma message and its meta-data.
It is wire-compatible with MultiEnvelope.
func (*Envelope) ClearHeader ¶ added in v0.23.0
func (x *Envelope) ClearHeader()
func (*Envelope) MarshalBinary ¶ added in v0.18.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Envelope to implement encoding.BinaryMarshaler.
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
func (*Envelope) UnmarshalBinary ¶ added in v0.18.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Envelope to implement encoding.BinaryUnmarshaler.
func (*Envelope) Validate ¶
Validate returns an error if x is not well-formed.
Well-formedness means that all compulsory fields are populated and that no incompatible fields are populated.
It is intentionally fairly permissive, so that message meta-data can be obtained even if the message is unable to be handled.
It does not perform "deep" validation, such as ensuring messages, times, etc can be unmarshaled.
type EnvelopeBuilder ¶
type EnvelopeBuilder struct {
// contains filtered or unexported fields
}
func NewEnvelopeBuilder ¶
func NewEnvelopeBuilder() *EnvelopeBuilder
NewEnvelopeBuilder returns a builder that constructs Envelope messages.
func (*EnvelopeBuilder) Build ¶
func (b *EnvelopeBuilder) Build() *Envelope
Build returns a new Envelope containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*EnvelopeBuilder) From ¶
func (b *EnvelopeBuilder) From(x *Envelope) *EnvelopeBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*EnvelopeBuilder) WithBody ¶ added in v0.21.0
func (b *EnvelopeBuilder) WithBody(v *Body) *EnvelopeBuilder
WithBody configures the builder to set the Body field to v, then returns b.
func (*EnvelopeBuilder) WithHeader ¶ added in v0.21.0
func (b *EnvelopeBuilder) WithHeader(v *Header) *EnvelopeBuilder
WithHeader configures the builder to set the Header field to v, then returns b.
type Envelope_builder ¶ added in v0.23.0
type Envelope_builder struct {
Header *Header
Body *Body
// contains filtered or unexported fields
}
func (Envelope_builder) Build ¶ added in v0.23.0
func (b0 Envelope_builder) Build() *Envelope
type Header ¶ added in v0.21.0
type Header struct {
// contains filtered or unexported fields
}
func (*Header) ClearCausationId ¶ added in v0.23.0
func (x *Header) ClearCausationId()
func (*Header) ClearCorrelationId ¶ added in v0.23.0
func (x *Header) ClearCorrelationId()
func (*Header) ClearSource ¶ added in v0.23.0
func (x *Header) ClearSource()
func (*Header) GetBaggage ¶ added in v0.22.0
func (*Header) GetCausationId ¶ added in v0.21.0
func (*Header) GetCorrelationId ¶ added in v0.21.0
func (*Header) GetExtensions ¶ added in v0.21.0
func (*Header) HasCausationId ¶ added in v0.23.0
func (*Header) HasCorrelationId ¶ added in v0.23.0
func (*Header) MarshalBinary ¶ added in v0.21.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Header to implement encoding.BinaryMarshaler.
func (*Header) ProtoMessage ¶ added in v0.21.0
func (*Header) ProtoMessage()
func (*Header) ProtoReflect ¶ added in v0.21.0
func (x *Header) ProtoReflect() protoreflect.Message
func (*Header) SetBaggage ¶ added in v0.22.0
func (*Header) SetCausationId ¶ added in v0.21.0
func (*Header) SetCorrelationId ¶ added in v0.21.0
func (*Header) SetExtensions ¶ added in v0.21.0
func (*Header) UnmarshalBinary ¶ added in v0.21.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Header to implement encoding.BinaryUnmarshaler.
type HeaderBuilder ¶ added in v0.21.0
type HeaderBuilder struct {
// contains filtered or unexported fields
}
func NewHeaderBuilder ¶ added in v0.21.0
func NewHeaderBuilder() *HeaderBuilder
NewHeaderBuilder returns a builder that constructs Header messages.
func (*HeaderBuilder) Build ¶ added in v0.21.0
func (b *HeaderBuilder) Build() *Header
Build returns a new Header containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*HeaderBuilder) From ¶ added in v0.21.0
func (b *HeaderBuilder) From(x *Header) *HeaderBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*HeaderBuilder) WithBaggage ¶ added in v0.22.0
func (b *HeaderBuilder) WithBaggage(v []*anypb.Any) *HeaderBuilder
WithBaggage configures the builder to set the Baggage field to v, then returns b.
func (*HeaderBuilder) WithCausationId ¶ added in v0.21.0
func (b *HeaderBuilder) WithCausationId(v *uuidpb.UUID) *HeaderBuilder
WithCausationId configures the builder to set the CausationId field to v, then returns b.
func (*HeaderBuilder) WithCorrelationId ¶ added in v0.21.0
func (b *HeaderBuilder) WithCorrelationId(v *uuidpb.UUID) *HeaderBuilder
WithCorrelationId configures the builder to set the CorrelationId field to v, then returns b.
func (*HeaderBuilder) WithExtensions ¶ added in v0.21.0
func (b *HeaderBuilder) WithExtensions(v []*anypb.Any) *HeaderBuilder
WithExtensions configures the builder to set the Extensions field to v, then returns b.
func (*HeaderBuilder) WithSource ¶ added in v0.21.0
func (b *HeaderBuilder) WithSource(v *Source) *HeaderBuilder
WithSource configures the builder to set the Source field to v, then returns b.
type Header_builder ¶ added in v0.23.0
type Header_builder struct {
// CausationId is the (optional) ID of the message that was the direct cause
// of the messages.
//
// If it is the zero-value, the messages were not caused by any other
// message.
CausationId *uuidpb.UUID
// CorrelationId is the (optional) ID of the first ancestor of the messages
// that was itself not caused by another message, that is, it's the root of
// the message chain that ultimately resulted in these messages.
//
// If it is the zero-value, the messages were not caused by any other
// message.
CorrelationId *uuidpb.UUID
// Source identifies the origin of the messages.
Source *Source
// Extensions is a set of extension values associated with the messages,
// their causal chain, or the envelope itself.
Extensions []*anypb.Any
// Baggage is a set of extension values that are propagated through the
// entire causal chain of messages.
Baggage []*anypb.Any
// contains filtered or unexported fields
}
func (Header_builder) Build ¶ added in v0.23.0
func (b0 Header_builder) Build() *Header
type Message ¶ added in v0.21.0
type Message struct {
// contains filtered or unexported fields
}
Message is the serialized representation of a dogma.Message.
func (*Message) ClearTypeId ¶ added in v0.23.0
func (x *Message) ClearTypeId()
func (*Message) GetDescription ¶ added in v0.21.0
func (*Message) MarshalBinary ¶ added in v0.21.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Message to implement encoding.BinaryMarshaler.
func (*Message) ProtoMessage ¶ added in v0.21.0
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶ added in v0.21.0
func (x *Message) ProtoReflect() protoreflect.Message
func (*Message) SetDescription ¶ added in v0.21.0
func (*Message) UnmarshalBinary ¶ added in v0.21.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Message to implement encoding.BinaryUnmarshaler.
type MessageBuilder ¶ added in v0.21.0
type MessageBuilder struct {
// contains filtered or unexported fields
}
func NewMessageBuilder ¶ added in v0.21.0
func NewMessageBuilder() *MessageBuilder
NewMessageBuilder returns a builder that constructs Message messages.
func (*MessageBuilder) Build ¶ added in v0.21.0
func (b *MessageBuilder) Build() *Message
Build returns a new Message containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*MessageBuilder) From ¶ added in v0.21.0
func (b *MessageBuilder) From(x *Message) *MessageBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*MessageBuilder) WithData ¶ added in v0.21.0
func (b *MessageBuilder) WithData(v []byte) *MessageBuilder
WithData configures the builder to set the Data field to v, then returns b.
func (*MessageBuilder) WithDescription ¶ added in v0.21.0
func (b *MessageBuilder) WithDescription(v string) *MessageBuilder
WithDescription configures the builder to set the Description field to v, then returns b.
func (*MessageBuilder) WithTypeId ¶ added in v0.21.0
func (b *MessageBuilder) WithTypeId(v *uuidpb.UUID) *MessageBuilder
WithTypeId configures the builder to set the TypeId field to v, then returns b.
type Message_builder ¶ added in v0.23.0
type Message_builder struct {
// TypeId is a unique identifier for the type of message, as per the Dogma
// message type registry.
TypeId *uuidpb.UUID
// Description is a human-readable description of the message, as returned by
// the [dogma.Message.MessageDescription] method.
Description string
// Data is the binary message data obtained by calling
// [dogma.Message.MarshalBinary] on the message.
Data []byte
// contains filtered or unexported fields
}
func (Message_builder) Build ¶ added in v0.23.0
func (b0 Message_builder) Build() *Message
type MultiEnvelope ¶ added in v0.21.0
type MultiEnvelope struct {
// contains filtered or unexported fields
}
MultiEnvelope is an efficient encoding of an ordered sequence of Envelope values that share common header context.
func (*MultiEnvelope) ClearHeader ¶ added in v0.23.0
func (x *MultiEnvelope) ClearHeader()
func (*MultiEnvelope) GetBodies ¶ added in v0.21.0
func (x *MultiEnvelope) GetBodies() []*Body
func (*MultiEnvelope) GetHeader ¶ added in v0.21.0
func (x *MultiEnvelope) GetHeader() *Header
func (*MultiEnvelope) HasHeader ¶ added in v0.23.0
func (x *MultiEnvelope) HasHeader() bool
func (*MultiEnvelope) MarshalBinary ¶ added in v0.21.0
func (x *MultiEnvelope) MarshalBinary() ([]byte, error)
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *MultiEnvelope to implement encoding.BinaryMarshaler.
func (*MultiEnvelope) ProtoMessage ¶ added in v0.21.0
func (*MultiEnvelope) ProtoMessage()
func (*MultiEnvelope) ProtoReflect ¶ added in v0.21.0
func (x *MultiEnvelope) ProtoReflect() protoreflect.Message
func (*MultiEnvelope) Reset ¶ added in v0.21.0
func (x *MultiEnvelope) Reset()
func (*MultiEnvelope) SetBodies ¶ added in v0.21.0
func (x *MultiEnvelope) SetBodies(v []*Body)
func (*MultiEnvelope) SetHeader ¶ added in v0.21.0
func (x *MultiEnvelope) SetHeader(v *Header)
func (*MultiEnvelope) String ¶ added in v0.21.0
func (x *MultiEnvelope) String() string
func (*MultiEnvelope) UnmarshalBinary ¶ added in v0.21.0
func (x *MultiEnvelope) UnmarshalBinary(data []byte) error
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *MultiEnvelope to implement encoding.BinaryUnmarshaler.
func (*MultiEnvelope) Validate ¶ added in v0.21.0
func (x *MultiEnvelope) Validate() error
Validate returns an error if x is not well-formed.
Well-formedness means that all compulsory fields are populated and that no incompatible fields are populated.
It is intentionally fairly permissive, so that message meta-data can be obtained even if the message is unable to be handled.
It does not perform "deep" validation, such as ensuring messages, times, etc can be unmarshaled.
type MultiEnvelopeBuilder ¶ added in v0.21.0
type MultiEnvelopeBuilder struct {
// contains filtered or unexported fields
}
func NewMultiEnvelopeBuilder ¶ added in v0.21.0
func NewMultiEnvelopeBuilder() *MultiEnvelopeBuilder
NewMultiEnvelopeBuilder returns a builder that constructs MultiEnvelope messages.
func (*MultiEnvelopeBuilder) Build ¶ added in v0.21.0
func (b *MultiEnvelopeBuilder) Build() *MultiEnvelope
Build returns a new MultiEnvelope containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*MultiEnvelopeBuilder) From ¶ added in v0.21.0
func (b *MultiEnvelopeBuilder) From(x *MultiEnvelope) *MultiEnvelopeBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*MultiEnvelopeBuilder) WithBodies ¶ added in v0.21.0
func (b *MultiEnvelopeBuilder) WithBodies(v []*Body) *MultiEnvelopeBuilder
WithBodies configures the builder to set the Bodies field to v, then returns b.
func (*MultiEnvelopeBuilder) WithHeader ¶ added in v0.21.0
func (b *MultiEnvelopeBuilder) WithHeader(v *Header) *MultiEnvelopeBuilder
WithHeader configures the builder to set the Header field to v, then returns b.
type MultiEnvelope_builder ¶ added in v0.23.0
type MultiEnvelope_builder struct {
Header *Header
Bodies []*Body
// contains filtered or unexported fields
}
func (MultiEnvelope_builder) Build ¶ added in v0.23.0
func (b0 MultiEnvelope_builder) Build() *MultiEnvelope
type PackCommandOption ¶ added in v0.22.0
type PackCommandOption interface {
// contains filtered or unexported methods
}
PackCommandOption is an option that modifies the behavior of Packer.PackCommand.
func WithIdempotencyKey ¶ added in v0.20.1
func WithIdempotencyKey(key string) PackCommandOption
WithIdempotencyKey sets the idempotency key of a command packed via Packer.PackCommand.
type PackEffectCommandOption ¶ added in v0.22.0
type PackEffectCommandOption interface {
// contains filtered or unexported methods
}
PackEffectCommandOption is an option that modifies the behavior of EffectPacker.PackCommand.
type PackEffectEventOption ¶ added in v0.22.0
type PackEffectEventOption interface {
// contains filtered or unexported methods
}
PackEffectEventOption is an option that modifies the behavior of EffectPacker.PackEvent.
type PackEffectTimeoutOption ¶ added in v0.22.0
type PackEffectTimeoutOption interface {
// contains filtered or unexported methods
}
PackEffectTimeoutOption is an option that modifies the behavior of EffectPacker.PackTimeout.
func WithScheduledFor ¶ added in v0.12.1
func WithScheduledFor(t time.Time) PackEffectTimeoutOption
WithScheduledFor sets the scheduled time of a timeout packed via EffectPacker.PackTimeout.
type PackEffectsOption ¶ added in v0.22.0
type PackEffectsOption interface {
// contains filtered or unexported methods
}
PackEffectsOption is an option that modifies the behavior of Packer.PackEffects.
func WithInstanceID ¶ added in v0.12.1
func WithInstanceID(id string) PackEffectsOption
WithInstanceID sets the aggregate or process instance ID that is the source of messages packed via Packer.PackEffects.
type Packer ¶ added in v0.12.1
type Packer struct {
// Site is the (optional) identity of the site that the source application
// is running within.
//
// The site is used to disambiguate between messages from different
// installations of the same application.
Site *identitypb.Identity
// Application is the identity of the application that is the source of the
// messages.
Application *identitypb.Identity
// GenerateID is a function used to generate new message IDs.
//
// If it is nil, a random UUID is generated.
GenerateID func() *uuidpb.UUID
// Now is a function used to get the current time. If it is nil, time.Now()
// is used.
Now func() time.Time
}
A Packer puts messages into envelopes.
func (*Packer) PackCommand ¶ added in v0.22.0
func (p *Packer) PackCommand(m dogma.Command, options ...PackCommandOption) *Envelope
PackCommand returns an envelope containing the given command.
func (*Packer) PackEffects ¶ added in v0.22.0
func (p *Packer) PackEffects( cause *Envelope, h *identitypb.Identity, options ...PackEffectsOption, ) *EffectPacker
PackEffects returns an EffectPacker that packs messages produced by h while handling cause.
type Source ¶ added in v0.21.0
type Source struct {
// contains filtered or unexported fields
}
Source identifies where a message originated.
func (*Source) ClearApplication ¶ added in v0.23.0
func (x *Source) ClearApplication()
func (*Source) ClearHandler ¶ added in v0.23.0
func (x *Source) ClearHandler()
func (*Source) GetApplication ¶ added in v0.21.0
func (x *Source) GetApplication() *identitypb.Identity
func (*Source) GetHandler ¶ added in v0.21.0
func (x *Source) GetHandler() *identitypb.Identity
func (*Source) GetInstanceId ¶ added in v0.21.0
func (*Source) GetSite ¶ added in v0.21.0
func (x *Source) GetSite() *identitypb.Identity
func (*Source) HasApplication ¶ added in v0.23.0
func (*Source) HasHandler ¶ added in v0.23.0
func (*Source) MarshalBinary ¶ added in v0.21.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Source to implement encoding.BinaryMarshaler.
func (*Source) ProtoMessage ¶ added in v0.21.0
func (*Source) ProtoMessage()
func (*Source) ProtoReflect ¶ added in v0.21.0
func (x *Source) ProtoReflect() protoreflect.Message
func (*Source) SetApplication ¶ added in v0.21.0
func (x *Source) SetApplication(v *identitypb.Identity)
func (*Source) SetHandler ¶ added in v0.21.0
func (x *Source) SetHandler(v *identitypb.Identity)
func (*Source) SetInstanceId ¶ added in v0.21.0
func (*Source) SetSite ¶ added in v0.21.0
func (x *Source) SetSite(v *identitypb.Identity)
func (*Source) UnmarshalBinary ¶ added in v0.21.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Source to implement encoding.BinaryUnmarshaler.
type SourceBuilder ¶ added in v0.21.0
type SourceBuilder struct {
// contains filtered or unexported fields
}
func NewSourceBuilder ¶ added in v0.21.0
func NewSourceBuilder() *SourceBuilder
NewSourceBuilder returns a builder that constructs Source messages.
func (*SourceBuilder) Build ¶ added in v0.21.0
func (b *SourceBuilder) Build() *Source
Build returns a new Source containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*SourceBuilder) From ¶ added in v0.21.0
func (b *SourceBuilder) From(x *Source) *SourceBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*SourceBuilder) WithApplication ¶ added in v0.21.0
func (b *SourceBuilder) WithApplication(v *identitypb.Identity) *SourceBuilder
WithApplication configures the builder to set the Application field to v, then returns b.
func (*SourceBuilder) WithHandler ¶ added in v0.21.0
func (b *SourceBuilder) WithHandler(v *identitypb.Identity) *SourceBuilder
WithHandler configures the builder to set the Handler field to v, then returns b.
func (*SourceBuilder) WithInstanceId ¶ added in v0.21.0
func (b *SourceBuilder) WithInstanceId(v string) *SourceBuilder
WithInstanceId configures the builder to set the InstanceId field to v, then returns b.
func (*SourceBuilder) WithSite ¶ added in v0.21.0
func (b *SourceBuilder) WithSite(v *identitypb.Identity) *SourceBuilder
WithSite configures the builder to set the Site field to v, then returns b.
type Source_builder ¶ added in v0.23.0
type Source_builder struct {
// Site is the (optional) identity of the "site" that the source
// application is running within.
//
// The site is used to disambiguate between messages from different
// installations of the same application.
Site *identitypb.Identity
// Application is the identity of the Dogma application that produced the
// message.
Application *identitypb.Identity
// Handler is the identity of the Dogma handler that produced the message.
//
// It is the zero-value if the message was not produced by a handler.
Handler *identitypb.Identity
// InstanceId is the ID of the aggregate or process instance that produced
// the message.
//
// It is empty if the message was not produced by an aggregate or process
// handler.
InstanceId string
// contains filtered or unexported fields
}
func (Source_builder) Build ¶ added in v0.23.0
func (b0 Source_builder) Build() *Source