You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/15 09:07:38 UTC

[GitHub] [pulsar-client-go] 9ft commented on pull request #616: [Issue 615] Fix retry on specified-partition topic

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: commits-unsubscribe@pulsar.apache.org

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