ps_event

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunOutboxPublisher

func RunOutboxPublisher(
	ctx context.Context,
	drainingCtx context.Context,
	publisher Publisher,
	outbox Outbox,
) <-chan struct{}

Types

type Fanout

type Fanout []Publisher

Fanout attempts every publisher. The outbox completes a message only when all publishers succeed. A partial failure retries delivery to every publisher. ponytail: use per-broker outbox state if independent retries become necessary.

func (Fanout) Publish

func (publishers Fanout) Publish(ctx context.Context, message OutboxMessage) error

type Outbox

type Outbox interface {
	ProcessOutboxBatch(ctx context.Context, publish func([]OutboxMessage) []OutboxMessagePublishResult) error
}

Outbox reserves messages while publish runs and marks only acknowledged messages as processed. ProcessOutboxBatch reports storage failures. publish must return one result per input message, containing that original message.

type OutboxMessage

type OutboxMessage interface {
	Subject() string
	ID() string
	Payload() []byte
	TraceContext() map[string]string
}

type OutboxMessagePublishResult

type OutboxMessagePublishResult struct {
	OutboxMessage

	Err error
}

OutboxMessagePublishResult contains the original message and its publication error. OutboxMessage must be non-nil. A nil Err means the publisher acknowledged the message, independently of whether the outbox record was successfully marked as processed.

type Publisher

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

Publisher returns nil only after the broker acknowledges the message. Deliveries are at least once; consumers must tolerate repeated message IDs.

Jump to

Keyboard shortcuts

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