HFFZZZ opened a new issue, #90:
URL: https://github.com/apache/rocketmq-docker/issues/90

   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)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to