qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Qpid getUnsettledAcks()
Date Mon, 17 Nov 2014 17:10:34 GMT
On 11/17/2014 04:28 PM, Raphael Fuchs wrote:
>   Hi all,
>
> qpid seems to be running fine on my Solaris machine, but there is one unit
> test which fails.
> I am running qpid 0.28.
>
>
> noname@solaris:~/install/qpid-
> 0.28_solaris/cpp/build/src/tests$ ./unit_test
> Running 310 test cases...
> /export/home/noname/install/qpid-0.28_solaris/cpp/src/tests/MessagingSessionTests.cpp(369):
> error in "testUnsettledAcks": check fix.session.getUnsettledAcks() == 10u
> failed [0 != 10]
> /export/home/noname/install/qpid-0.28_solaris/cpp/src/tests/MessagingSessionTests.cpp(862):
> last checkpoint
>
>
> The Source is:
> -------------------
>
> QPID_AUTO_TEST_CASE(testUnsettledAcks)
>   357 {
>   358     QueueFixture fix;
>   359     Sender sender = fix.session.createSender(fix.queue);
>   360     for (uint i = 0; i < 10; ++i) {
>   361         sender.send(Message((boost::format("Message_%1%") %
> (i+1)).str()));
>   362     }
>   363     Receiver receiver = fix.session.createReceiver(fix.queue);
>   364     for (uint i = 0; i < 10; ++i) {
>   365         BOOST_CHECK_EQUAL(receiver.fetch().getContent(),
> (boost::format("Message_%1%") % (i+1)).str());
>   366     }
>   367     BOOST_CHECK_EQUAL(fix.session.getUnsettledAcks(), 0u);
>   368     fix.session.acknowledge();
>   369     BOOST_CHECK_EQUAL(fix.session.getUnsettledAcks(), 10u); // this
> one fails
>   370     fix.session.sync();
>   371     BOOST_CHECK_EQUAL(fix.session.getUnsettledAcks(), 0u);
>   372 }
>
>
> So getUnsettledAcks() seems to fail. Can someone tell me what
> getUnsettledAcks() does and if it is an important function?

It gives a count of the number of messages that have been acknowledged 
by the application, but for which the confirmation of the 
acknowledgement from the broker has not yet been received.

It is not often used in my experience.

The test above is actually fragile anyway. There is a race between the 
testing thread checking the return value after the acknowledge (line 369 
as quoted above) and the response coming back from the server. Though 
the application thread would usually win, there is no way of 
guaranteeing that.

The method is actually pretty hard to test, which again leads me to 
suspect that it is not that much use in practice.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message