SagaRepositoryPort

Persistence-agnostic repository port for saga aggregates.

Concrete adapters (JPA, MongoDB, …) implement this interface; the saga engine has no awareness of the underlying storage technology.

Inheritors

Functions

Link copied to clipboard
abstract fun findByStartedAtBefore(startedAt: Instant): List<S>

Returns sagas whose Saga.startedAt is strictly before startedAt.

Link copied to clipboard
abstract fun findByStatus(status: SagaStatus): List<S>

Returns all sagas currently in the given SagaStatus.

Link copied to clipboard
abstract fun findByStatusInAndStartedAtBefore(statuses: List<SagaStatus>, startedAt: Instant): List<S>

Returns sagas in any of statuses whose Saga.startedAt is strictly before startedAt.

Link copied to clipboard
abstract fun findByStatusInAndUpdatedAtBefore(statuses: List<SagaStatus>, updatedAt: Instant): List<S>

Finds sagas whose Saga.status is in statuses and whose Saga.updatedAt is strictly before updatedAt. Used by the saga watchdog to detect AWAITING_RESPONSE timeouts and to schedule compensation retries with a cooldown.

Link copied to clipboard
abstract fun findByType(type: String): List<S>

Returns all sagas of the given Saga.type.

Link copied to clipboard
abstract fun findByTypeAndStatus(type: String, status: SagaStatus): List<S>

Returns sagas matching both type and status.

Link copied to clipboard
abstract fun findOneById(id: String): S?

Looks up a saga by its Saga.id; null if absent.

Link copied to clipboard
abstract fun save(saga: S): S

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