outbox

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package outbox builds the durable side of a transactional outbox from config: the store the relay (workflows/outbox) leases rows from and finalizes them in. Each kind is a subpackage — stub/ (no rows, the default, so a relay boots with no database) and postgres/ (a product's own outbox table) — and NewFromConfig returns the interfaces.OutboxStore behind the store tier (Decorate), as the decoration config's stores tier resolves it for Config.Name.

Index

Constants

View Source
const (
	// KindStub is the empty outbox (the default).
	KindStub = client.KindStub

	// KindPostgres is a product's PostgreSQL outbox table.
	KindPostgres client.Kind = "postgres"
)

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(
	ctx context.Context,
	cfg Config,
	deps Deps,
) (interfaces.OutboxStore, error)

NewFromConfig builds the outbox store cfg.Kind selects, behind the store tier, with no I/O. An unknown kind, an invalid backend config, a postgres kind without a DB, or a decoration that fails to build is CodeInvalidInput.

Types

type Config

type Config struct {
	// Kind selects the backend; empty means KindStub.
	Kind client.Kind `yaml:"kind" mapstructure:"kind"`

	// Name is the store's name in the decoration config's stores tier (and its metric,
	// span and log label); empty means "outbox".
	Name string `yaml:"name" mapstructure:"name"`

	// Postgres configures KindPostgres.
	Postgres postgres.Config `yaml:"postgres" mapstructure:"postgres"`
}

Config selects and tunes the outbox store.

type Deps

type Deps struct {
	// DB is the database KindPostgres runs on.
	DB *sql.DB

	// Decorations builds the store's layers from the stores tier of the decoration
	// config, under Config.Name.
	decorate.Decorations
}

Deps carries the outbox store's runtime collaborators.

Directories

Path Synopsis
Package postgres is the PostgreSQL kind of the outbox store (stores/outbox): the relay's claim, lease and finalize operations over a product's own outbox table, named by configuration.
Package postgres is the PostgreSQL kind of the outbox store (stores/outbox): the relay's claim, lease and finalize operations over a product's own outbox table, named by configuration.
Package stub is the stub kind of the outbox store (stores/outbox): an outbox with no rows, so a relay graph boots and runs with no database.
Package stub is the stub kind of the outbox store (stores/outbox): an outbox with no rows, so a relay graph boots and runs with no database.

Jump to

Keyboard shortcuts

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