merlimat commented on issue #2221: Getting UnAckedMessageTracker messages have 
timed-out without a reason
URL: 
https://github.com/apache/incubator-pulsar/issues/2221#issuecomment-407549937
 
 
   @IdanFridman 
   
   Got to reproduce it with this simple code: 
   
   ```java
   PulsarClient client = PulsarClient.builder()
                   .serviceUrl("pulsar://localhost:6650")
                   .build();
   
   Consumer<byte[]> consumer = client.newConsumer()
            .topic("my-topic")
            .subscriptionName("test")
            .subscriptionType(SubscriptionType.Shared)
            .ackTimeout(3, TimeUnit.SECONDS)
            .subscribe();
   
   ExecutorService executor = Executors.newCachedThreadPool();
   
   // Consume from multiple threads
   for (int i = 0; i < 100; i++) {
       executor.execute(() -> {
           try {
               while (true) {
                   Message<byte[]> msg = consumer.receive();
                   System.out.println("Received " + msg.getMessageId());
   
                   Thread.sleep(random.nextInt(150));
   
                   consumer.acknowledgeAsync(msg);
               }
           } catch (Exception e) {
               e.printStackTrace();
           }
       });
   }
   ```
   
   Interestinly it only happens when the sleep is inserted. I'll dig more to 
see what's happening

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to