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
I have two separate service for command and query part.
I am going to implement this scenario:
- client send a CreateCustomer Command to the command micro
- command be processed and CreatedCustomer Event published
- Event be captured in the query microservice
- 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:
SequencedDeadLetterQueue comes in four implementations: in-memory, JPA, JDBC, Mongo
SequencedDeadLetterQueue enqueues events for which your event handler threw an exception as dead letters.
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
- 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
thanks man it helps alot!
i’ll share the concreted example when i implement your solution