Author: aidan
Date: Thu Jan 22 04:19:47 2009
New Revision: 736618

URL: http://svn.apache.org/viewvc?rev=736618&view=rev
Log:
QPID-1418: Destroy and recreate consumer once all messages are
sent so that they have enough time to expire.

Modified:
    
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java

Modified: 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java?rev=736618&r1=736617&r2=736618&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
 (original)
+++ 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java
 Thu Jan 22 04:19:47 2009
@@ -55,8 +55,13 @@
         
         Session clientSession = clientConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
         Queue queue = clientSession.createQueue(QUEUE); 
-            
+        
+        // Create then close the consumer so the queue is actually created
+        // Closing it then reopening it ensures that the consumer shouldn't 
get messages
+        // which should have expired and allows a shorter sleep period. See 
QPID-1418
+        
         MessageConsumer consumer = clientSession.createConsumer(queue);
+        consumer.close();
 
         //Create Producer
         Connection producerConnection = getConnection();
@@ -82,10 +87,11 @@
         producer.setTimeToLive(0L);
         producer.send(nextMessage(String.valueOf(msg), false, producerSession, 
producer));
 
-         try
+        consumer = clientSession.createConsumer(queue);
+        try
         {
             // Sleep to ensure TTL reached
-            Thread.sleep(2000);
+            Thread.sleep(TIME_TO_LIVE);
         }
         catch (InterruptedException e)
         {



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

Reply via email to