rocketmq: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED
code:
public static void main(String[] args) throws ClientException {
String endpoint = "localhost:9876";
String topic = "TopicTest";
ClientServiceProvider clientServiceProvider = ClientServiceProvider.loadService();
ClientConfigurationBuilder clientConfigurationBuilder = ClientConfiguration.newBuilder().setEndpoints(endpoint);
ClientConfiguration build = clientConfigurationBuilder.build();
Producer producer = clientServiceProvider.newProducerBuilder().setTopics(topic)
.setClientConfiguration(build)
.build();
Message message = clientServiceProvider.newMessageBuilder()
.setTag(topic)
.setKeys("messageKey")
.setTag("messageTag")
.setBody("messageBody".getBytes(StandardCharsets.UTF_8))
.build();
SendReceipt send = producer.send(message);
System.out.println(send.getMessageId());
}
Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 23 (5 by maintainers)
我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善
没有设置账户密码,是可以不填的。连接使用的端口是proxy的端口,不是9876. 例如proxy.json配置为
{ "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" }那连接的 endpoints = “localhost:18082”