Class ResetPosition
java.lang.Object
io.fluxcapacitor.common.api.Request
io.fluxcapacitor.common.api.Command
io.fluxcapacitor.common.api.tracking.ResetPosition
- All Implemented Interfaces:
JsonType
Command to forcibly reset the tracked position for a given consumer and message type.
Unlike StorePosition
, which only allows the tracked index to move forward, this command allows setting a
lower lastIndex
, effectively rewinding the consumer’s position.
This is a powerful operation primarily intended for administrative or recovery scenarios. Common use cases include:
- Reprocessing past messages after fixing a bug or applying a new projection
- Resetting a consumer to rehydrate state (e.g. reloading an in-memory cache)
- Clearing segment state after corruption or unexpected termination
Preferred Alternatives
For new consumers or reconfigured tracker instances, it is typically preferred to set the initial tracking index viaConsumerConfiguration
or the @Consumer
annotation.
These approaches are safer and declarative, and avoid the potential side effects of resetting an active consumer.
Warning: Improper use may lead to duplicate processing. Ensure that consumers are idempotent or properly deduplicated before issuing a reset.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a routing key used for partitioning the reset command by consumer and message type.Methods inherited from class io.fluxcapacitor.common.api.Command
getGuarantee
-
Constructor Details
-
ResetPosition
public ResetPosition()
-
-
Method Details
-
routingKey
Returns a routing key used for partitioning the reset command by consumer and message type.- Overrides:
routingKey
in classCommand
- Returns:
- a routing key string, or
null
if not specified
-