mirror of https://github.com/apache/activemq.git
Add a test that can reproduce an issue seen when emitFlowOnSend is disabled on the proton transport to allow for further investigation.
This commit is contained in:
parent
4e60075a32
commit
bbb17da52f
|
@ -57,6 +57,7 @@ import org.apache.activemq.broker.jmx.ConnectorViewMBean;
|
|||
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
||||
import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
|
||||
import org.apache.activemq.util.Wait;
|
||||
import org.apache.qpid.jms.JmsConnection;
|
||||
import org.junit.Test;
|
||||
import org.objectweb.jtests.jms.framework.TestConfig;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -1177,6 +1178,33 @@ public class JMSClientTest extends JMSClientTestSupport {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
public void testZeroPrefetchWithTwoConsumers() throws Exception {
|
||||
connection = createConnection();
|
||||
((JmsConnection)connection).getPrefetchPolicy().setAll(0);
|
||||
connection.start();
|
||||
|
||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Queue queue = session.createQueue(getDestinationName());
|
||||
|
||||
MessageProducer producer = session.createProducer(queue);
|
||||
producer.send(session.createTextMessage("Msg1"));
|
||||
producer.send(session.createTextMessage("Msg2"));
|
||||
|
||||
// now lets receive it
|
||||
MessageConsumer consumer1 = session.createConsumer(queue);
|
||||
MessageConsumer consumer2 = session.createConsumer(queue);
|
||||
TextMessage answer = (TextMessage)consumer1.receive(5000);
|
||||
assertNotNull(answer);
|
||||
assertEquals("Should have received a message!", answer.getText(), "Msg1");
|
||||
answer = (TextMessage)consumer2.receive(5000);
|
||||
assertNotNull(answer);
|
||||
assertEquals("Should have received a message!", answer.getText(), "Msg2");
|
||||
|
||||
answer = (TextMessage)consumer2.receiveNoWait();
|
||||
assertNull("Should have not received a message!", answer);
|
||||
}
|
||||
|
||||
protected void receiveMessages(MessageConsumer consumer) throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Message message = consumer.receive(1000);
|
||||
|
|
Loading…
Reference in New Issue