qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1526658 - in /qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms: MessageRejectedException.java impl/MessageProducerImpl.java
Date Thu, 26 Sep 2013 19:44:06 GMT
Author: rgodfrey
Date: Thu Sep 26 19:44:05 2013
New Revision: 1526658

URL: http://svn.apache.org/r1526658
Log:
QPID-5178 :  Flow detail from Rejected outcome though to MessageRejectedException

Modified:
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java?rev=1526658&r1=1526657&r2=1526658&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageRejectedException.java
Thu Sep 26 19:44:05 2013
@@ -22,8 +22,13 @@ import javax.jms.JMSException;
 
 public class MessageRejectedException extends JMSException
 {
-    public MessageRejectedException(String s)
+    public MessageRejectedException(String reason)
     {
-        super(s);
+        super(reason);
+    }
+
+    public MessageRejectedException(java.lang.String reason, java.lang.String errorCode)
+    {
+        super(reason, errorCode);
     }
 }

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java?rev=1526658&r1=1526657&r2=1526658&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
Thu Sep 26 19:44:05 2013
@@ -34,7 +34,8 @@ import javax.jms.*;
 import javax.jms.IllegalStateException;
 import java.util.UUID;
 import org.apache.qpid.amqp_1_0.type.messaging.Accepted;
-import org.apache.qpid.amqp_1_0.type.transport.*;
+import org.apache.qpid.amqp_1_0.type.messaging.Rejected;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
 
 public class MessageProducerImpl implements MessageProducer, QueueSender, TopicPublisher
 {
@@ -302,7 +303,15 @@ public class MessageProducerImpl impleme
 
         if(_syncPublish && !action.wasAccepted(_syncPublishTimeout + System.currentTimeMillis()))
         {
-            throw new MessageRejectedException("Message was rejected");
+            if (action.getOutcome() instanceof Rejected)
+            {
+                Error err = ((Rejected) action.getOutcome()).getError();
+                throw new MessageRejectedException(err.getDescription(), err.getCondition().toString());
+            }
+            else
+            {
+                throw new MessageRejectedException("Message was not accepted.  Outcome was:
" + action.getOutcome());
+            }
         }
 
         if(getDestination() != null)
@@ -486,5 +495,10 @@ public class MessageProducerImpl impleme
                 }
             }
         }
+
+        Outcome getOutcome()
+        {
+            return _outcome;
+        }
     }
 }



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


Mime
View raw message