use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class JmsMultipleClientsTestSupport method assertConsumerReceivedAtLeastXMessages.
/*
* Some helpful assertions for multiple consumers.
*/
protected void assertConsumerReceivedAtLeastXMessages(MessageConsumer consumer, int msgCount) {
MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertAtLeastMessagesReceived(msgCount);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testABandCBbrokerNetwork.
/**
* BrokerA -> BrokerB <- BrokerC
*/
public void testABandCBbrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB");
bridgeBrokers("BrokerC", "BrokerB");
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
MessageConsumer clientC = createConsumer("BrokerC", dest);
// let consumers propagate around the network
Thread.sleep(2000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
sendMessages("BrokerB", dest, MESSAGE_COUNT);
sendMessages("BrokerC", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT * 3);
msgsC.waitForMessagesToArrive(MESSAGE_COUNT);
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT * 3, msgsB.getMessageCount());
assertEquals(MESSAGE_COUNT, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testAllConnectedUsingMulticast.
/**
* BrokerA <-> BrokerB <-> BrokerC
*/
public void testAllConnectedUsingMulticast() throws Exception {
// Setup broker networks
bridgeAllBrokers();
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
MessageConsumer clientC = createConsumer("BrokerC", dest);
// let consumers propagate around the network
Thread.sleep(2000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
sendMessages("BrokerB", dest, MESSAGE_COUNT);
sendMessages("BrokerC", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT * 3);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT * 3);
msgsC.waitForMessagesToArrive(MESSAGE_COUNT * 3);
assertEquals(MESSAGE_COUNT * 3, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT * 3, msgsB.getMessageCount());
assertEquals(MESSAGE_COUNT * 3, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testBAandBCbrokerNetwork.
/**
* BrokerA <- BrokerB -> BrokerC
*/
public void testBAandBCbrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerB", "BrokerA");
bridgeBrokers("BrokerB", "BrokerC");
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientB = createConsumer("BrokerB", dest);
MessageConsumer clientC = createConsumer("BrokerC", dest);
// let consumers propagate around the network
Thread.sleep(2000);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
sendMessages("BrokerB", dest, MESSAGE_COUNT);
sendMessages("BrokerC", dest, MESSAGE_COUNT);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT * 2);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT);
msgsC.waitForMessagesToArrive(MESSAGE_COUNT * 2);
assertEquals(MESSAGE_COUNT * 2, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT, msgsB.getMessageCount());
assertEquals(MESSAGE_COUNT * 2, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TopicReplicationTest method testReplication.
public void testReplication() throws Exception {
createBroker(new ClassPathResource("org/apache/activemq/usecases/replication-broker1.xml"));
createBroker(new ClassPathResource("org/apache/activemq/usecases/replication-broker2.xml"));
createBroker(new ClassPathResource("org/apache/activemq/usecases/replication-broker3.xml"));
createBroker(new ClassPathResource("org/apache/activemq/usecases/replication-broker4.xml"));
brokers.get("replication-broker1").broker.waitUntilStarted();
brokers.get("replication-broker2").broker.waitUntilStarted();
brokers.get("replication-broker3").broker.waitUntilStarted();
brokers.get("replication-broker4").broker.waitUntilStarted();
Destination dest = createDestination("replication", true);
// Setup consumers
MessageConsumer clientA = createConsumer("replication-broker2", dest);
MessageConsumer clientB = createConsumer("replication-broker3", dest);
MessageConsumer clientC = createConsumer("replication-broker4", dest);
MessageConsumer clientD = createConsumer("replication-broker4", dest);
// let consumers propagate around the network
Thread.sleep(2000);
// Get message count
MessageIdList msgsA = getConsumerMessages("replication-broker2", clientA);
MessageIdList msgsB = getConsumerMessages("replication-broker3", clientB);
MessageIdList msgsC = getConsumerMessages("replication-broker4", clientC);
MessageIdList msgsD = getConsumerMessages("replication-broker4", clientD);
// send messages to broker1
sendMessages("replication-broker1", dest, MSG_COUNT);
msgsA.waitForMessagesToArrive(MSG_COUNT);
msgsB.waitForMessagesToArrive(MSG_COUNT);
msgsC.waitForMessagesToArrive(MSG_COUNT);
msgsD.waitForMessagesToArrive(MSG_COUNT);
assertEquals(MSG_COUNT, msgsA.getMessageCount());
assertEquals(MSG_COUNT, msgsB.getMessageCount());
assertEquals(MSG_COUNT, msgsC.getMessageCount());
assertEquals(MSG_COUNT, msgsD.getMessageCount());
// send messages to broker4
sendMessages("replication-broker4", dest, MSG_COUNT);
msgsA.waitForMessagesToArrive(2 * MSG_COUNT);
msgsB.waitForMessagesToArrive(2 * MSG_COUNT);
msgsC.waitForMessagesToArrive(2 * MSG_COUNT);
msgsD.waitForMessagesToArrive(2 * MSG_COUNT);
assertEquals(2 * MSG_COUNT, msgsA.getMessageCount());
assertEquals(2 * MSG_COUNT, msgsB.getMessageCount());
assertEquals(2 * MSG_COUNT, msgsC.getMessageCount());
assertEquals(2 * MSG_COUNT, msgsD.getMessageCount());
// send messages to broker3
sendMessages("replication-broker3", dest, MSG_COUNT);
msgsA.waitForMessagesToArrive(3 * MSG_COUNT);
msgsB.waitForMessagesToArrive(3 * MSG_COUNT);
msgsC.waitForMessagesToArrive(3 * MSG_COUNT);
msgsD.waitForMessagesToArrive(3 * MSG_COUNT);
assertEquals(3 * MSG_COUNT, msgsA.getMessageCount());
assertEquals(3 * MSG_COUNT, msgsB.getMessageCount());
assertEquals(3 * MSG_COUNT, msgsC.getMessageCount());
assertEquals(3 * MSG_COUNT, msgsD.getMessageCount());
// send messages to broker2
sendMessages("replication-broker2", dest, MSG_COUNT);
msgsA.waitForMessagesToArrive(4 * MSG_COUNT);
msgsB.waitForMessagesToArrive(4 * MSG_COUNT);
msgsC.waitForMessagesToArrive(4 * MSG_COUNT);
msgsD.waitForMessagesToArrive(4 * MSG_COUNT);
assertEquals(4 * MSG_COUNT, msgsA.getMessageCount());
assertEquals(4 * MSG_COUNT, msgsB.getMessageCount());
assertEquals(4 * MSG_COUNT, msgsC.getMessageCount());
assertEquals(4 * MSG_COUNT, msgsD.getMessageCount());
}
Aggregations