MountainOne commented on issue #1588: Retry doesn't work when sending msg in 
aync mode(eg. when broker is down)
URL: https://github.com/apache/rocketmq/issues/1588#issuecomment-554638653
 
 
   Message retry resynchronization in RocketMQ is implemented by calling the 
`sendKeynelImpl()` method in a for loop in 
`DefaultMQProducerImpl#sendDefaultImpl()`. The number of retries is obtained by 
`DefaultMQProducer#getRetryTimesWhenSendFailed()`.
   Asynchronous message sending retry is implemented by 
`MQClientAPIImpl#onExceptionImpl()` recursively calling 
`MQClientAPIImpl#sendMessageAsync()` method in case of exception. The number of 
retries is obtained by 
`DefaultMQProducerImpl#.getRetryTimesWhenSendAsyncFailed()`. The default value 
is 2.
   Therefore, if you do not set the number of asynchronous retries, you will 
retry at least 2 times, and the message will not be sent because there is no 
retry. Only the location of the asynchronous and synchronous send retry 
implementations is different, resulting in such a judgment.
   
   在 RocketMQ 中同步的消息发送重试是通过`DefaultMQProducerImpl#sendDefaultImpl()`中的 for 
循环,循环调用`sendKeynelImpl()`方法实现的。重试次数由`DefaultMQProducer#getRetryTimesWhenSendFailed()`获得。
   
而异步的消息发送重试是在出现异常的情况下,由`MQClientAPIImpl#onExceptionImpl()`递归调用`MQClientAPIImpl#sendMessageAsync()`方法实现的。重试次数由`DefaultMQProducerImpl#.getRetryTimesWhenSendAsyncFailed()`获得,缺省值为
 2。
   所以在不设置异步重试次数的情况下,也会至少重试 2 次,不会因为没有重试而导致消息发送失败。只是异步和同步发送重试实现的位置不一样,导致产生了这样判断。

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to