activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [13/23] git commit: https://issues.apache.org/jira/browse/AMQ-4741
Date Fri, 14 Mar 2014 15:07:53 GMT
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/4ce9e8ae
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/4ce9e8ae
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/4ce9e8ae

Branch: refs/heads/activemq-5.9
Commit: 4ce9e8ae6f711ff13163fc2f9b2c8d2de837e413
Parents: f801a57
Author: Timothy Bish <tabish121@gmai.com>
Authored: Wed Jan 8 17:28:39 2014 -0500
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Fri Mar 14 10:56:16 2014 -0400

----------------------------------------------------------------------
 .../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/4ce9e8ae/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/4ce9e8ae/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);


Mime
View raw message