Search in sources :

Example 6 with ActiveMQQueueMaxConsumerLimitReached

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));
}
Also used : ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Queue(org.apache.activemq.artemis.core.server.Queue) ActiveMQQueueMaxConsumerLimitReached(org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached) Test(org.junit.Test)

Aggregations

ActiveMQQueueMaxConsumerLimitReached (org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached)6 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)5 ActiveMQIOErrorException (org.apache.activemq.artemis.api.core.ActiveMQIOErrorException)5 ActiveMQXAException (org.apache.activemq.artemis.core.exception.ActiveMQXAException)5 NullResponseMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NullResponseMessage)3 List (java.util.List)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 ActiveMQExceptionMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage)1 CreateAddressMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage)1 CreateQueueMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage)1 CreateQueueMessage_V2 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2)1 CreateSharedQueueMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage)1 CreateSharedQueueMessage_V2 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage_V2)1 RollbackMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.RollbackMessage)1 SessionAcknowledgeMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage)1 SessionAddMetaDataMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionAddMetaDataMessage)1 SessionAddMetaDataMessageV2 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionAddMetaDataMessageV2)1 SessionBindingQueryMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryMessage)1 SessionBindingQueryResponseMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage)1