public Mono handle(SocketChannel socketChannel) throws IOException { return Mono.fromRunnable(() -> { try { Message sendMsg = new Message("DemoTopic", "DemoTag", socketChannel); DefaultMQProducer defaultMQProducer = SpringUtils.getBean("producer"); // 默认3秒超时 SendResult sendResult = defaultMQProducer.send(sendMsg); } catch (Exception e) { log.info("get responseJsonBody fail."); } }); }

spring webFlux修改以下代码public MonoVoid handleSocketChannel socketChannel throws IOException return Monodefer - try Message sendMsg = new MessageDemoTop

原文地址: https://www.cveoy.top/t/topic/fe17 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录