StateEventCompensator

class StateEventCompensator(stateAggregateFactory: StateAggregateFactory, eventStore: EventStore, stateEventBus: StateEventBus) : EventCompensator<StateEvent<*>>

Compensator for state events.

This class handles compensation operations for state events by reconstructing state from event sourcing and resending state events to the state event bus with compensation metadata.

Parameters

stateAggregateFactory

The factory for creating state aggregates

eventStore

The event store to use for loading events

stateEventBus

The state event bus to use for sending compensated events

See also

Constructors

Link copied to clipboard
constructor(stateAggregateFactory: StateAggregateFactory, eventStore: EventStore, stateEventBus: StateEventBus)

Creates a new StateEventCompensator with the specified dependencies

Functions

Link copied to clipboard
open override fun compensate(eventStream: StateEvent<*>, target: CompensationTarget): Mono<Void>

Compensates a state event by marking it for compensation and resending.

open fun compensate(aggregateId: AggregateId, version: Int, target: CompensationTarget): Mono<Long>

Compensates events for the specified aggregate and version.

Link copied to clipboard
open override fun resend(aggregateId: AggregateId, headVersion: Int, tailVersion: Int, target: CompensationTarget): Mono<Long>

Resends a range of state events by reconstructing state from event sourcing.