retryOnConflict

suspend fun <STATE : AggregateState, EVENT> retryOnConflict(maxRetries: Int? = 3, initialBackoffMillis: Long = 10, maxBackoffMillis: Long = 1000, block: suspend () -> AggregateChangeResult<STATE, EVENT>): AggregateChangeResult<STATE, EVENT>(source)

Reloads/reinvokes caller-supplied aggregate handling after optimistic conflicts only.

This helper must not be used for OutcomeUnknown: ambiguous writes require exact prepared-append recovery and must never re-handle the command.

Parameters

maxRetries

The maximum number of retries. If null, retries indefinitely.

initialBackoffMillis

The initial backoff in milliseconds.

maxBackoffMillis

The maximum backoff in milliseconds.

block

The block of code to execute.