outbox

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package outbox owns shared durable-message identities and explicit schema migrations. Feature-specific producers preserve their concrete payload types.

Index

Constants

View Source
const (
	MigrationOrigin migrate.Origin  = "foundry.outbox"
	CreateMessages  migrate.ID      = "000001_create_messages"
	AddPublication  migrate.ID      = "000002_add_publication"
	AddClaimIndexes migrate.ID      = "000003_add_claim_indexes"
	Introduced      migrate.Version = "v0.1.0"
)

Variables

This section is empty.

Functions

func Migrations

func Migrations() []migrate.Definition

Migrations returns owned historical definitions for the shared outbox table. Register them once with application/plugin definitions and run the ordinary migration command explicitly. Calling this function performs no I/O. The table follows the connection's selected schema, as ordinary model tables do; producers and the migration runner must use the same intended database/schema. Later delivery capabilities add new migrations without rewriting this history.

Types

type Destination

type Destination string

Destination is a stable routing namespace, declared once when constructing a producer. It is separate from a payload's schema name and version.

func (Destination) Validate

func (d Destination) Validate() error

Validate checks that the destination is a semantic identifier.

type ID

type ID[E any] = model.ID[Message[E]]

ID identifies a persisted message with the concrete payload owner E. It is distinct from a model ID and from a message with another payload owner. An ID does not establish successful commit, delivery, record existence or authority.

func IDFromBytes

func IDFromBytes[E any](data [16]byte) ID[E]

IDFromBytes restores a payload owner at an explicit persistence boundary. UUID parsing, formatting and serialization are owned by the shared model ID.

func ParseID

func ParseID[E any](text string) (ID[E], error)

ParseID is an explicit transport boundary that reapplies the expected payload owner. The feature's typed reload also validates destination, name and version.

type Message

type Message[E any] struct {
	// contains filtered or unexported fields
}

Message is the payload-specific identity owner for durable records. It carries type information only; feature descriptors provide payload access. Exporting this owner lets generated model codecs name an outbox ID's complete Go type when an application persists one, without a second UUID/codec implementation.

type PublicationState

type PublicationState string

PublicationState describes transfer to a durable delivery authority, not successful execution of its eventual handler. Failure remains inspectable.

const (
	Pending           PublicationState = "pending"
	Published         PublicationState = "published"
	PublicationFailed PublicationState = "failed"
)

Directories

Path Synopsis
Package command supplies application-owned outbox operations.
Package command supplies application-owned outbox operations.
Package publisher transfers shared outbox messages to durable authorities.
Package publisher transfers shared outbox messages to durable authorities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL