summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/perftest.cpp
diff options
context:
space:
mode:
authorCarl C. Trieloff <cctrieloff@apache.org>2007-10-01 20:13:45 +0000
committerCarl C. Trieloff <cctrieloff@apache.org>2007-10-01 20:13:45 +0000
commit4f6f7d9c89cfa1d10dba1f54e8260250cf1d6fca (patch)
tree5a9d310e18b9d2e0ef9e758b868ad398727ab2c7 /qpid/cpp/src/tests/perftest.cpp
parent585edcdee929d0ebd5f367ec2abf4e2f79ccfb99 (diff)
downloadqpid-python-4f6f7d9c89cfa1d10dba1f54e8260250cf1d6fca.tar.gz
- add option to create durable messages.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@581057 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/perftest.cpp')
-rw-r--r--qpid/cpp/src/tests/perftest.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/perftest.cpp b/qpid/cpp/src/tests/perftest.cpp
index 9d5ea593fe..3b6859eff9 100644
--- a/qpid/cpp/src/tests/perftest.cpp
+++ b/qpid/cpp/src/tests/perftest.cpp
@@ -26,6 +26,7 @@
#include "qpid/client/Queue.h"
#include "qpid/client/Connection.h"
#include "qpid/client/MessageListener.h"
+#include <qpid/client/Message.h>
#include "qpid/QpidError.h"
#include "qpid/sys/Monitor.h"
#include "qpid/sys/Time.h"
@@ -47,12 +48,14 @@ struct Opts : public TestOptions {
bool listen;
bool publish;
int count;
+ bool durable;
Opts() : listen(false), publish(false), count(500000) {
addOptions()
("listen", optValue(listen), "Consume messages.")
("publish", optValue(publish), "Produce messages.")
- ("count", optValue(count, "N"), "Messages to send/receive.");
+ ("count", optValue(count, "N"), "Messages to send/receive.")
+ ("durable", optValue(durable, "N"), "Publish messages as durable.");
}
};
@@ -195,6 +198,10 @@ void PublishThread::run() {
if (::clock_gettime(CLOCK_REALTIME, &startTime))
throw Exception(QPID_MSG("clock_gettime failed: " << strError(errno)));
+ bool durable = opts.durable;
+ if (durable)
+ msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
+
for (int i=0; i<count; i++) {
msg.setData("Message 0123456789 ");
channel.publish(msg, Exchange::STANDARD_TOPIC_EXCHANGE, queueName);