qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cctriel...@apache.org
Subject svn commit: r581057 - /incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp
Date Mon, 01 Oct 2007 20:13:45 GMT
Author: cctrieloff
Date: Mon Oct  1 13:13:45 2007
New Revision: 581057

URL: http://svn.apache.org/viewvc?rev=581057&view=rev
Log:
- add option to create durable messages.


Modified:
    incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp?rev=581057&r1=581056&r2=581057&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp Mon Oct  1 13:13:45 2007
@@ -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 @@
     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 @@
     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);



Mime
View raw message