use of org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached in project activemq-artemis by apache.
the class AddressingTest method testLimitOnMaxConsumers.
@Test
public void testLimitOnMaxConsumers() throws Exception {
SimpleString address = new SimpleString("test.address");
SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
// For each address, create 2 Queues with the same address, assert both queues receive message
boolean purgeOnNoConsumers = false;
Queue q1 = server.createQueue(address, RoutingType.MULTICAST, queueName, null, true, false, 0, purgeOnNoConsumers, true);
Exception expectedException = null;
String expectedMessage = "Maximum Consumer Limit Reached on Queue";
try {
ClientSession session = sessionFactory.createSession();
session.start();
session.createConsumer(q1.getName());
} catch (ActiveMQQueueMaxConsumerLimitReached e) {
expectedException = e;
}
assertNotNull(expectedException);
assertTrue(expectedException.getMessage().contains(expectedMessage));
assertTrue(expectedException.getMessage().contains(address));
assertTrue(expectedException.getMessage().contains(queueName));
}
Aggregations