Genuineh opened a new issue, #21862:
URL: https://github.com/apache/pulsar/issues/21862

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   OS:
   NAME="openEuler"
   VERSION="22.03 LTS"
   ID="openEuler"
   VERSION_ID="22.03"
   PRETTY_NAME="openEuler 22.03 LTS"
   ANSI_COLOR="0;31"
   Kernel: 5.10.0-60.117.0.144.oe2203.x86_64
   Pulsar: 3.0.0
   Client: java 3.0.2
   
   ### Minimal reproduce step
   
   1.create consumer with enable retry
   ```java
   Consumer consumer = client.newConsumer()
           .topic(topic)
           .subscriptionName("_sub" + topic)
           .enableRetry(true)
           .subscriptionType(SubscriptionType.Shared)
           .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
           .deadLetterPolicy(DeadLetterPolicy.builder()
                   .maxRedeliverCount(5)
                   .build())
           .subscribe();
   ```
   2.send message
   3.recevie and call reconsumeLater
   ```java
   Integer times = 0;
   long lastTime = 0;
   while (true) {
       try {
           Message msg = consumer.receive();
           System.out.println("consumer receive content: " + new 
String(msg.getData()));
           MessageId receMsgId = msg.getMessageId();
           System.out.println("consumer receive: " + receMsgId);
           Map<String, String> maps = msg.getProperties();
           System.out.println("consumer receive properties: " + maps);
           long time = Instant.now().toEpochMilli();
           System.out.println("consumer receive time: " + time + "ms");
           int diff = (int) (time - lastTime);
           diff = diff < 0 ? 0 : diff;
           System.out.println("consumer receive diff: " + diff + "ms");
           times++;
           consumer.reconsumeLater(msg, 5, TimeUnit.SECONDS);
           lastTime = time;
       } catch (Exception e) {
           System.out.println("consumer receive error: " + e.getMessage());
       }
   }
   ```
   
   ### What did you expect to see?
   
   When receiving the second message, there was a delay of 5 seconds compared 
to the previous time, and it was returned from the retry message queue.
   
   ### What did you see instead?
   
   producer send: 732:0:-1
   producer send content: 1704678948349
   
   #### first:
   consumer receive content: 1704678948349
   consumer receive: 732:0:-1
   consumer receive properties: {}
   consumer receive time: 1704678948369ms
   consumer receive diff: 0ms
   
   #### second:
   consumer receive content: 1704678948349
   consumer receive: 731:0:-1
   consumer receive properties: 
{REAL_TOPIC=persistent://public/default/test-retry, ORIGIN_MESSAGE_ID=732:0:-1, 
ORIGIN_MESSAGE_IDY_TIME=732:0:-1, DELAY_TIME=5000, RECONSUMETIMES=1}
   consumer receive time: 1704678948399ms
   consumer receive diff: 30ms
   
   #### third:
   consumer receive content: 1704678948349
   consumer receive: 731:1:-1
   consumer receive properties: 
{REAL_TOPIC=persistent://public/default/test-retry, ORIGIN_MESSAGE_ID=732:0:-1, 
ORIGIN_MESSAGE_IDY_TIME=732:0:-1, DELAY_TIME=5000, RECONSUMETIMES=2}
   consumer receive time: 1704678948417ms
   consumer receive diff: 18ms
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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