AxonFramework icon indicating copy to clipboard operation
AxonFramework copied to clipboard

Decorate `CommandBus` in `RetryingCommandBus` when a `RetryScheduler` is present

Open dilgerma opened this issue 5 months ago • 0 comments

Enhancement Description

When a RetryScheduler is configured, Axon Framework should automatically decorate the configured CommandBus with a RetryingCommandBus. Currently, users need to explicitly wrap the CommandBus themselves, even though the presence of a RetryScheduler strongly implies that command retries are desired.

Current Behaviour

Axon Framework provides the RetryingCommandBus, which uses the configured RetryScheduler to retry command dispatches. However, even when a RetryScheduler bean is present, the framework does not automatically decorate the CommandBus with a RetryingCommandBus.

As a result, users may configure a RetryScheduler and expect retries to occur, only to discover that additional manual configuration is required. This behavior is not clearly documented and can easily be overlooked.

Wanted Behaviour

If a RetryScheduler is present in the configuration, Axon Framework should automatically decorate the configured CommandBus with a RetryingCommandBus.

This would make retry behavior more intuitive, reduce configuration boilerplate, and align the framework's behavior with the expectation that providing a RetryScheduler indicates an intent to enable command retries.

Possible Workarounds

Currently, users can manually decorate the CommandBus with a RetryingCommandBus and provide the configured RetryScheduler explicitly. While functional, this requires additional configuration and knowledge of an implementation detail that can easily be missed.

dilgerma avatar Jun 16 '26 09:06 dilgerma