outbox

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package outbox delivers PostgreSQL outbox events to a durable publisher. Delivery is at-least-once: a crash after broker acknowledgement and before the database acknowledgement may publish a duplicate.

Index

Constants

View Source
const (
	StreamName    = "FENCED_EVENTS"
	SubjectPrefix = "fenced.events"
)

Variables

This section is empty.

Functions

func EnsureStream

func EnsureStream(ctx context.Context, js jetstream.JetStream, replicas int) error

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

func NewDispatcher

func NewDispatcher(repository Repository, publisher Publisher, id string, batch int, lockTTL time.Duration) *Dispatcher

func (*Dispatcher) RunOnce

func (d *Dispatcher) RunOnce(ctx context.Context) (int, error)

type JetStreamPublisher

type JetStreamPublisher struct {
	// contains filtered or unexported fields
}

func NewJetStreamPublisher

func NewJetStreamPublisher(js jetstream.JetStream) *JetStreamPublisher

func (*JetStreamPublisher) Publish

func (p *JetStreamPublisher) Publish(ctx context.Context, event store.OutboxEvent) error

type Publisher

type Publisher interface {
	Publish(context.Context, store.OutboxEvent) error
}

type Repository

type Repository interface {
	ClaimOutbox(context.Context, store.ClaimOutboxInput) ([]store.OutboxEvent, error)
	MarkOutboxPublished(context.Context, uuid.UUID, string, int64, time.Time) error
	MarkOutboxFailed(context.Context, uuid.UUID, string, int64, string, time.Time) error
}

Jump to

Keyboard shortcuts

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