Disabling Replay in Tracking Event processors (TEP)

Hello,

We have configured Streamable Kafka message with Axon (https://docs.axoniq.io/reference-guide/extensions/kafka#consuming-events-with-a-streamable-message-source)
This in turn uses the following configuration:

public void configureStreamableKafkaSource(EventProcessingConfigurer eventProcessingConfigurer,
String processorName,
StreamableKafkaMessageSource<String, byte[]> streamableKafkaMessageSource) {
eventProcessingConfigurer.registerTrackingEventProcessor(
processorName,
configuration -> streamableKafkaMessageSource
);
}

Wanted to check if there is a way to disable default replay option in Tracking Event processor, what configuration is required for this?

Thanks

You can indicate that specific Event Handlers (either on a method level or on the class level) cannot be replayed. Simply annotate your method or class with @DisallowReplay and that component will not receive events that are “redeliveries after a reset”. Note that if you throw away your token completely from the database, Axon has no way to see whether this is a replay, and it will invoke your handler for each event.

If you want your processor to initialize a token at “live events”, rather than the oldest event in the stream, use:

public void configureStreamableKafkaSource(EventProcessingConfigurer eventProcessingConfigurer,
String processorName,
StreamableKafkaMessageSource<String, byte[]> streamableKafkaMessageSource) {
eventProcessingConfigurer.registerTrackingEventProcessor(
processorName,
configuration -> streamableKafkaMessageSource**,**
configuration -> TrackingEventProcessorConfiguration.forSingleThreadedProcessing()
.andInitialTrackingToken(source -> source.createHeadToken()
);
}

The TrackingEventProcessorConfiguration allows you to configure a whole lot more.

Cheers,