mirror of https://github.com/apache/activemq.git
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:
parent
8a5f160fd2
commit
7cb7d188f9
|
@ -19,6 +19,7 @@ package org.apache.activemq;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import javax.jms.Destination;
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
import javax.jms.MessageConsumer;
|
import javax.jms.MessageConsumer;
|
||||||
import javax.jms.MessageProducer;
|
import javax.jms.MessageProducer;
|
||||||
|
@ -202,4 +203,30 @@ public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
|
||||||
commitTx();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue