outbox

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusProcessing = "PROCESSING"
	StatusSent       = "SENT"
)

Outbox message status constants.

Variables

This section is empty.

Functions

func EnsureIndexes added in v0.3.5

func EnsureIndexes(ctx context.Context, m mongo.Mongo) error

EnsureIndexes creates required indexes for outbox collection. This is idempotent - safe to call multiple times.

func NewOutboxModule

func NewOutboxModule() fx.Option

NewOutboxModule provides outbox pattern components for reliable message delivery.

Types

type Config

type Config struct {
	// MaxBackoff is the maximum delay between retry attempts.
	// Default: 10 hours
	MaxBackoff time.Duration `mapstructure:"max-backoff"`
}

Config holds the outbox pattern configuration.

type Message

type Message struct {
	Event   events.Event      // Event payload - must implement events.Event interface
	Key     string            // Kafka partition key for ordering guarantees
	Headers map[string]string // Kafka headers for trace propagation, etc.
}

Message represents a message to be sent via the outbox pattern.

type Outbox

type Outbox interface {
	Create(ctx context.Context, msg Message) (SendFunc, error)
}

Outbox defines the interface for creating outbox messages.

type SendFunc

type SendFunc func(ctx context.Context) error

SendFunc is a function that triggers the actual message delivery after transaction commit.

Jump to

Keyboard shortcuts

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