OutboxRepositoryPort

Persistence-agnostic repository port for the Kafka outbox.

Concrete adapters (JPA, MongoDB, Cassandra, …) implement this interface; the outbox processor is decoupled from the underlying storage technology.

Functions

Link copied to clipboard
abstract fun findByEventId(eventId: String): OutboxMessage?

Looks up an outbox message by its unique OutboxMessage.eventId; null if absent.

Link copied to clipboard
abstract fun findBySagaId(sagaId: String): List<OutboxMessage>

Returns every outbox message correlated to the given saga (OutboxMessage.sagaId).

Link copied to clipboard

Returns every outbox message currently in the given status.

Link copied to clipboard
abstract fun lockBatchForDispatch(maxRetries: Int, retriableBefore: Instant, stuckBefore: Instant, batchSize: Int): List<OutboxMessage>

Atomically selects up to batchSize messages eligible for dispatch and locks them with a write lock so that concurrent poller instances skip them (SELECT … FOR UPDATE SKIP LOCKED on PostgreSQL).

Link copied to clipboard
abstract fun save(message: OutboxMessage): OutboxMessage

Persists message (insert or update) and returns the stored instance.