Search code examples
cqrsaxon

Axon retry testing


I'm writing a system using the Axon framework. One of my event handlers posts a command to a different microservice and I have implemented the retry function with exponential back-off to deal with the other service not being available.

I can see this working if I manually turn off the receiving microservice on watch the logs etc, but is there a more formal way of automating this testing?


Solution

  • The framework does not provide a generic way to test this functionality. Thus, you will have to resort to some form of integration testing.

    In there, you could embed the service you're going to call with the retry mechanism, shut it down during tests and see a number of retries occurring by catching the dispatched commands.

    Axon Framework only provides dedicated test fixtures for Aggregates and Sagas at this stage (speaking about framework version 4.2).

    Concluding, it is thus up to you what approach for testing you take in here.