You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/04/30 16:10:00 UTC

svn commit: r1591300 - in /qpid/trunk/qpid/cpp: include/qpid/messaging/exceptions.h src/qpid/messaging/amqp/ConnectionContext.cpp src/qpid/messaging/exceptions.cpp

Author: gsim
Date: Wed Apr 30 14:10:00 2014
New Revision: 1591300

URL: http://svn.apache.org/r1591300
Log:
QPID-5736: only block until sent message is settled; signal rejection by throwing exception

Modified:
    qpid/trunk/qpid/cpp/include/qpid/messaging/exceptions.h
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
    qpid/trunk/qpid/cpp/src/qpid/messaging/exceptions.cpp

Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/exceptions.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/exceptions.h?rev=1591300&r1=1591299&r2=1591300&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/exceptions.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/exceptions.h Wed Apr 30 14:10:00 2014
@@ -137,6 +137,15 @@ struct QPID_MESSAGING_CLASS_EXTERN SendE
 };
 
 /**
+ * Thrown on a synchronous send to indicate that the message being
+ * sent was rejected.
+ */
+struct QPID_MESSAGING_CLASS_EXTERN MessageRejected : public SendError
+{
+    QPID_MESSAGING_EXTERN MessageRejected(const std::string&);
+};
+
+/**
  * Thrown to indicate that the sender attempted to send a message that
  * would result in the target node on the peer exceeding a
  * preconfigured capacity.

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp?rev=1591300&r1=1591299&r2=1591300&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp Wed Apr 30 14:10:00 2014
@@ -399,10 +399,14 @@ void ConnectionContext::send(boost::shar
     }
     wakeupDriver();
     if (sync && delivery) {
-        while (!delivery->accepted()) {
+        while (!delivery->delivered()) {
             QPID_LOG(debug, "Waiting for confirmation...");
             wait(ssn, snd);//wait until message has been confirmed
         }
+        if (delivery->rejected()) {
+            throw MessageRejected("Message was rejected by peer");
+        }
+
     }
 }
 

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/exceptions.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/exceptions.cpp?rev=1591300&r1=1591299&r2=1591300&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/exceptions.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/exceptions.cpp Wed Apr 30 14:10:00 2014
@@ -44,6 +44,7 @@ NoMessageAvailable::NoMessageAvailable()
 
 SenderError::SenderError(const std::string& msg) : LinkError(msg) {}
 SendError::SendError(const std::string& msg) : SenderError(msg) {}
+MessageRejected::MessageRejected(const std::string& msg) : SendError(msg) {}
 TargetCapacityExceeded::TargetCapacityExceeded(const std::string& msg) : SendError(msg) {}
 
 SessionError::SessionError(const std::string& msg) : MessagingException(msg) {}



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