use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class TwoBrokerVirtualDestDinamicallyIncludedDestTest method testVirtualDestinationsDinamicallyIncludedBehavior3.
/**
* BrokerA -> BrokerB && BrokerB -> BrokerA
*/
public void testVirtualDestinationsDinamicallyIncludedBehavior3() throws Exception {
final String topic = "global.test";
final String vq = "Consumer.foo." + topic;
startAllBrokers();
final int msgs1 = 1001;
final int msgs2 = 1456;
// Setup destination
Destination tDest = createDestination(topic, true);
Destination vqDest = createDestination(vq, false);
// Setup consumers
MessageConsumer clientB1t = createConsumer("BrokerA", tDest);
MessageConsumer clientB2t = createConsumer("BrokerB", tDest);
MessageConsumer clientB1vq = createConsumer("BrokerA", vqDest);
Thread.sleep(2 * 1000);
// Send messages
sendMessages("BrokerA", tDest, msgs1);
sendMessages("BrokerB", tDest, msgs2);
Thread.sleep(5000);
// Get message count
MessageIdList msgsB1t = getConsumerMessages("BrokerA", clientB1t);
msgsB1t.waitForMessagesToArrive(msgs1 + msgs2);
assertEquals(msgs1 + msgs2, msgsB1t.getMessageCount());
MessageIdList msgsB2t = getConsumerMessages("BrokerB", clientB2t);
msgsB2t.waitForMessagesToArrive(msgs1 + msgs2);
assertEquals(msgs1 + msgs2, msgsB2t.getMessageCount());
MessageIdList msgsB1vq = getConsumerMessages("BrokerA", clientB1vq);
msgsB1vq.waitForMessagesToArrive(msgs1 + msgs2);
assertEquals(msgs1 + msgs2, msgsB1vq.getMessageCount());
assertEquals(0, getQueueSize("BrokerA", (ActiveMQDestination) vqDest));
assertEquals(0, getQueueSize("BrokerB", (ActiveMQDestination) vqDest));
destroyAllBrokers();
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class MultiBrokersMultiClientsTest method testTopicAllConnected.
public void testTopicAllConnected() throws Exception {
bridgeAllBrokers();
startAllBrokers();
waitForBridgeFormation();
// Setup topic destination
Destination dest = createDestination("TEST.FOO", true);
CountDownLatch latch = new CountDownLatch(BROKER_COUNT * PRODUCER_COUNT * BROKER_COUNT * CONSUMER_COUNT * MESSAGE_COUNT);
// Setup consumers
for (int i = 1; i <= BROKER_COUNT; i++) {
for (int j = 0; j < CONSUMER_COUNT; j++) {
consumerMap.put("Consumer:" + i + ":" + j, createConsumer("Broker" + i, dest, latch));
}
}
// wait for consumers to get propagated
for (int i = 1; i <= BROKER_COUNT; i++) {
// all consumers on the remote brokers look like 1 consumer to the local broker.
assertConsumersConnect("Broker" + i, dest, (BROKER_COUNT - 1) + CONSUMER_COUNT, 65000);
}
// Send messages
for (int i = 1; i <= BROKER_COUNT; i++) {
for (int j = 0; j < PRODUCER_COUNT; j++) {
sendMessages("Broker" + i, dest, MESSAGE_COUNT);
}
}
assertTrue("Missing " + latch.getCount() + " messages", latch.await(45, TimeUnit.SECONDS));
// Get message count
for (int i = 1; i <= BROKER_COUNT; i++) {
for (int j = 0; j < CONSUMER_COUNT; j++) {
MessageIdList msgs = getConsumerMessages("Broker" + i, consumerMap.get("Consumer:" + i + ":" + j));
assertEquals(BROKER_COUNT * PRODUCER_COUNT * MESSAGE_COUNT, msgs.getMessageCount());
}
}
assertNoUnhandeledExceptions();
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class AMQ2927Test method testSendRestart.
public void testSendRestart() throws Exception {
Thread.sleep(1000);
LOG.info("sending message");
sendMessages("BrokerA", queue, 1);
Thread.sleep(3000);
LOG.info("restarting broker");
restartBroker("BrokerA");
Thread.sleep(5000);
LOG.info("consuming message");
MessageConsumer consumerA = createConsumer("BrokerA", queue);
MessageConsumer consumerB = createConsumer("BrokerB", queue);
Thread.sleep(1000);
MessageIdList messagesA = getConsumerMessages("BrokerA", consumerA);
MessageIdList messagesB = getConsumerMessages("BrokerB", consumerB);
LOG.info("consumerA = " + messagesA);
LOG.info("consumerB = " + messagesB);
messagesA.assertMessagesReceived(0);
messagesB.assertMessagesReceived(1);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class AMQ2927Test method testRestartSend.
public void testRestartSend() throws Exception {
Thread.sleep(1000);
LOG.info("restarting broker");
restartBroker("BrokerA");
Thread.sleep(5000);
LOG.info("sending message");
sendMessages("BrokerA", queue, 1);
Thread.sleep(3000);
LOG.info("consuming message");
MessageConsumer consumerA = createConsumer("BrokerA", queue);
MessageConsumer consumerB = createConsumer("BrokerB", queue);
Thread.sleep(1000);
MessageIdList messagesA = getConsumerMessages("BrokerA", consumerA);
MessageIdList messagesB = getConsumerMessages("BrokerB", consumerB);
LOG.info("consumerA = " + messagesA);
LOG.info("consumerB = " + messagesB);
messagesA.assertMessagesReceived(0);
messagesB.assertMessagesReceived(1);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class BrokerQueueNetworkWithDisconnectTest method testSendOnAReceiveOnBWithTransportDisconnect.
public void testSendOnAReceiveOnBWithTransportDisconnect() throws Exception {
bridgeBrokers(SPOKE, HUB);
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", false);
// Setup consumers
MessageConsumer client = createConsumer(HUB, dest);
// allow subscription information to flow back to Spoke
sleep(600);
// Send messages
sendMessages(SPOKE, dest, MESSAGE_COUNT);
MessageIdList msgs = getConsumerMessages(HUB, client);
msgs.waitForMessagesToArrive(MESSAGE_COUNT);
assertTrue("At least message " + MESSAGE_COUNT + " must be received, duplicates are expected, count=" + msgs.getMessageCount(), MESSAGE_COUNT <= msgs.getMessageCount());
}
Aggregations