Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Fallback's include and exclude parameters are not honoured when fallback happens #11255

Open
prabalpsr opened this issue Oct 16, 2024 · 1 comment

Comments

@prabalpsr
Copy link

Expected Behavior

if the exclude exception list is provided with the fallback annotation, the fallack should not be triggered is the excluded exception occurs. The vice versa should happen for included exception list.

Actual Behaviour

We are using @recoverable and @fallback combination with declarative http client that returns a Publisher. We want fallback to be triggered for all >=4xx HttpClientResponseException except when we encounter a 404 (not found) or 400 (bad request).

Even when we exclude all HttpClientResponseExceptions, the fallback is getting triggered for all HttpResponses.

Please refer to #7153 for more details. This is a draft PR raised some couple of years back but never merged.

Steps To Reproduce

Setup a declarative HttpClient like

@Client( id = "123")
interface TestClient{
    @Get
    @Produces(APPLICATION_JSON)
    @Consumes(APPLICATION_JSON)
    @Recoverable
    fun getTestData():Publisher<HttpResponse<TestData>>
}

Add a fallback client that extends the same

@Client(id = 123_FALLBACK)
interface TestClientFallback : TestClient {
    @Get
    @Produces(APPLICATION_JSON)
    @Consumes(APPLICATION_JSON)
    @Fallback(excludes = [HttpClientResponseException::class])
    override fun getTestData():Publisher<HttpResponse<TestData>>
}

Environment Information

Mac OS: 14.6.1
JDK: 17

Example Application

No response

Version

Micronaut version 4.6.3

@prabalpsr
Copy link
Author

@timyates, @yawkat - can you please look at this or suggest any workarounds. We are currently stuck with making additional calls to our fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant