Skip to content

Spring Retry - Recover method not getting called in case of Exception Assault on Service class #395

Open
@bunty-raghani

Description

@bunty-raghani

When Spring Retry is configured in project with recover/fallback method, in case of exception assault on service class, fallback method/recover method is not getting called.

NOTE: In case of service assault, retry functionality is working fine but fallback method is not getting called at the end.

Expected Behavior

Recover method should be called in case of service assault.

Current Behavior

Only retry functionality is working fine but when retries are exhausted then at the end recover method is not getting called.
(Already cross checked the recover method signature. Same is working fine in case of RestTeamplate assault but it is not working in case of service Assault.)

Steps to Reproduce

  1. Create a service class with a method and configure spring retry using @retryable annotation. Specify the exception type for which retry should be performed and number of time the retry should be performed.
  2. In the same service class, create a recover method using @recover annotation, specify the same exception inside method signature for which retry was configured in step-1.
  3. Enable exception assault on service class
  4. During the assault, notice that the retry functionality is working fine but recover method is not getting called when retries are exhausted.

Context (Environment)

This will be helpful to test the real world scenarios in which fallback methods are called when retries are exhausted.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions