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 #3077: Client do not receive messages but messages already send to the dead letter topic.
Date Wed, 28 Nov 2018 07:08:55 GMT
codelipenghui opened a new issue #3077: Client do not receive messages but messages already
send to the dead letter topic.
URL: https://github.com/apache/pulsar/issues/3077
 
 
   #### Expected behavior
   
   User process the same message many times but failed, if user set a dead letter policy,
when message process times exceed the max redelivery count in dead letter policy, message
will send to the dead letter topic.
   
   #### Actual behavior
   
   When a consumer subscribe a topic, but wait a while then start receive messages, but messages
already send to dead letter topic.
   
   #### Steps to reproduce
   
   Here is the code to reproduce
   
   ```java
   public class RedeliveryIssue {
   
       public static void main(String[] args) throws PulsarClientException, InterruptedException
{
   
           final String topic = "my-topic";
   
           PulsarClient client = PulsarClient.builder()
                   .serviceUrl("pulsar://localhost:6650")
                   .build();
   
           Consumer<byte[]> consumer = client.newConsumer()
                   .topic(topic)
                   .subscriptionType(SubscriptionType.Shared)
                   .subscriptionName(UUID.randomUUID().toString())
                   .ackTimeout(3, TimeUnit.SECONDS)
                   .deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(2).build())
                   .subscribe();
   
           Producer<byte[]> producer = client.newProducer()
                   .topic(topic)
                   .create();
   
           producer.send(("a message").getBytes());
   
           // wait a while, message will send to dead letter topic
           Thread.sleep(10000L);
   
           do {
               // can't receive message
               Message<byte[]> msg = consumer.receive();
               System.out.println(new String(msg.getValue()));
           } while (true);
       }
   }
   ```
   
   #### 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