use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerNetworkLoadBalanceTest method testLoadBalancing.
public void testLoadBalancing() throws Exception {
bridgeBrokers("BrokerA", "BrokerB");
bridgeBrokers("BrokerB", "BrokerA");
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
// Setup consumers
MessageConsumer clientB = createConsumer("BrokerB", dest);
// Send messages
sendMessages("BrokerA", dest, 5000);
// Send messages
sendMessages("BrokerB", dest, 1000);
// Get message count
final MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
final MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return msgsA.getMessageCount() + msgsB.getMessageCount() == 6000;
}
});
LOG.info("A got: " + msgsA.getMessageCount());
LOG.info("B got: " + msgsB.getMessageCount());
assertTrue("B got is fair share: " + msgsB.getMessageCount(), msgsB.getMessageCount() > 2000);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualDestDinamicallyIncludedDestTest method testVirtualDestinationsDinamicallyIncludedBehavior2.
/**
* BrokerA -> BrokerB && BrokerB -> BrokerA
*/
public void testVirtualDestinationsDinamicallyIncludedBehavior2() throws Exception {
startAllBrokers();
// Setup destination
Destination dest = createDestination("global.test", true);
// Setup consumers
// MessageConsumer clientB1 = createConsumer("BrokerB", dest);
MessageConsumer clientB2 = createConsumer("BrokerB", createDestination("Consumer.foo-bar.global.test", false));
Thread.sleep(2 * 1000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsB2 = getConsumerMessages("BrokerB", clientB2);
msgsB2.waitForMessagesToArrive(MESSAGE_COUNT);
assertEquals(MESSAGE_COUNT, msgsB2.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualDestDinamicallyIncludedDestTest method testVirtualDestinationsDinamicallyIncludedBehavior1.
/**
* BrokerA -> BrokerB && BrokerB -> BrokerA
*/
public void testVirtualDestinationsDinamicallyIncludedBehavior1() throws Exception {
startAllBrokers();
// Setup destination
Destination dest = createDestination("global.test", true);
// Setup consumers
MessageConsumer clientB1 = createConsumer("BrokerB", dest);
MessageConsumer clientB2 = createConsumer("BrokerB", createDestination("Consumer.foo-bar.global.test", false));
Thread.sleep(2 * 1000);
int messageCount = MESSAGE_COUNT;
// Send messages
sendMessages("BrokerA", dest, messageCount);
// Get message count
MessageIdList msgsB1 = getConsumerMessages("BrokerB", clientB1);
msgsB1.waitForMessagesToArrive(messageCount);
assertEquals(messageCount, msgsB1.getMessageCount());
MessageIdList msgsB2 = getConsumerMessages("BrokerB", clientB2);
msgsB2.waitForMessagesToArrive(messageCount);
assertEquals(messageCount, msgsB2.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualDestDinamicallyIncludedDestTest method testTopicDinamicallyIncludedBehavior.
/**
* BrokerA -> BrokerB && BrokerB -> BrokerA
*/
public void testTopicDinamicallyIncludedBehavior() throws Exception {
startAllBrokers();
// Setup destination
Destination dest = createDestination("test", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
Thread.sleep(2 * 1000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT);
assertEquals(0, msgsB.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest method testRemoteBrokerHasConsumer.
/**
* BrokerA -> BrokerB
*/
public void testRemoteBrokerHasConsumer() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB");
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
Thread.sleep(2000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT);
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT, msgsB.getMessageCount());
}
Aggregations