Tracking Event Processor

Hi,

I am reading about tracking event processors and as the document says “This Token allows the processor to reopen the Stream at any later point, picking up where it left off with the last Event.”.
My requirement is , If an exception is thrown while processing an event in event handler and when another event enters the handler, is it possible to process the previous event before processing this new event? Is this use case possible with Axon or do we need to handle this manually

Thanks & Regards
Krish

For single threaded event processors events are always processed in order. In case of an exception the default behaviour will bubble the exception and will put the TrackingEventProcessor in a retry loop until the event is successfully processed. Be aware that this consequently may block the Tracking Processor indefinitely if the exception keeps re-occurring - so you will need to make up your mind how to compensate this situation as retrying forever is rarely a good strategy for almost anything :stuck_out_tongue:

What is the time interval for retry ? I have waited for more than 1 hr with a debugger , but i dint see that it was retried . Below is the configuration I have used for setting up tracking event processor. AXON version 3.2

@Autowired
public void configureEventProcessors(EventHandlingConfiguration configuration) {
    configuration.registerTrackingProcessor("trackingeventProcessor1");
}

The interval for a retry is incremental, starting at 1 seconds, doubling after each retry, but never longer than 60 seconds. During a retry, it will release its tokens, in case another active instance is able to successfully process an event.

Note that there are 2 levels of error handlers. The ListenerInvocationErrorHandler deals with exceptions raised by the event handler. These are by default caught and logged, causing the processor to continue. If an exception occurs while committing a transaction or because the ListenerInvocationErrorHandler caused it to bubble up, then the ErrorHandler on the TrackingEventProcessor catches it. There, the default is to rethrow the exception, which causes the processor to go into a retry procedure (with incremental back-off).

Hope this helps.
Cheers,