Skip to content

Introduce beforeRetry callback with RetryState argument #36245

@michaldo

Description

@michaldo

Hi,

there is a missing functionality in RetryListener to satisfy the following:

-> to not omit retry event, log every retry attempt with counter value, but only if retry is really planned.
If exception is not retryable, there is no need to log anything because exception will be handled by call owner.
If exception will not be retried due max retry exhausted, there is no need to log anything for the same reason.

To sum up, I don't want retry event sneak unnoticed, but I don't want overload when I know exception will be handled by call owner and no action is required

Although I'm warned few times not being polite, I'm not satisfied by implementation of #35940

General method onRetryableExecution, called even on first invocation, prior to any failure, does not align well with a problem-aware approach. I prefer fine-grained method with full context provided.

If you accept change RetryListener API, please consider add RetryState to beforeRetry() . beforeRetry() is natural handler for problem-aware and RetryState exposes failure counter
If not, please consider add information if retry is planned to RetryState and I will use it in onRetryableExecution to make no action when retry will not happen

PS. I asked https://stackoverflow.com/questions/79872397/spring-7-retrylistener but no one responded.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions