You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/01/08 23:28:41 UTC

git commit: https://issues.apache.org/jira/browse/AMQ-4741

Updated Branches:
  refs/heads/trunk be8990e06 -> efc51fa44


https://issues.apache.org/jira/browse/AMQ-4741

Set state to accepted if message received is properly handled.  

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/efc51fa4
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/efc51fa4
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/efc51fa4

Branch: refs/heads/trunk
Commit: efc51fa4487f80027a1ff95de7e5bd7479eaab47
Parents: be8990e
Author: Timothy Bish <ta...@gmai.com>
Authored: Wed Jan 8 17:28:39 2014 -0500
Committer: Timothy Bish <ta...@gmai.com>
Committed: Wed Jan 8 17:28:39 2014 -0500

----------------------------------------------------------------------
 .../transport/amqp/AmqpProtocolConverter.java   |  1 +
 .../activemq/transport/amqp/JMSClientTest.java  | 33 ++++++++++----------
 2 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/efc51fa4/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
index 1af64e3..78ee912 100644
--- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
+++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
@@ -579,6 +579,7 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
                         }
                     }
                     receiver.flow(1);
+                    delivery.disposition(Accepted.getInstance());
                     delivery.settle();
                     pumpProtonToSocket();
                 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/efc51fa4/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
index 4813514..4002ef2 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
@@ -47,7 +47,6 @@ import org.apache.activemq.util.Wait;
 import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
 import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
 import org.apache.qpid.amqp_1_0.jms.impl.TopicImpl;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -353,33 +352,22 @@ public class JMSClientTest extends AmqpTestSupport {
         assertNull(message);
     }
 
-    @Ignore
     @Test(timeout=30000)
-    public void testTTL() throws Exception {
+    public void testSyncSends() throws Exception {
+        ActiveMQAdmin.enableJMSFrameTracing();
         Connection connection = null;
         try {
             QueueImpl queue = new QueueImpl("queue://" + name);
-            connection = createConnection();
+            connection = createConnection(true);
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
             connection.start();
             MessageProducer producer = session.createProducer(queue);
-            producer.setTimeToLive(1000);
+            producer.setDeliveryMode(DeliveryMode.PERSISTENT);
             Message toSend = session.createTextMessage("Sample text");
             producer.send(toSend);
             MessageConsumer consumer = session.createConsumer(queue);
             Message received = consumer.receive(5000);
             assertNotNull(received);
-            LOG.info("Message JMSExpiration = {}", received.getJMSExpiration());
-            producer.setTimeToLive(100);
-            producer.send(toSend);
-            TimeUnit.SECONDS.sleep(2);
-            received = consumer.receive(5000);
-            if (received != null) {
-                LOG.info("Message JMSExpiration = {} JMSTimeStamp = {} TTL = {}",
-                         new Object[] { received.getJMSExpiration(), received.getJMSTimestamp(),
-                                        received.getJMSExpiration() - received.getJMSTimestamp()});
-            }
-            assertNull(received);
         } finally {
             connection.close();
         }
@@ -551,11 +539,22 @@ public class JMSClientTest extends AmqpTestSupport {
     }
 
     private Connection createConnection() throws JMSException {
-        return createConnection(name.toString());
+        return createConnection(name.toString(), false);
+    }
+
+    private Connection createConnection(boolean syncPublish) throws JMSException {
+        return createConnection(name.toString(), syncPublish);
     }
 
     private Connection createConnection(String clientId) throws JMSException {
+        return createConnection(clientId, false);
+    }
+
+    private Connection createConnection(String clientId, boolean syncPublish) throws JMSException {
+
         final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
+        factory.setSyncPublish(syncPublish);
+
         final Connection connection = factory.createConnection();
         if (clientId != null && !clientId.isEmpty()) {
             connection.setClientID(clientId);