GitHub user startjava added a comment to the discussion: How to achieve the 
effect of maximum delay time in retransmission backoff mechanism

@codelipenghui 

```
    @RequestMapping("sendMessage5")
    public String sendMessage5() throws PulsarClientException {
        String messageValue = "我是消息";
        producer3.send(messageValue);
        return "成功生产5";
    }
```

```
@Component
public class MyMessageListener2 implements MessageListener {
    @Override
    public void received(Consumer consumer, Message msg) {
        String messageValue = new String(msg.getData());
        messageValue = messageValue.split("\\_")[0];
        System.out.println("timeList.add(\"" + System.currentTimeMillis() + 
"\");");
        consumer.negativeAcknowledge(msg);
    }
}
```


```
    @Bean
    public Consumer createPulsarConsumer_myTopic2() throws 
PulsarClientException {
        Consumer consumer = 
pulsarClient.newConsumer().topic(myTopic2).subscriptionName(myTopic2_subscriptionName).messageListener(myMessageListener2).subscriptionType(SubscriptionType.Shared).negativeAckRedeliveryBackoff(MultiplierRedeliveryBackoff.builder()
                .minDelayMs(1000)
                .maxDelayMs(60 * 1000)
                .build()).subscribe();
        return consumer;
    }
```

run result the intervals are as follows:
1080
2389
4297
8500
16284
32255
60067

but doc url:
https://pulsar.apache.org/docs/concepts-messaging/#negative-acknowledgement
say +10s,but i run result no +10s,
i code wrong or doc wrong ??
thank you !


GitHub link: 
https://github.com/apache/pulsar/discussions/18261#discussioncomment-4017738

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to