Skip to content

Response interceptor not getting picked from Capability #2935

@cuteprince

Description

@cuteprince

Hi,

We recently upgraded our Feign client from version 12.5 to 13.5 and have encountered an issue post-upgrade. Specifically, the method public ResponseInterceptor enrich(ResponseInterceptor responseInterceptor) within our custom capability is no longer being executed and hence the response interceptor is not getting used at all. This method was functioning as expected prior to the upgrade.

I suspect this has something to do with the changes introduced as part of supporting multiple ResponseInterceptors (#1829), but not sure. Please provide some insights or guidance on resolving this issue.

Attaching the code for reference:

@Slf4j
public class MyInterceptor implements ResponseInterceptor, Retryer {

    @Override
    public Object intercept(InvocationContext invocationContext, Chain chain) throws Exception {
        try (Response ignored = invocationContext.response()) {
            log.info("Inside intercept method of MyInterceptor");
            return chain.next(invocationContext);
        }
    }

    @Override
    public void continueOrPropagate(RetryableException e) {
        log.info("Inside continueOrPropagate method of MyInterceptor");
        throw e;
    }

    @Override
    public Retryer clone() {
        return this;
    }
}
public class MyCapability implements Capability {

    private final MyInterceptor myInterceptor;

    public MyCapability() {
        this.myInterceptor = new MyInterceptor();
    }

    public ResponseInterceptor enrich(ResponseInterceptor responseInterceptor) {
        return myInterceptor;
    }

    public Retryer enrich(Retryer retryer) {
        return myInterceptor;
    }
}
public class MyConfig {

    @Bean
    public MyCapability myCapability() {
        return new MyCapability();
    }
}
@FeignClient(name = "myClient", url = "${myUrl}", configuration = {MyConfig.class})
public interface PartyDetailsClient {

    @PostMapping
    MyResponse getPartyDetails(@RequestBody MyRequest myRequest);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions