CompensationFailureRecorder

class CompensationFailureRecorder(commandBus: CommandBus, recordFailureRetry: Retry = DEFAULT_RECORD_FAILURE_RETRY) : FailureRecorder

Records event-processing failures as compensation executions, by sending commands to the compensation service:

  • the first failure of an event function: CreateExecutionFailed;

  • a failed compensation execution (the event carries a compensation ID): ApplyExecutionFailed;

  • a compensation execution that succeeded: ApplyExecutionSuccess.

A function whose @Retry is disabled is not recorded (ProcessingOutcome.FAILURE_WAIVED). The send is retried with recordFailureRetry (the handler is not run again); when it still fails, the recording fails and the event handler leaves the message unacknowledged (ProcessingOutcome.RECORDING_FAILED), so the bus delivers it again.

The command bodies are frozen wire, identical to the 9.2 EventCompensationFilter.

Constructors

Link copied to clipboard
constructor(commandBus: CommandBus, recordFailureRetry: Retry = DEFAULT_RECORD_FAILURE_RETRY)

Functions

Link copied to clipboard
open override fun recordFailure(exchange: EventExchange<*, *>, error: Throwable): Mono<ProcessingOutcome>
Link copied to clipboard
open override fun recordSuccess(exchange: EventExchange<*, *>): Mono<Void>