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)
- type Body
- func (*Body) Descriptor() ([]byte, []int)deprecated
- func (x *Body) GetCreatedAt() *timestamppb.Timestamp
- func (x *Body) GetExtensions() *Extensions
- 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) MarshalBinary() ([]byte, error)
- func (*Body) ProtoMessage()
- func (x *Body) ProtoReflect() protoreflect.Message
- func (x *Body) Reset()
- func (x *Body) SetCreatedAt(v *timestamppb.Timestamp)
- func (x *Body) SetExtensions(v *Extensions)
- 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) WithCreatedAt(v *timestamppb.Timestamp) *BodyBuilder
- func (b *BodyBuilder) WithExtensions(v *Extensions) *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 BodyPackOption
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)deprecated
- func (x *Envelope) GetBody() *Body
- func (x *Envelope) GetHeader() *Header
- 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 Extensions
- func (*Extensions) Descriptor() ([]byte, []int)deprecated
- func (x *Extensions) GetAttributes() map[string]string
- func (x *Extensions) GetBaggage() map[string]string
- func (x *Extensions) MarshalBinary() ([]byte, error)
- func (*Extensions) ProtoMessage()
- func (x *Extensions) ProtoReflect() protoreflect.Message
- func (x *Extensions) Reset()
- func (x *Extensions) SetAttributes(v map[string]string)
- func (x *Extensions) SetBaggage(v map[string]string)
- func (x *Extensions) String() string
- func (x *Extensions) UnmarshalBinary(data []byte) error
- type ExtensionsBuilder
- type Header
- func (*Header) Descriptor() ([]byte, []int)deprecated
- func (x *Header) GetCausationId() *uuidpb.UUID
- func (x *Header) GetCorrelationId() *uuidpb.UUID
- func (x *Header) GetExtensions() *Extensions
- func (x *Header) GetSource() *Source
- func (x *Header) MarshalBinary() ([]byte, error)
- func (*Header) ProtoMessage()
- func (x *Header) ProtoReflect() protoreflect.Message
- func (x *Header) Reset()
- func (x *Header) SetCausationId(v *uuidpb.UUID)
- func (x *Header) SetCorrelationId(v *uuidpb.UUID)
- func (x *Header) SetExtensions(v *Extensions)
- 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) WithCausationId(v *uuidpb.UUID) *HeaderBuilder
- func (b *HeaderBuilder) WithCorrelationId(v *uuidpb.UUID) *HeaderBuilder
- func (b *HeaderBuilder) WithExtensions(v *Extensions) *HeaderBuilder
- func (b *HeaderBuilder) WithSource(v *Source) *HeaderBuilder
- type Message
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (x *Message) GetData() []byte
- func (x *Message) GetDescription() string
- func (x *Message) GetTypeId() *uuidpb.UUID
- 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 MultiEnvelope
- func (*MultiEnvelope) Descriptor() ([]byte, []int)deprecated
- func (x *MultiEnvelope) GetBodies() []*Body
- func (x *MultiEnvelope) GetHeader() *Header
- 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 MultiPacker
- type PackOption
- type Packer
- type Source
- func (*Source) Descriptor() ([]byte, []int)deprecated
- 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) 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 SourcePackOption
Constants ¶
This section is empty.
Variables ¶
var File_github_com_dogmatiq_enginekit_protobuf_envelopepb_envelope_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Body ¶ added in v0.21.0
type Body struct {
// MessageId is a unique identifier for the message in this envelope.
MessageId *uuidpb.UUID `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"`
// 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 `protobuf:"bytes,2,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
// 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 `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
// 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 `protobuf:"bytes,4,opt,name=scheduled_for,json=scheduledFor,proto3" json:"scheduled_for,omitempty"`
// Message is the encoded representation of the [dogma.Message].
Message *Message `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"`
// Extensions is a container for arbitrary key/value pairs associated with
// this message and/or its causal chain.
//
// Any keys present in the [Header.Extensions] field are overridden by keys
// in this field.
Extensions *Extensions `protobuf:"bytes,6,opt,name=extensions,proto3" json:"extensions,omitempty"`
// contains filtered or unexported fields
}
func (*Body) Descriptor
deprecated
added in
v0.21.0
func (*Body) GetCreatedAt ¶ added in v0.21.0
func (x *Body) GetCreatedAt() *timestamppb.Timestamp
func (*Body) GetExtensions ¶ added in v0.21.0
func (x *Body) GetExtensions() *Extensions
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) 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) SetCreatedAt ¶ added in v0.21.0
func (x *Body) SetCreatedAt(v *timestamppb.Timestamp)
SetCreatedAt sets the x.CreatedAt field to v, then returns x.
func (*Body) SetExtensions ¶ added in v0.21.0
func (x *Body) SetExtensions(v *Extensions)
SetExtensions sets the x.Extensions field to v, then returns x.
func (*Body) SetIdempotencyKey ¶ added in v0.21.0
SetIdempotencyKey sets the x.IdempotencyKey field to v, then returns x.
func (*Body) SetMessage ¶ added in v0.21.0
SetMessage sets the x.Message field to v, then returns x.
func (*Body) SetMessageId ¶ added in v0.21.0
SetMessageId sets the x.MessageId field to v, then returns x.
func (*Body) SetScheduledFor ¶ added in v0.21.0
func (x *Body) SetScheduledFor(v *timestamppb.Timestamp)
SetScheduledFor sets the x.ScheduledFor field to v, then returns x.
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) 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 *Extensions) *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 BodyPackOption ¶ added in v0.21.0
type BodyPackOption interface {
PackOption
// contains filtered or unexported methods
}
BodyPackOption is a PackOption that modifies only envelope bodies.
func WithCreatedAt ¶ added in v0.12.1
func WithCreatedAt(t time.Time) BodyPackOption
WithCreatedAt sets the creation time of a message.
func WithIdempotencyKey ¶ added in v0.20.1
func WithIdempotencyKey(key string) BodyPackOption
WithIdempotencyKey sets the idempotency key of a command message.
func WithScheduledFor ¶ added in v0.12.1
func WithScheduledFor(t time.Time) BodyPackOption
WithScheduledFor sets the scheduled time of a timeout message.
type Envelope ¶
type Envelope struct {
Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
Body *Body `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
// 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) Descriptor
deprecated
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) SetHeader ¶ added in v0.21.0
SetHeader sets the x.Header field to v, then returns x.
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 Extensions ¶ added in v0.21.0
type Extensions struct {
// Attributes is a set of arbitrary key/value pairs that provide additional
// information about the message.
Attributes map[string]string `` /* 147-byte string literal not displayed */
// Baggage is a set of arbitrary key/value pairs that are propagated through
// the entire causal chain of messages.
Baggage map[string]string `` /* 141-byte string literal not displayed */
// contains filtered or unexported fields
}
Extensions is a container for arbitrary key/value pairs associated with a message and/or its causal chain.
Keys beginning with "_" are reserved for use by the enginekit module. All other keys SHOULD use reverse-domain notation, e.g. "com.example.some-key".
func (*Extensions) Descriptor
deprecated
added in
v0.21.0
func (*Extensions) Descriptor() ([]byte, []int)
Deprecated: Use Extensions.ProtoReflect.Descriptor instead.
func (*Extensions) GetAttributes ¶ added in v0.21.0
func (x *Extensions) GetAttributes() map[string]string
func (*Extensions) GetBaggage ¶ added in v0.21.0
func (x *Extensions) GetBaggage() map[string]string
func (*Extensions) MarshalBinary ¶ added in v0.21.0
func (x *Extensions) MarshalBinary() ([]byte, error)
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Extensions to implement encoding.BinaryMarshaler.
func (*Extensions) ProtoMessage ¶ added in v0.21.0
func (*Extensions) ProtoMessage()
func (*Extensions) ProtoReflect ¶ added in v0.21.0
func (x *Extensions) ProtoReflect() protoreflect.Message
func (*Extensions) Reset ¶ added in v0.21.0
func (x *Extensions) Reset()
func (*Extensions) SetAttributes ¶ added in v0.21.0
func (x *Extensions) SetAttributes(v map[string]string)
SetAttributes sets the x.Attributes field to v, then returns x.
func (*Extensions) SetBaggage ¶ added in v0.21.0
func (x *Extensions) SetBaggage(v map[string]string)
SetBaggage sets the x.Baggage field to v, then returns x.
func (*Extensions) String ¶ added in v0.21.0
func (x *Extensions) String() string
func (*Extensions) UnmarshalBinary ¶ added in v0.21.0
func (x *Extensions) UnmarshalBinary(data []byte) error
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Extensions to implement encoding.BinaryUnmarshaler.
type ExtensionsBuilder ¶ added in v0.21.0
type ExtensionsBuilder struct {
// contains filtered or unexported fields
}
func NewExtensionsBuilder ¶ added in v0.21.0
func NewExtensionsBuilder() *ExtensionsBuilder
NewExtensionsBuilder returns a builder that constructs Extensions messages.
func (*ExtensionsBuilder) Build ¶ added in v0.21.0
func (b *ExtensionsBuilder) Build() *Extensions
Build returns a new Extensions 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 (*ExtensionsBuilder) From ¶ added in v0.21.0
func (b *ExtensionsBuilder) From(x *Extensions) *ExtensionsBuilder
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 (*ExtensionsBuilder) WithAttributes ¶ added in v0.21.0
func (b *ExtensionsBuilder) WithAttributes(v map[string]string) *ExtensionsBuilder
WithAttributes configures the builder to set the Attributes field to v, then returns b.
func (*ExtensionsBuilder) WithBaggage ¶ added in v0.21.0
func (b *ExtensionsBuilder) WithBaggage(v map[string]string) *ExtensionsBuilder
WithBaggage configures the builder to set the Baggage field to v, then returns b.
type Header ¶ added in v0.21.0
type Header 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 `protobuf:"bytes,1,opt,name=causation_id,json=causationId,proto3" json:"causation_id,omitempty"`
// 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 `protobuf:"bytes,2,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"`
// Source identifies the origin of the messages.
Source *Source `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`
// Extensions is a container for arbitrary key/value pairs associated with
// the messages, their causal chain, or the envelope itself.
Extensions *Extensions `protobuf:"bytes,4,opt,name=extensions,proto3" json:"extensions,omitempty"`
// contains filtered or unexported fields
}
func (*Header) Descriptor
deprecated
added in
v0.21.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 (x *Header) GetExtensions() *Extensions
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) SetCausationId ¶ added in v0.21.0
SetCausationId sets the x.CausationId field to v, then returns x.
func (*Header) SetCorrelationId ¶ added in v0.21.0
SetCorrelationId sets the x.CorrelationId field to v, then returns x.
func (*Header) SetExtensions ¶ added in v0.21.0
func (x *Header) SetExtensions(v *Extensions)
SetExtensions sets the x.Extensions field to v, then returns x.
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) 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 *Extensions) *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 Message ¶ added in v0.21.0
type Message struct {
// TypeId is a unique identifier for the type of message, as per the Dogma
// message type registry.
TypeId *uuidpb.UUID `protobuf:"bytes,1,opt,name=type_id,json=typeId,proto3" json:"type_id,omitempty"`
// Description is a human-readable description of the message, as returned by
// the [dogma.Message.MessageDescription] method.
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
// Data is the binary message data obtained by calling
// [dogma.Message.MarshalBinary] on the message.
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
Message is the serialized representation of a dogma.Message.
func (*Message) Descriptor
deprecated
added in
v0.21.0
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
SetDescription sets the x.Description field to v, then returns x.
func (*Message) SetTypeId ¶ added in v0.21.0
SetTypeId sets the x.TypeId field to v, then returns x.
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 MultiEnvelope ¶ added in v0.21.0
type MultiEnvelope struct {
Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
Bodies []*Body `protobuf:"bytes,2,rep,name=bodies,proto3" json:"bodies,omitempty"`
// contains filtered or unexported fields
}
MultiEnvelope is an efficient encoding of an ordered sequence of Envelope values that share common header context.
func (*MultiEnvelope) Descriptor
deprecated
added in
v0.21.0
func (*MultiEnvelope) Descriptor() ([]byte, []int)
Deprecated: Use MultiEnvelope.ProtoReflect.Descriptor instead.
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) 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)
SetBodies sets the x.Bodies field to v, then returns x.
func (*MultiEnvelope) SetHeader ¶ added in v0.21.0
func (x *MultiEnvelope) SetHeader(v *Header)
SetHeader sets the x.Header field to v, then returns x.
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 MultiPacker ¶ added in v0.21.0
type MultiPacker struct {
// contains filtered or unexported fields
}
A MultiPacker puts messages into a MultiEnvelope.
func (*MultiPacker) Pack ¶ added in v0.21.0
func (p *MultiPacker) Pack(m dogma.Message, options ...BodyPackOption)
Pack appends m to the multi-envelope under construction.
func (*MultiPacker) Seal ¶ added in v0.21.0
func (p *MultiPacker) Seal() (*MultiEnvelope, bool)
Seal returns a MultiEnvelope containing all packed messages, or false if no messages were packed.
type PackOption ¶ added in v0.12.1
type PackOption interface {
// contains filtered or unexported methods
}
PackOption is an option that alters the behavior of a Packer.Pack operation.
func WithCause ¶ added in v0.12.1
func WithCause(env *Envelope) PackOption
WithCause sets env as the "cause" of the message being packed.
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) CausedBy ¶ added in v0.21.0
func (p *Packer) CausedBy(env *Envelope, options ...SourcePackOption) *MultiPacker
CausedBy returns a MultiPacker that packs messages that share env as their cause into a shared MultiEnvelope.
type Source ¶ added in v0.21.0
type Source 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 `protobuf:"bytes,1,opt,name=site,proto3" json:"site,omitempty"`
// Application is the identity of the Dogma application that produced the
// message.
Application *identitypb.Identity `protobuf:"bytes,2,opt,name=application,proto3" json:"application,omitempty"`
// 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 `protobuf:"bytes,3,opt,name=handler,proto3" json:"handler,omitempty"`
// 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 `protobuf:"bytes,4,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"`
// contains filtered or unexported fields
}
Source identifies where a message originated.
func (*Source) Descriptor
deprecated
added in
v0.21.0
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) 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)
SetApplication sets the x.Application field to v, then returns x.
func (*Source) SetHandler ¶ added in v0.21.0
func (x *Source) SetHandler(v *identitypb.Identity)
SetHandler sets the x.Handler field to v, then returns x.
func (*Source) SetInstanceId ¶ added in v0.21.0
SetInstanceId sets the x.InstanceId field to v, then returns x.
func (*Source) SetSite ¶ added in v0.21.0
func (x *Source) SetSite(v *identitypb.Identity)
SetSite sets the x.Site field to v, then returns x.
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 SourcePackOption ¶ added in v0.21.0
type SourcePackOption interface {
PackOption
// contains filtered or unexported methods
}
SourcePackOption is a PackOption that modifies only the source information in an envelope header.
func WithHandler ¶ added in v0.12.1
func WithHandler(h *identitypb.Identity) SourcePackOption
WithHandler sets h as the identity of the handler that is the source of the message.
func WithInstanceID ¶ added in v0.12.1
func WithInstanceID(id string) SourcePackOption
WithInstanceID sets the aggregate or process instance ID that is the source of the message.