9ft commented on pull request #616:
URL: https://github.com/apache/pulsar-client-go/pull/616#issuecomment-919839320


   > Does this work on other clients like the java one?
   
   Tested with the same parameters as the go test case, the Java client will 
retry the message as expected.
   
   ```java
   MessageListener myMessageListener = (consumer, msg) -> {
       System.out.println((new Date()) + " recv msg: " + new 
String(msg.getData()));
       consumer.reconsumeLater(msg, 2, TimeUnit.SECONDS);
   };
   
   String topicName = "persistent://public/default/my-topic";
   
   client.newConsumer()
           .topic(topicName + "-partition-0")  // specified partition topic
           .subscriptionName("my-sub01")
           .subscriptionType(SubscriptionType.Shared)
           .deadLetterPolicy(DeadLetterPolicy.builder()
                   .maxRedeliverCount(3)
                   .build())
           .enableRetry(true)
           .messageListener(myMessageListener)
           .subscribe();
   
   Producer<byte[]> producer = client.newProducer()
           .topic(topicName)
           .create();
   
   producer.send("My message".getBytes());
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to