apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

Unable to Send and Consume Messages in RocketMQ5.x Proxy Mode with Spring Boot3 and JDK 17 and Rocketmq starter #8088

Open radish172521 opened 5 months ago

radish172521 commented 5 months ago

Before Creating the Bug Report

Runtime platform environment

windows, linux

RocketMQ version

version : 5.1.2

JDK Version

jdk17

Describe the Bug

I am currently working on a Spring Boot 3 and Rocketmq starter project with JDK 17 , and I want to use RocketMQ 5.x in Proxy mode. To achieve this, I added the following configuration to my project: META-INF\spring\org.springframework.boot.autoconfigure.AutoConfiguration.imports, with the content org.apache.rocketmq.spring.autoconfigure.RocketMQAutoConfiguration.

With the current configuration, setting rocketmq.name-server=xxx allows successful production and consumption of messages. However, when I switch to RocketMQ proxy mode by setting rocketmq.name-server=proxy remotingListenPort, the project starts normally but fails to send or consume messages.

Here’s the error message I encounter: Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxx:xxx> failed at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.invokeSyncImpl(NettyRemotingAbstract.java:491) at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:551) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1991) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1982) at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:781) ... 25 common frames omitted Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxx:xxx> failed at org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:70) at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.lambda$executeInvokeCallback$2(NettyRemotingAbstract.java:402) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Start destroying Publisher 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Destruction of the end 2024-05-02 18:30:24.363 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Start destroying common HttpClient 2024-05-02 18:30:24.364 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Destruction of the end

Steps to Reproduce

I am currently working on a Spring Boot 3 project with JDK 17, and I want to use RocketMQ 5.x in proxy mode. To achieve this, I added the following configuration to my project: META-INF\spring\org.springframework.boot.autoconfigure.AutoConfiguration.imports, with the content org.apache.rocketmq.spring.autoconfigure.RocketMQAutoConfiguration.

With the current configuration, setting rocketmq.name-server=xxx allows successful production and consumption of messages. However, when I switch to RocketMQ proxy mode by setting rocketmq.name-server=proxy remotingListenPort, the project starts normally but fails to send or consume messages.

Here’s the error message I encounter: Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxx:xxx> failed at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.invokeSyncImpl(NettyRemotingAbstract.java:491) at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:551) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1991) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1982) at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:781) ... 25 common frames omitted Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxx:xxx> failed at org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:70) at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.lambda$executeInvokeCallback$2(NettyRemotingAbstract.java:402) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Start destroying Publisher 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Destruction of the end 2024-05-02 18:30:24.363 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Start destroying common HttpClient 2024-05-02 18:30:24.364 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Destruction of the end

What Did You Expect to See?

Expect normal consumer/producer work successfully.

What Did You See Instead?

Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxx> failed at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.invokeSyncImpl(NettyRemotingAbstract.java:491) at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:551) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1991) at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1982) at org.apache.rocketmq.client.impl.factory.MQClientInstance.updateTopicRouteInfoFromNameServer(MQClientInstance.java:781) ... 25 common frames omitted Caused by: org.apache.rocketmq.remoting.exception.RemotingSendRequestException: send request to </xxxxx> failed at org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:70) at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract.lambda$executeInvokeCallback$2(NettyRemotingAbstract.java:402) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Start destroying Publisher 2024-05-02 18:30:24.363 [Thread-7] WARN com.alibaba.nacos.common.notify.NotifyCenter - [NotifyCenter] Destruction of the end 2024-05-02 18:30:24.363 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Start destroying common HttpClient 2024-05-02 18:30:24.364 [Thread-1] WARN c.alibaba.nacos.common.http.HttpClientBeanHolder - [HttpClientBeanHolder] Destruction of the end

Additional Context

I hope this compatibility issue is resolved , Or how to use proxy correctly?

drpmma commented 5 months ago

It seems that the request is not sent to the proxy. Maybe you should debug the proxy and see whether the request reaches the proxy.