Versions in this module Expand all Collapse all v1 v1.0.0 Jul 15, 2026 Changes in this version + var ErrAttemptsInvalid = errors.New("outbox: new envelope attempts must be zero") + var ErrAvailableAtRequired = errors.New("outbox: availability time is required") + var ErrCreatedAtRequired = errors.New("outbox: creation time is required") + var ErrIDRequired = errors.New("outbox: ID is required") + var ErrIDTooLarge = errors.New("outbox: ID is too large") + var ErrIdempotencyKeyTooLarge = errors.New("outbox: idempotency key is too large") + var ErrInvalidLimits = errors.New("outbox: limits must be positive") + var ErrMetadataEntriesTooLarge = errors.New("outbox: metadata has too many entries") + var ErrMetadataTooLarge = errors.New("outbox: metadata is too large") + var ErrOrderingKeyTooLarge = errors.New("outbox: ordering key is too large") + var ErrPayloadTooLarge = errors.New("outbox: payload is too large") + var ErrPayloadVersionRequired = errors.New("outbox: payload version is required") + var ErrTimestampOutOfRange = errors.New("outbox: timestamp is outside JSON range") + var ErrTopicRequired = errors.New("outbox: topic is required") + var ErrTopicTooLarge = errors.New("outbox: topic is too large") + type BacklogStats struct + Dead int64 + Leased int64 + OldestPendingAt *time.Time + Pending int64 + type Envelope struct + Attempts int + AvailableAt time.Time + CreatedAt time.Time + ID string + IdempotencyKey string + Metadata map[string]string + OrderingKey string + Payload []byte + PayloadVersion uint16 + Topic string + func (e Envelope) CanonicalJSON() []byte + func (e Envelope) ValidateForInsert(limits Limits) error + type EnvelopeBuilder struct + func NewEnvelopeBuilder(options ...EnvelopeBuilderOption) (*EnvelopeBuilder, error) + func (b *EnvelopeBuilder) Build(params NewEnvelopeParams) (Envelope, error) + type EnvelopeBuilderOption func(*EnvelopeBuilder) error + func WithClock(clock func() time.Time) EnvelopeBuilderOption + func WithIDGenerator(generator func() (string, error)) EnvelopeBuilderOption + func WithLimits(limits Limits) EnvelopeBuilderOption + type Event struct + Attempts int + Count int + Duration time.Duration + MessageID string + Operation Operation + Outcome Outcome + Topic string + type Limits struct + MaxIDBytes int + MaxIdempotencyKeyBytes int + MaxMetadataBytes int + MaxMetadataEntries int + MaxOrderingKeyBytes int + MaxPayloadBytes int + MaxTopicBytes int + func DefaultLimits() Limits + func (limits Limits) Validate() error + type NewEnvelopeParams struct + AvailableAt time.Time + IdempotencyKey string + Metadata map[string]string + OrderingKey string + Payload []byte + PayloadVersion uint16 + Topic string + type Observer interface + Observe func(context.Context, Event) + type ObserverFunc func(context.Context, Event) + func (observe ObserverFunc) Observe(ctx context.Context, event Event) + type Operation string + const OperationArchive + const OperationClaim + const OperationDeadLetter + const OperationDeliver + const OperationExtendLease + const OperationPrune + const OperationPublish + const OperationRelease + const OperationReplay + const OperationRetry + type Outcome string + const OutcomeFailure + const OutcomeSuccess