当前位置:网站首页>Openfeign asynchronous call problem
Openfeign asynchronous call problem
2022-07-29 04:11:00 【Java Genie】
Error message
java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:83) ~[reactor-core-3.4.15.jar:3.4.15]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP GET "/get" [ExceptionHandlingWebHandler]
edition :
springcloud alibaba 2021.0.1.0
springboot 2.7.0
gateway 3.1.1
openfeign 3.1.1
Restore scene
The gateway service passes through openfeign Call authorization service
Authorized service
@GetMapping("/get")
public String openFeignApi(){
return "asdgwe";
}
Gateway service
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class GatewayServerApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayServerApplication.class, args);
}
}
@Component
@FeignClient(value = "oauth")
public interface OauthFeign {
@GetMapping("/get")
String openFeignApi();
}
controller
@Resource
OauthFeign oauthFeign;
@GetMapping("/get")
public Object get() {
return oauthFeign.openFeignApi();
}
Request the gateway's /get They will report the above mistakes .
You need to add some configuration
- add to
HttpMessageConvertersOf bean
@Configuration
public class HttpMsgConverConfig {
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) {
return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList()));
}
}
- Asynchronous call openfeign Interface , modify controller
@Resource
OauthFeign oauthFeign;
@GetMapping("/get")
public Object get() {
CompletableFuture<Object> completableFuture = CompletableFuture.supplyAsync(() -> {
return oauthFeign.openFeignApi();
});
return completableFuture;
}
边栏推荐
- Change the value of the argument by address through malloc and pointer
- Routing knowledge
- pat A1041 Be Unique
- Who can elaborate on the semi consistent read under mysqlrc and how to reduce the deadlock probability?
- 初识C语言(3)
- 安装postgis时报找不到“POSTGIS_VERSION”这个函数
- Codeforces Round #810 (Div. 2) D. Rain (线段树差分)
- Mmdetection preliminary use
- Is the array name a pointer
- [原理] 横向渗透的几种方式
猜你喜欢

Svg -- loading animation

安装ros的laser_scan_matche库所遇到的问题(一)

Lvs+keepalived high availability deployment practical application

初识C语言(3)

店铺排名问题,如何解决?

C language to achieve three chess game (detailed explanation)

HCIP BGP

How to solve the problem of store ranking?

Copy products with one click from Taobao, tmall, 1688, wechat, jd.com, Suning, taote and other platforms to pinduoduo platform (batch upload baby details Interface tutorial)

伏英娜:元宇宙就是新一代互联网!
随机推荐
Const read only variable constant
如何查询版本的提交号
Ssl== certificate related concepts
开课!看smardaten如何分解复杂业务场景
SQL语句 关于字段转换怎么写
MySQL第四篇(完结)
MySQL第三篇
View partition table format
数据集成这个地方的过滤条件该咋写,用的啥语法?sql语法处理bizdate可以不
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)
mmdetection初步使用
Lvs+keepalived high availability deployment practical application
C declaration and initialization and assignment
Ma Zhixing entered the mass production of front loading, starting with the self-developed domain controller?
nacos注册中心
Pointer constant and constant pointer
"Weilai Cup" 2022 Niuke summer multi school training camp 1 J serval and essay (heuristic merger)
力扣面试题17.04 消失的数字||260.只出现一次的数字(内含位运算知识点)
一个公司的面试笔记
Pointer of pointer???...