Grabs up to limit pending messages, each locked so a concurrent relay picks different ones.
A 'relayed' or 'dead' row is terminal and never re-claimed.
Optionaloptions: CallOptionsSets status 'dead' so claimBatch never returns it again, recording reason for operators;
a non-existent or already-terminal row is left untouched.
Optionaloptions: CallOptionsSaves an event to send later. Called inside the posting's transaction.
Optionaloptions: CallOptionsDelivery may still double-send, so the consumer drops duplicates by message id.
Optionaloptions: CallOptionsBumps attempts and leaves the row 'pending'; only deadLetter may flip the status.
Optionaloptions: CallOptionsA read-only gauge of the pending backlog: how many rows wait and how old the oldest is. Age is computed on the store's own time base, so an app/database clock skew never distorts it. The relay sweep observes this each run — a backlog that only grows means the relay is down or the events are poisoned.
Optionaloptions: CallOptions
A transactional outbox: events save in the same database transaction as the money move, so an event is never sent for a rolled-back move nor lost for a committed one.