Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error Caused by: java.util.concurrent.CancellationException: Task was cancelled. #90

Open
HFFZZZ opened this issue Aug 23, 2023 · 5 comments

Comments

@HFFZZZ
Copy link

HFFZZZ commented Aug 23, 2023

Why do I have no problem executing quickstart environment inside docker when I start docker, but I use java client to connect, there will be this exception, ask for help

java
public static void main(String[] args) throws ClientException, IOException, InterruptedException {
final ClientServiceProvider provider = ClientServiceProvider.loadService();
// 接入点地址,需要设置成Proxy的地址和端口列表,一般是xxx:8081;xxx:8081。
String endpoints = "xx.xx.xx.xx:8081";
ClientConfiguration clientConfiguration = ClientConfiguration.newBuilder()
.setEndpoints(endpoints)
.build();
// 订阅消息的过滤规则,表示订阅所有Tag的消息。
String tag = "*";
FilterExpression filterExpression = new FilterExpression(tag, FilterExpressionType.TAG);
// 为消费者指定所属的消费者分组,Group需要提前创建。
String consumerGroup = "YourConsumerGroup";
// 指定需要订阅哪个目标Topic,Topic需要提前创建。
String topic = "TestTopic";
// 初始化PushConsumer,需要绑定消费者分组ConsumerGroup、通信参数以及订阅关系。
PushConsumer pushConsumer = provider.newPushConsumerBuilder()
.setClientConfiguration(clientConfiguration)
// 设置消费者分组。
.setConsumerGroup(consumerGroup)
// 设置预绑定的订阅关系。
.setSubscriptionExpressions(Collections.singletonMap(topic, filterExpression))
// 设置消费监听器。
.setMessageListener(new MessageListener() {
@OverRide
public ConsumeResult consume(MessageView messageView) {
System.out.println(messageView.toString());
ByteBuffer body = messageView.getBody();
String strbody =new String(body.array());
System.out.println(strbody);
//return ConsumeResult.SUCCESS;
return null;
}
})
.build();
//Thread.sleep(Long.MAX_VALUE);
// 如果不需要再使用 PushConsumer,可关闭该实例。
// pushConsumer.close();
}

error
Caused by: java.util.concurrent.CancellationException: Task was cancelled.
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.cancellationExceptionWithCause(AbstractFuture.java:1543)
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:586)
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567)
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
at org.apache.rocketmq.client.java.impl.ClientImpl.startUp(ClientImpl.java:188)
at org.apache.rocketmq.client.java.impl.consumer.PushConsumerImpl.startUp(PushConsumerImpl.java:161)
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62)
at org.apache.rocketmq.shaded.com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)

@HappyAxin
Copy link

Did you solve it? I'm having the same problem now.

@dingshuangxi888
Copy link

When using a proxy, please confirm whether the server's port 8081 is open to external connections.

@canghailan
Copy link

用docker部署rocketmq遇到了同样的问题,启动broker时去掉--enable-proxy,独立部署proxy就没有问题了

rocketmq-v5-x-caused-by-java-util-concurrent-cancellationexception-task-was-ca

@darkingG
Copy link

rocketmq5.2.0,在conf/rmq-proxy.json文件加上"remotingListenPort": 8080属性解决

@Li-x-r
Copy link

Li-x-r commented Aug 19, 2024

remotingListenPort和grpcServerPort需配置,docker环境下,映射端口和remotingListenPort和grpcServerPort需一致

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants