EffectResolver

fun interface EffectResolver<R>

SPI for resolving whether a side effect identified by a stable key has already been applied.

Users wire an EffectResolver when they need cross-run idempotency dedupe — for example, confirming with an external payment processor whether a charge bearing a given idempotency key was already settled, even if the local journal has no ca.acendas.kstate.saga.journal.EntryPhase.Effect entry for that key.

EffectResolver is optional (F004 §AC10). Without one, the engine falls back to scanning the local journal for a matching Effect entry. If none is found, the run returns Indeterminate (F003).

Example

val resolver = EffectResolver<TransactionResult> { key ->
when (val tx = paymentClient.findByIdempotencyKey(key)) {
null -> ResolvedEffect.NotFound
else -> ResolvedEffect.Found(tx.toResult())
}
}

Parameters

R

The result type produced by the step whose effect this resolver covers.

Functions

Link copied to clipboard
abstract suspend fun resolve(key: String): ResolvedEffect<R>

Looks up whether the side effect identified by key has already been applied.