use of org.apache.activemq.artemis.core.server.Bindable in project activemq-artemis by apache.
the class MessageRedistributionTest method testRedistributionStopsWhenConsumerAdded.
// https://issues.jboss.org/browse/HORNETQ-1057
@Test
public void testRedistributionStopsWhenConsumerAdded() throws Exception {
setupCluster(MessageLoadBalancingType.ON_DEMAND);
MessageRedistributionTest.log.info("Doing test");
startServers(0, 1, 2);
setupSessionFactory(0, isNetty());
setupSessionFactory(1, isNetty());
setupSessionFactory(2, isNetty());
createQueue(0, "queues.testaddress", "queue0", null, false);
createQueue(1, "queues.testaddress", "queue0", null, false);
createQueue(2, "queues.testaddress", "queue0", null, false);
addConsumer(0, 0, "queue0", null);
waitForBindings(0, "queues.testaddress", 1, 1, true);
waitForBindings(1, "queues.testaddress", 1, 0, true);
waitForBindings(2, "queues.testaddress", 1, 0, true);
waitForBindings(0, "queues.testaddress", 2, 0, false);
waitForBindings(1, "queues.testaddress", 2, 1, false);
waitForBindings(2, "queues.testaddress", 2, 1, false);
send(0, "queues.testaddress", 2000, false, null);
removeConsumer(0);
addConsumer(0, 0, "queue0", null);
Bindable bindable = servers[0].getPostOffice().getBinding(new SimpleString("queue0")).getBindable();
String debug = ((QueueImpl) bindable).debug();
Assert.assertFalse(debug.contains(Redistributor.class.getName()));
MessageRedistributionTest.log.info("Test done");
}
use of org.apache.activemq.artemis.core.server.Bindable in project activemq-artemis by apache.
the class ActiveMQServerImpl method locateQueue.
@Override
public Queue locateQueue(SimpleString queueName) {
Binding binding = postOffice.getBinding(queueName);
if (binding == null) {
return null;
}
Bindable queue = binding.getBindable();
if (!(queue instanceof Queue)) {
throw new IllegalStateException("locateQueue should only be used to locate queues");
}
return (Queue) binding.getBindable();
}
Aggregations