Documentation
¶
Overview ¶
Package message defines the outbox data model.
Index ¶
Constants ¶
View Source
const TableName = "outbox_messages"
TableName is the fixed outbox table name. The schema is configurable at runtime; the table name itself is constant so it stays in lockstep with the embedded migration.
Variables ¶
View Source
var ( // ErrEmptyTopic is returned when a message has no topic. ErrEmptyTopic = errors.New("outbox: message topic is empty") // ErrNilPayload is returned when a message payload is nil. ErrNilPayload = errors.New("outbox: message payload is nil") )
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
ID string // uuid; empty -> generated by the database
Topic string // transport destination (queue/topic/subject)
PartitionKey string // ordering key (used by ordered mode)
Payload []byte // opaque bytes; encoding is the codec's job
Headers map[string]string // transport metadata
ContentType string // codec hint, e.g. "application/json"
MessageType string // logical message type
MaxAttempts *int // per-message override; nil -> relay default
// Populated when read back by the relay.
Status Status
Attempts int
LockedBy string
LockedUntil *time.Time
NextAttemptAt time.Time
LastError string
CreatedAt time.Time
PublishedAt *time.Time
}
Message is a single outbox row.
On enqueue, the caller sets Topic and Payload (required) and optionally ID, PartitionKey, Headers, ContentType, MessageType, MaxAttempts. The remaining fields are populated by the relay when a message is read back.
Click to show internal directories.
Click to hide internal directories.