You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/11/16 13:43:33 UTC

[GitHub] [rocketmq] MountainOne commented on issue #1588: Retry doesn't work when sending msg in aync mode(eg. when broker is down)

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:
users@infra.apache.org


With regards,
Apache Git Services