Outbox Message
Persistence-agnostic contract for a Kafka outbox message.
The contract is immutable from the caller's perspective: all properties are val and every state transition is expressed as a domain method that returns the new message instance (e.g. markProcessing, markCompleted, markRetryScheduled, markDeadLettered). Concrete adapters decide whether to mutate the underlying row in place (JPA dirty-tracking with var private-set fields) or return a freshly copied document (MongoDB, Cassandra). The outbox processor never observes the difference — it always works with the returned reference.
Inheritors
Properties
Latest publishing error message, or null if the message has never failed.
Instant of the most recent retry; used together with veds.outbox.retry-cooldown to throttle redelivery.
Instant of the most recent dispatch attempt (success or failure).
Number of publishing attempts already made. Compared against veds.outbox.max-retries.
Current lifecycle OutboxStatus. See the enum's KDoc for the state machine.
Functions
Marks the message as successfully published to the broker. Sets status to OutboxStatus.COMPLETED and stamps processedAt with the current instant.
Transitions the message to OutboxStatus.DEAD_LETTERED. Terminal — the message will never be retried automatically.
Marks the message as being currently processed. Sets status to OutboxStatus.PROCESSING and stamps processedAt with the current instant.
Reverts the message to OutboxStatus.PENDING after a failed publishing attempt, incrementing retryCount and stamping lastRetryAt. The message will be picked up again by the next poller cycle after the configured retry cooldown elapses.