use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method XtestMigrateConsumerStuckMessages.
/*
* This test is disabled - as it fails with a fix for
* http://issues.apache.org/activemq/browse/AMQ-2530 - which highlights that
* For a Conduit bridge - local subscription Ids weren't removed in a ConduitBridge
* The test fails because on closing clientA - clientB correctly receives all the
* messages - ie. half dont get stuck on BrokerA -
*/
public void XtestMigrateConsumerStuckMessages() throws Exception {
boolean suppressQueueDuplicateSubscriptions = false;
bridgeAllBrokers("default", 3, suppressQueueDuplicateSubscriptions);
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
LOG.info("Consumer on A");
MessageConsumer clientA = createConsumer("BrokerA", dest);
// ensure advisors have percolated
Thread.sleep(2000);
LOG.info("Consumer on B");
int messageCount = 2000;
// will only get half of the messages
CountDownLatch messagesReceived = new CountDownLatch(messageCount / 2);
MessageConsumer clientB = createConsumer("BrokerB", dest, messagesReceived);
// ensure advisors have percolated
Thread.sleep(2000);
LOG.info("Close consumer on A");
clientA.close();
// ensure advisors have percolated
Thread.sleep(2000);
LOG.info("Send to B");
sendMessages("BrokerB", dest, messageCount);
// Let's try to wait for any messages.
assertTrue(messagesReceived.await(30, TimeUnit.SECONDS));
// Get message count
MessageIdList msgs = getConsumerMessages("BrokerB", clientB);
// see will any more arrive
Thread.sleep(500);
assertEquals(messageCount / 2, msgs.getMessageCount());
// pick up the stuck messages
messagesReceived = new CountDownLatch(messageCount / 2);
clientA = createConsumer("BrokerA", dest, messagesReceived);
// Let's try to wait for any messages.
assertTrue(messagesReceived.await(30, TimeUnit.SECONDS));
msgs = getConsumerMessages("BrokerA", clientA);
assertEquals(messageCount / 2, msgs.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testAllConnectedUsingMulticast.
public void testAllConnectedUsingMulticast() throws Exception {
// Setup broker networks
bridgeAllBrokers();
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
MessageConsumer clientC = createConsumer("BrokerC", dest);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
sendMessages("BrokerB", dest, MESSAGE_COUNT);
sendMessages("BrokerC", dest, MESSAGE_COUNT);
// Let's try to wait for any messages.
Thread.sleep(1000);
// Get message count
final MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
waitFor(new Condition() {
@Override
public boolean isSatisified() {
return msgsA.getMessageCount() == MESSAGE_COUNT;
}
});
assertEquals(MESSAGE_COUNT * 3, msgsA.getMessageCount() + msgsB.getMessageCount() + msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualTopicForwardingTest method testDontBridgeQueuesWithBothTypesConsumers.
public void testDontBridgeQueuesWithBothTypesConsumers() throws Exception {
dontBridgeVirtualTopicConsumerQueues("BrokerA", "BrokerB");
startAllBrokers();
waitForBridgeFormation();
MessageConsumer clientA = createConsumer("BrokerA", createDestination("Consumer.A.VirtualTopic.tempTopic", false));
MessageConsumer clientB = createConsumer("BrokerB", createDestination("Consumer.B.VirtualTopic.tempTopic", false));
MessageConsumer clientC = createConsumer("BrokerB", createDestination("VirtualTopic.tempTopic", true));
// give a sec to let advisories propagate
Thread.sleep(500);
ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic");
Destination destination = getDestination(brokers.get("BrokerA").broker, queueA);
assertEquals(1, destination.getConsumers().size());
ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic");
destination = getDestination(brokers.get("BrokerA").broker, queueB);
assertNull(destination);
ActiveMQTopic virtualTopic = new ActiveMQTopic("VirtualTopic.tempTopic");
assertNotNull(getDestination(brokers.get("BrokerA").broker, virtualTopic));
assertNotNull(getDestination(brokers.get("BrokerB").broker, virtualTopic));
// send some messages
sendMessages("BrokerA", virtualTopic, 1);
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsA.waitForMessagesToArrive(1);
msgsB.waitForMessagesToArrive(1);
// ensure we don't get any more messages
Thread.sleep(2000);
assertEquals(1, msgsA.getMessageCount());
assertEquals(1, msgsB.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualTopicForwardingTest method testBridgeVirtualTopicQueues.
public void testBridgeVirtualTopicQueues() throws Exception {
bridgeAndConfigureBrokers("BrokerA", "BrokerB");
startAllBrokers();
waitForBridgeFormation();
MessageConsumer clientA = createConsumer("BrokerA", createDestination("Consumer.A.VirtualTopic.tempTopic", false));
MessageConsumer clientB = createConsumer("BrokerB", createDestination("Consumer.B.VirtualTopic.tempTopic", false));
// give a sec to let advisories propagate
Thread.sleep(500);
ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic");
Destination destination = getDestination(brokers.get("BrokerA").broker, queueA);
assertEquals(1, destination.getConsumers().size());
ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic");
destination = getDestination(brokers.get("BrokerA").broker, queueB);
assertEquals(1, destination.getConsumers().size());
ActiveMQTopic virtualTopic = new ActiveMQTopic("VirtualTopic.tempTopic");
assertNull(getDestination(brokers.get("BrokerA").broker, virtualTopic));
assertNull(getDestination(brokers.get("BrokerB").broker, virtualTopic));
// send some messages
sendMessages("BrokerA", virtualTopic, 1);
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsA.waitForMessagesToArrive(1);
msgsB.waitForMessagesToArrive(1);
// ensure we don't get any more messages
Thread.sleep(2000);
assertEquals(1, msgsA.getMessageCount());
assertEquals(1, msgsB.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualTopicForwardingTest method testDontBridgeQueuesWithOnlyQueueConsumers.
public void testDontBridgeQueuesWithOnlyQueueConsumers() throws Exception {
dontBridgeVirtualTopicConsumerQueues("BrokerA", "BrokerB");
startAllBrokers();
waitForBridgeFormation();
MessageConsumer clientA = createConsumer("BrokerA", createDestination("Consumer.A.VirtualTopic.tempTopic", false));
MessageConsumer clientB = createConsumer("BrokerB", createDestination("Consumer.B.VirtualTopic.tempTopic", false));
// give a sec to let advisories propagate
Thread.sleep(500);
ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic");
Destination destination = getDestination(brokers.get("BrokerA").broker, queueA);
assertEquals(1, destination.getConsumers().size());
ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic");
destination = getDestination(brokers.get("BrokerA").broker, queueB);
assertNull(destination);
ActiveMQTopic virtualTopic = new ActiveMQTopic("VirtualTopic.tempTopic");
assertNull(getDestination(brokers.get("BrokerA").broker, virtualTopic));
assertNull(getDestination(brokers.get("BrokerB").broker, virtualTopic));
// send some messages
sendMessages("BrokerA", virtualTopic, 1);
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsA.waitForMessagesToArrive(1);
msgsB.waitForMessagesToArrive(0);
// ensure we don't get any more messages
Thread.sleep(2000);
assertEquals(1, msgsA.getMessageCount());
assertEquals(0, msgsB.getMessageCount());
}
Aggregations