Help us shape the future of Go! Take the 2026 Go Developer Survey

outbox

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package outbox delivers representatives' replies to humans through the communication adapter (§9.2). Each send is a connector operation recorded before the call; an ambiguous result is recorded as unknown and never blindly resent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comms

type Comms interface {
	Communication(orgID, key string) (connectors.Communication, error)
}

Comms resolves communication adapters.

type Dispatcher

type Dispatcher struct {
	Store    Store
	Comms    Comms
	Metrics  *metrics.Metrics
	Log      *slog.Logger
	Interval time.Duration
}

Dispatcher sends claimed outbox rows.

func (*Dispatcher) DispatchOnce

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

DispatchOnce sends one batch and returns how many rows it handled.

func (*Dispatcher) Run

func (d *Dispatcher) Run(ctx context.Context)

Run dispatches until ctx is cancelled.

type Store

type Store interface {
	ClaimOutbox(ctx context.Context, limit int) ([]store.OutboxItem, error)
	ResolveOutbox(ctx context.Context, it store.OutboxItem, state, receipt, errText string, retryIn time.Duration) error
	ExpireSending(ctx context.Context) (int, error)
	Organization(ctx context.Context, orgID string) (*store.Organization, error)
}

Store is the persistence the dispatcher needs.

Jump to

Keyboard shortcuts

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