https://issues.apache.org/jira/browse/AMQ-3485 - make sure prefetch size of zero is a workaround

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1401261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-10-23 12:16:47 +00:00
parent 8a5f160fd2
commit 7cb7d188f9
1 changed files with 27 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq;
import java.util.ArrayList;
import java.util.Enumeration;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
@ -202,4 +203,30 @@ public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
commitTx();
}
public void testCloseConsumer() throws Exception {
Destination dest = session.createQueue(getSubject() + "?consumer.prefetchSize=0");
producer = session.createProducer(dest);
beginTx();
producer.send(session.createTextMessage("message 1"));
producer.send(session.createTextMessage("message 2"));
commitTx();
beginTx();
consumer = session.createConsumer(dest);
Message message1 = consumer.receive(1000);
String text1 = ((TextMessage)message1).getText();
assertNotNull(message1);
assertEquals("message 1", text1);
consumer.close();
consumer = session.createConsumer(dest);
Message message2 = consumer.receive(1000);
String text2 = ((TextMessage)message2).getText();
assertNotNull(message2);
assertEquals("message 2", text2);
commitTx();
}
}