pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] codelipenghui opened a new issue #3185: Re-delivery un-acked message repeated in different consumers
Date Thu, 13 Dec 2018 09:01:25 GMT
codelipenghui opened a new issue #3185: Re-delivery un-acked message repeated in different
consumers
URL: https://github.com/apache/pulsar/issues/3185
 
 
   #### Expected behavior
   
   Re-delivery un-acked message should dispatch message to one consumer in a period of ack
timout.
   
   #### Actual behavior
   
   Found that more than one consumer receive the redelivery message at the same time.
   
   ```
   [Thu Dec 13 16:55:22 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:27 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:27 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:32 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:32 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:37 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:37 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:42 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:42 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:47 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:47 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:52 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:52 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:57 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:55:57 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:56:02 CST 2018] [0338e] Hello Pulsar15.610505468878621
   [Thu Dec 13 16:56:02 CST 2018] [f48e8] Hello Pulsar15.610505468878621
   ```
   
   #### Steps to reproduce
   
   Here is the test case:
   
   ```java
   package com.zhaopin.pulsar.issues;
   
   import org.apache.pulsar.client.api.Consumer;
   import org.apache.pulsar.client.api.Message;
   import org.apache.pulsar.client.api.Producer;
   import org.apache.pulsar.client.api.PulsarClient;
   import org.apache.pulsar.client.api.PulsarClientException;
   import org.apache.pulsar.client.api.Schema;
   import org.apache.pulsar.client.api.SubscriptionType;
   
   import java.util.Date;
   import java.util.concurrent.TimeUnit;
   
   public class MultiConsumerRedeliveryIssue {
   
       public static void main(String[] args) throws PulsarClientException {
   
           String TOPIC = "persistent://public/default/multi-consumer-redelivery-test3";
   
           PulsarClient client = PulsarClient.builder()
                   .maxNumberOfRejectedRequestPerConnection(50)
                   .serviceUrl("pulsar://172.17.5.175:6650")
                   .build();
   
           Producer<byte[]> producer = client.newProducer(Schema.BYTES)
                   .topic(TOPIC)
                   .sendTimeout(500, TimeUnit.MILLISECONDS)
                   .create();
   
           Consumer<byte[]> consumer = client.newConsumer(Schema.BYTES)
                   .topic(TOPIC)
                   .subscriptionName("test")
                   .subscriptionType(SubscriptionType.Shared)
                   .ackTimeout(5, TimeUnit.SECONDS)
                   .subscribe();
   
           Consumer<byte[]> consumer2 = client.newConsumer(Schema.BYTES)
                   .topic(TOPIC)
                   .subscriptionName("test")
                   .subscriptionType(SubscriptionType.Shared)
                   .ackTimeout(5, TimeUnit.SECONDS)
                   .subscribe();
   
           new Thread(() -> {
               try {
                   do {
                       Message<byte[]> message = consumer.receive();
                       System.out.println("[" + new Date() + "] [" + consumer.getConsumerName()
+ "] "
                               + new String(message.getValue()));
                   } while (true);
               } catch (PulsarClientException e) {
                   e.printStackTrace();
               }
           }).start();
   
           new Thread(() -> {
               try {
                   do {
                       Message<byte[]> message = consumer2.receive();
                       System.out.println("[" + new Date() + "] [" + consumer2.getConsumerName()
+ "] "
                               + new String(message.getValue()));
                   } while (true);
               } catch (PulsarClientException e) {
                   e.printStackTrace();
               }
           }).start();
   
           producer.send(("Hello Pulsar" + Math.random() * 100).getBytes());
   
       }
   }
   
   ```
   
   #### System configuration
   **Pulsar version**: 2.2.0
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message