use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class BacklogNetworkCrossTalkTest method testProduceConsume.
public void testProduceConsume() throws Exception {
createBroker("A");
createBroker("B");
NetworkConnector nc = bridgeBrokers("A", "B");
nc.setDuplex(true);
nc.setDispatchAsync(false);
startAllBrokers();
waitForBridgeFormation();
final int numMessages = 10000;
// Create queue
ActiveMQDestination destA = createDestination("AAA", false);
sendMessages("A", destA, numMessages);
ActiveMQDestination destB = createDestination("BBB", false);
sendMessages("B", destB, numMessages);
// consume across network
LOG.info("starting consumers..");
// Setup consumers
MessageConsumer clientA = createConsumer("A", destB);
// Setup consumers
MessageConsumer clientB = createConsumer("B", destA);
final long maxWait = 5 * 60 * 1000L;
MessageIdList listA = getConsumerMessages("A", clientA);
listA.setMaximumDuration(maxWait);
listA.waitForMessagesToArrive(numMessages);
MessageIdList listB = getConsumerMessages("B", clientB);
listB.setMaximumDuration(maxWait);
listB.waitForMessagesToArrive(numMessages);
assertEquals("got all on A" + listA.getMessageCount(), numMessages, listA.getMessageCount());
assertEquals("got all on B" + listB.getMessageCount(), numMessages, listB.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class BrowseOverNetworkTest method testBrowse.
public void testBrowse() throws Exception {
createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=false&useJmx=false"));
createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=false&useJmx=false"));
bridgeBrokers("BrokerA", "BrokerB");
startAllBrokers();
Destination dest = createDestination("TEST.FOO", false);
sendMessages("BrokerA", dest, MESSAGE_COUNT);
Thread.sleep(1000);
int browsed = browseMessages("BrokerB", dest);
Thread.sleep(1000);
MessageConsumer clientA = createConsumer("BrokerA", dest);
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
Thread.sleep(1000);
MessageConsumer clientB = createConsumer("BrokerB", dest);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT);
LOG.info("A+B: " + msgsA.getMessageCount() + "+" + msgsB.getMessageCount());
assertEquals("Consumer on Broker A, should've consumed all messages", MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals("Broker B shouldn't get any messages", 0, browsed);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class MulticastDiscoveryOnFaultyNetworkTest method testSendOnAFaultyTransport.
public void testSendOnAFaultyTransport() 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.setMaximumDuration(200000L);
msgs.waitForMessagesToArrive(MESSAGE_COUNT);
assertTrue("At least message " + MESSAGE_COUNT + " must be received, duplicates are expected, count=" + msgs.getMessageCount(), MESSAGE_COUNT <= msgs.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class JmsMultipleClientsTestSupport method assertConsumerReceivedAtMostXMessages.
protected void assertConsumerReceivedAtMostXMessages(MessageConsumer consumer, int msgCount) {
MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertAtMostMessagesReceived(msgCount);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class JmsMultipleClientsTestSupport method assertConsumerReceivedXMessages.
protected void assertConsumerReceivedXMessages(MessageConsumer consumer, int msgCount) {
MessageIdList messageIdList = consumers.get(consumer);
messageIdList.assertMessagesReceivedNoWait(msgCount);
}
Aggregations