Message replays
Fluxzero allows you to replay past messages by tracking from an earlier index in the message log. This is useful for:
- Rebuilding projections or read models
- Repairing missed or failed messages
- Retrospectively introducing new functionality
Since message logs — including commands, events, errors, etc. — are durably stored (with events retained indefinitely by default), replays are usually available.
For a new capability, start with building a feature from past events. The position controls below are useful when you need to choose or reset a replay range.
Replaying from the Past
Section titled “Replaying from the Past”The most common way to initiate a replay is to define a new consumer using the @Consumer annotation with a minIndex.
@Consumer(name = "auditReplay", minIndex = 111677748019200000L)public class AuditReplayHandler {
@HandleEvent void on(CreateUser event) { // ... rebuild projections, audit, etc. }}@Consumer(name = "auditReplay", minIndex = 111677748019200000L)class AuditReplayHandler {
@HandleEvent fun on(event: CreateUser) { // ... rebuild projections, audit, etc. }}long index = IndexUtils.indexFromTimestamp( Instant.parse("2024-01-01T00:00:00Z"));// -> 111677748019200000Lval index = IndexUtils.indexFromTimestamp( Instant.parse("2024-01-01T00:00:00Z"))// -> 111677748019200000LThis approach is perfect for:
- Starting fresh consumers for replays
- Bootstrapping projections without interfering with live handlers
- Keeping logic encapsulated and isolated
Resetting Existing Consumers
Section titled “Resetting Existing Consumers”If you want to reset an existing consumer to an earlier point in the log:
long replayIndex = 111677748019200000L;
Fluxzero.client() .getTrackingClient(MessageType.EVENT) .resetPosition("myConsumer", replayIndex, Guarantee.STORED);val replayIndex = 111677748019200000L
Fluxzero.client() .getTrackingClient(MessageType.EVENT) .resetPosition("myConsumer", replayIndex, Guarantee.STORED)Parallel replays with exclusive = false
Section titled “Parallel replays with exclusive = false”To keep processing live events while correcting earlier results, use
one handler in two consumers.
That guide shows the handler, the bounded correction consumer and how to finish the run.
exclusive = false allows the same handler to participate in both consumers.
Handling failures and DLQ flows
Section titled “Handling failures and DLQ flows”For replaying failures from the error log (dynamic DLQ), use the dedicated Dynamic dead-lettering guide.
© 2026 Fluxzero