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.
Click to show internal directories.
Click to hide internal directories.