summaryrefslogtreecommitdiff
path: root/cpp/src/tests/perftest.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-11-07 21:01:26 +0000
committerAlan Conway <aconway@apache.org>2007-11-07 21:01:26 +0000
commit5c952db3bb1fad90ea4f5de985453d13dce45e7c (patch)
tree0670b6a55a21b099bfe7ef283e3230782b592ce8 /cpp/src/tests/perftest.cpp
parent0a6761806f55ad18d65e2c22cd18a08e2ec5a149 (diff)
downloadqpid-python-5c952db3bb1fad90ea4f5de985453d13dce45e7c.tar.gz
auto-ack support for perftest.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592897 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/perftest.cpp')
-rw-r--r--cpp/src/tests/perftest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpp/src/tests/perftest.cpp b/cpp/src/tests/perftest.cpp
index 80157da7f4..c775407cdf 100644
--- a/cpp/src/tests/perftest.cpp
+++ b/cpp/src/tests/perftest.cpp
@@ -44,10 +44,11 @@ struct Opts : public TestOptions {
bool durable;
int consumers;
std::string mode;
+ int autoAck;
Opts() :
listen(false), publish(false), count(500000), size(64), consumers(1),
- mode("shared")
+ mode("shared"), autoAck(100)
{
addOptions()
("listen", optValue(listen), "Consume messages.")
@@ -56,7 +57,8 @@ struct Opts : public TestOptions {
("size", optValue(size, "BYTES"), "Size of messages.")
("durable", optValue(durable, "N"), "Publish messages as durable.")
("consumers", optValue(consumers, "N"), "Number of consumers.")
- ("mode", optValue(mode, "shared|fanout|topic"), "consume mode");
+ ("mode", optValue(mode, "shared|fanout|topic"), "consume mode")
+ ("auto-ack", optValue(autoAck, "N"), "ack every N messages.");
}
};
@@ -219,12 +221,14 @@ void ListenThread::run() {
session.messageTransfer(arg::content=Message("ready", "control"));
SubscriptionManager subs(session);
- LocalQueue consume;
+ LocalQueue consume(AckPolicy(opts.autoAck));
subs.subscribe(consume, consumeQueue);
int consumed=0;
AbsTime start=now();
- while (consume.pop().getData() != "done")
+ Message msg;
+ while ((msg=consume.pop()).getData() != "done")
++consumed;
+ msg.acknowledge(); // Ack all outstanding messages.
AbsTime end=now();
// Report to publisher.