use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testABandBCbrokerNetwork.
/**
* BrokerA -> BrokerB -> BrokerC
*/
public void testABandBCbrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB");
bridgeBrokers("BrokerB", "BrokerC");
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer clientC = createConsumer("BrokerC", dest);
// Send messages
sendMessages("BrokerA", dest, MESSAGE_COUNT);
// Let's try to wait for any messages. Should be none.
Thread.sleep(1000);
// Get message count
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
assertEquals(0, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testBAandBCbrokerNetwork.
/**
* BrokerA <- BrokerB -> BrokerC
*/
public void testBAandBCbrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerB", "BrokerA");
bridgeBrokers("BrokerB", "BrokerC");
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageConsumer clientC = createConsumer("BrokerC", dest);
// et subscriptions get propagated
Thread.sleep(2000);
// Send messages
sendMessages("BrokerB", dest, MESSAGE_COUNT);
// Let's try to wait for any messages.
Thread.sleep(1000);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
// Total received should be 100
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount() + msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testBAandBCbrokerNetworkWithSelectorsSubscribeFirst.
/**
* BrokerA <- BrokerB -> BrokerC
*/
public void testBAandBCbrokerNetworkWithSelectorsSubscribeFirst() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerB", "BrokerA", true, 1, false);
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest, "broker = 'BROKER_A'");
MessageConsumer clientC = createConsumer("BrokerC", dest, "broker = 'BROKER_C'");
// et subscriptions get propagated
Thread.sleep(2000);
// Send messages for broker A
HashMap<String, Object> props = new HashMap<>();
props.put("broker", "BROKER_A");
sendMessages("BrokerB", dest, MESSAGE_COUNT, props);
// Send messages for broker C
props.clear();
props.put("broker", "BROKER_C");
sendMessages("BrokerB", dest, MESSAGE_COUNT, props);
// Let's try to wait for any messages.
Thread.sleep(1000);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
// Total received should be 100
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testBAandBCbrokerNetworkWithSelectorsSendFirst.
/**
* BrokerA <- BrokerB -> BrokerC
*/
public void testBAandBCbrokerNetworkWithSelectorsSendFirst() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerB", "BrokerA", true, 1, false);
bridgeBrokers("BrokerB", "BrokerC", true, 1, false);
startAllBrokers();
waitForBridgeFormation();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Send messages for broker A
HashMap<String, Object> props = new HashMap<>();
props.put("broker", "BROKER_A");
sendMessages("BrokerB", dest, MESSAGE_COUNT, props);
// Send messages for broker C
props.clear();
props.put("broker", "BROKER_C");
sendMessages("BrokerB", dest, MESSAGE_COUNT, props);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerA", dest, "broker = 'BROKER_A'");
MessageConsumer clientC = createConsumer("BrokerC", dest, "broker = 'BROKER_C'");
// et subscriptions get propagated
Thread.sleep(2000);
// Let's try to wait for any messages.
// Thread.sleep(1000);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
// Total received should be 100
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerQueueNetworkTest method testAllConnectedBrokerNetwork.
/**
* BrokerA <-> BrokerB <-> BrokerC
*/
public void testAllConnectedBrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB");
bridgeBrokers("BrokerB", "BrokerA");
bridgeBrokers("BrokerB", "BrokerC");
bridgeBrokers("BrokerC", "BrokerB");
bridgeBrokers("BrokerA", "BrokerC");
bridgeBrokers("BrokerC", "BrokerA");
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
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
assertEquals(MESSAGE_COUNT * 3, msgsA.getMessageCount() + msgsB.getMessageCount() + msgsC.getMessageCount());
}
Aggregations