You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Rabih M <ra...@gmail.com> on 2019/05/06 16:17:45 UTC
[Proton Cpp] Auto acknowledge for delivery is not guaranteed
Hello,
The flag proton::receiver_options().auto_accept(true), if set does not
guarantee that the user can't make any action on the delivery.
There is a race condition on who sends the request before, the user or
proton.
The following example fails randomly (The example is taken from the
imperative POC):
Broker brk("//127.0.0.1:5672", "examples");
std::vector<proton::message> msgs{ proton::message("msg1")};
brk.injectMessages(msgs);
{
proton::Container cont;
proton::Connection conn = cont.openConnection("//127.0.0.1:5672",
proton::connection_options());
proton::Session sess = conn.openSession(proton::session_options());
proton::Receiver rec = sess.openReceiver("examples",
proton::receiver_options()*.auto_accept(true)*);
proton::Delivery del1 = rec.receive().get(); // should auto
acknowledge
del1.reject();
}
ASSERT_EQ(1, brk.m_acceptedMsgs); // is 0 if reject is done first
ASSERT_EQ(0, brk.m_rejectedMsgs); // is 1 if reject is done first
This can be easily handled on the proton cpp level: The user action can be
a no op. WDYT?
Used proton version: 0.27.1
Best regards,
Rabih