2019-08-27 13:57:29 UTC - Jianfeng Qiao: While using cpp client, I create a
consumer and subscription on a topic, the consumer cannot redeliver the unacked
message if I keep changing the time of server running the consumer back and
forth.
----
2019-08-27 13:59:21 UTC - Jianfeng Qiao: I investigate the code and find out
the following code:
void UnAckedMessageTrackerEnabled::timeoutHandler() {
timeoutHandlerHelper();
ExecutorServicePtr executorService =
client_->getIOExecutorProvider()->get();
timer_ = executorService->createDeadlineTimer();
timer_->expires_from_now(boost::posix_time::milliseconds(timeoutMs_));
timer_->async_wait([&](const boost::system::error_code& ec) {
if (ec) {
LOG_DEBUG("Ignoring timer cancelled event, code[" << ec
<< "]");
} else {
timeoutHandler();
}
});
}
If I change the time forward before expires_from_now() and afterward after
executing expires_from_now(), there will be problem for consumer to redeliver
the message
----
2019-08-27 14:33:31 UTC - Jianfeng Qiao: I read the doc about deadline
timer(<https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/deadline_timer.html>),
it seems expires_from_now() is using relative time, so I don't quite
understand why it is affected by the time change. Anyone have idea about this?
----
2019-08-27 15:46:52 UTC - Matteo Merli: even if the specified time is
“relative” from the timer API perspective, that doesn’t mean that the internal
timer is independent from the system clock
----
2019-08-27 15:47:29 UTC - Matteo Merli: typically there are multiple clock
types on linux (and other systems have different ways too).
----
2019-08-28 00:59:32 UTC - Jianfeng Qiao: @Matteo Merli Is there a way to solve
it?
----
2019-08-28 01:18:32 UTC - Matteo Merli: We’d need to use std::steady_timer when
constructing the Boost Asio deadline_timer. Something like described in
<https://stackoverflow.com/questions/16721243/boostasiodeadline-timer-with-stdchrono-time-values>
----
2019-08-28 01:26:33 UTC - Jianfeng Qiao: Ok, I'll have a try on this,
thanks.:slightly_smiling_face:
----
2019-08-28 06:22:23 UTC - Vladimir Shchur: Anyone? I'm writing a dotnet client
and don't understand why pending messages are not discarded exceptionally in
case of successful close call.
----
2019-08-28 08:33:25 UTC - Eugene: @Eugene has joined the channel
----