You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2011/02/11 19:33:25 UTC

svn commit: r1069916 - /qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp

Author: aconway
Date: Fri Feb 11 18:33:25 2011
New Revision: 1069916

URL: http://svn.apache.org/viewvc?rev=1069916&view=rev
Log:
QPID-3049 - qpid-send --durable does not send durable messages.

The qpid-send test client with argument --durable only sends the first
message as durable. Subsequent messages are not durable.

Modified:
    qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp?rev=1069916&r1=1069915&r2=1069916&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/qpid-send.cpp Fri Feb 11 18:33:25 2011
@@ -272,7 +272,11 @@ int main(int argc, char ** argv)
             if (opts.priority) {
                 msg.setPriority(opts.priority);
             }
-            if (!opts.replyto.empty()) msg.setReplyTo(Address(opts.replyto));
+            if (!opts.replyto.empty()) {
+                if (opts.flowControl)
+                    throw Exception("Can't use reply-to and flow-control together");
+                msg.setReplyTo(Address(opts.replyto));
+            }
             if (!opts.userid.empty()) msg.setUserId(opts.userid);
             if (!opts.correlationid.empty()) msg.setCorrelationId(opts.correlationid);
             opts.setProperties(msg);
@@ -311,13 +315,17 @@ int main(int argc, char ** argv)
                 if (opts.timestamp)
                     msg.getProperties()[TS] = int64_t(
                         qpid::sys::Duration(qpid::sys::EPOCH, qpid::sys::now()));
-                if (opts.flowControl && ((sent % opts.flowControl) == 0)) {
-                    msg.setReplyTo(flowControlAddress);
-                    ++flowSent;
+                if (opts.flowControl) {
+                    if ((sent % opts.flowControl) == 0) {
+                        msg.setReplyTo(flowControlAddress);
+                        ++flowSent;
+                    }
+                    else
+                        msg.setReplyTo(Address()); // Clear the reply address.
                 }
-
                 sender.send(msg);
                 reporter.message(msg);
+
                 if (opts.tx && (sent % opts.tx == 0)) {
                     if (opts.rollbackFrequency &&
                         (++txCount % opts.rollbackFrequency == 0))
@@ -337,7 +345,6 @@ int main(int argc, char ** argv)
                     int64_t delay = qpid::sys::Duration(qpid::sys::now(), waitTill);
                     if (delay > 0) qpid::sys::usleep(delay/qpid::sys::TIME_USEC);
                 }
-                msg = Message(); // Clear out contents and properties for next iteration
             }
             for ( ; flowSent>0; --flowSent)
                 flowControlReceiver.get(Duration::SECOND);



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org