How to have control over replaying or skipping events when exeptions occured?

Hi,
if i want to ask my question in a nutshell:
i’m using defalut TrackingEventProcessor in axon-framework and spring-boot, how can i have control on replaying or skipping events when a specific exeption occures.

If you are more in the mood, I explained more here :slight_smile:
I have two separate service for command and query part.
I am going to implement this scenario:

  1. client send a CreateCustomer Command to the command micro
  2. command be processed and CreatedCustomer Event published
  3. Event be captured in the query microservice
  4. desired customer be stored in the query db.

the problem is sometimes we have exceptions and i want to handle them. finally i want to handle these exceptions and decide between replaying or skipping an specific event based on different types of exception may occur in different situations.

@Hamed_Abbaszadeh, I think I have the perfect solution for you to selectively replay sequences that failed.
Namely, the integrated dead-letter queue of Axon Framework, for which you can find the documentation here.

To explain our DLQ in a nutshell:

  • The SequencedDeadLetterQueue comes in four implementations: in-memory, JPA, JDBC, Mongo
  • The SequencedDeadLetterQueue enqueues events for which your event handler threw an exception as dead letters.
  • The SequencedDeadLetterQueue will enqueue events that belong to the sequence of an existing dead letter into the queue. It is this that ensures you do not handle events out of order.
  • To reprocess events, you retrieve the SequencedDeadLetterProcessor from the EventProcessingConfiguration asking it to process a specific sequence based on a given Predicate.
  • Axon Framework does not automatically reprocess/replay any dead letters. You need to implement this or use AxonIQ Console to trigger retries through its UI.

I hope this helps you further, @Hamed_Abbaszadeh!! If not, be sure to reply :slight_smile:

1 Like

thanks man it helps alot!
i’ll share the concreted example when i implement your solution :slight_smile:

1 Like