如何在假客户端中为API分别设置不同的读取超时?

问题描述

我在spring boot应用程序中使用feign客户端,并且我想为不同的调用配置单独的超时,例如,如果我有update和create调用,并且我想为update = 3000和create = 12000设置读取超时,我该怎么办?

@FeignClient(name = "product-service")
public interface ProductClient {

    @PostMapping(value = "/product/create")
    public ProductCreation productCreationExternalRequest(@RequestBody ProductCreationRequest productCreationRequest);
    
    @PostMapping(value = "/product/update")
    public ProductCreation productUpdateExternalRequest(@RequestBody ProductCreationRequest productCreationRequest );
    
}

我的服务类别是:


    public class  MyService {
    .
    .
    productCreationResponse = productClient.productCreationExternalRequest(productCreationRequest);
    ..
    productupdateResponse = productClient.productUpdateExternalRequest(productCreationRequest);
    
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)