use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class AbortSlowConsumer2Test method testLittleSlowConsumerIsNotAborted.
@Test(timeout = 60 * 1000)
public void testLittleSlowConsumerIsNotAborted() throws Exception {
startConsumers(destination);
Entry<MessageConsumer, MessageIdList> consumertoAbort = consumers.entrySet().iterator().next();
consumertoAbort.getValue().setProcessingDelay(500);
for (Connection c : connections) {
c.setExceptionListener(this);
}
startProducers(destination, 12);
allMessagesList.waitForMessagesToArrive(10);
allMessagesList.assertAtLeastMessagesReceived(10);
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testABandBCbrokerNetworkWithSelectors.
/**
* BrokerA -> BrokerB -> BrokerC
*/
public void testABandBCbrokerNetworkWithSelectors() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB", dynamicOnly, 2, true);
bridgeBrokers("BrokerB", "BrokerC", dynamicOnly, 2, true);
startAllBrokers();
// Setup destination
Destination dest = createDestination("TEST.FOO", true);
// Setup consumers
MessageConsumer clientA = createConsumer("BrokerC", dest, "dummy = 33");
MessageConsumer clientB = createConsumer("BrokerC", dest, "dummy > 30");
MessageConsumer clientC = createConsumer("BrokerC", dest, "dummy = 34");
// let consumers propagate around the network
Thread.sleep(2000);
// Send messages
// Send messages for broker A
HashMap<String, Object> props = new HashMap<>();
props.put("dummy", 33);
sendMessages("BrokerA", dest, MESSAGE_COUNT, props);
props.put("dummy", 34);
sendMessages("BrokerA", dest, MESSAGE_COUNT * 2, props);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerC", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerC", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT * 3);
msgsC.waitForMessagesToArrive(MESSAGE_COUNT * 2);
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT * 3, msgsB.getMessageCount());
assertEquals(MESSAGE_COUNT * 2, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testAllConnectedBrokerNetworkSingleProducerTTL.
public void testAllConnectedBrokerNetworkSingleProducerTTL() throws Exception {
// duplicates are expected with ttl of 2 as each broker is connected to the next
// but the dups are suppressed by the store and now also by the topic sub when enableAudit
// default (true) is present in a matching destination policy entry
int networkTTL = 2;
boolean conduitSubs = true;
// Setup ring broker networks
bridgeBrokers("BrokerA", "BrokerB", dynamicOnly, networkTTL, conduitSubs);
bridgeBrokers("BrokerB", "BrokerA", dynamicOnly, networkTTL, conduitSubs);
bridgeBrokers("BrokerB", "BrokerC", dynamicOnly, networkTTL, conduitSubs);
bridgeBrokers("BrokerC", "BrokerB", dynamicOnly, networkTTL, conduitSubs);
bridgeBrokers("BrokerA", "BrokerC", dynamicOnly, networkTTL, conduitSubs);
bridgeBrokers("BrokerC", "BrokerA", dynamicOnly, networkTTL, conduitSubs);
PolicyMap policyMap = new PolicyMap();
// enable audit is on by default just need to give it matching policy entry
// so it will be applied to the topic subscription
policyMap.setDefaultEntry(new PolicyEntry());
Collection<BrokerItem> brokerList = brokers.values();
for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext(); ) {
BrokerService broker = i.next().broker;
broker.setDestinationPolicy(policyMap);
broker.setDeleteAllMessagesOnStartup(true);
}
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, 1);
// Get message count
MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
MessageIdList msgsC = getConsumerMessages("BrokerC", clientC);
msgsA.waitForMessagesToArrive(1);
msgsB.waitForMessagesToArrive(1);
msgsC.waitForMessagesToArrive(1);
// ensure we don't get any more messages
Thread.sleep(2000);
assertEquals(1, msgsA.getMessageCount());
assertEquals(1, msgsB.getMessageCount());
assertEquals(1, msgsC.getMessageCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest method testABandBCbrokerNetwork.
/**
* BrokerA -> BrokerB -> BrokerC
*/
public void testABandBCbrokerNetwork() throws Exception {
// Setup broker networks
bridgeBrokers("BrokerA", "BrokerB");
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);
msgsB.waitForMessagesToArrive(MESSAGE_COUNT * 2);
msgsC.waitForMessagesToArrive(MESSAGE_COUNT * 2);
assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
assertEquals(MESSAGE_COUNT * 2, msgsB.getMessageCount());
assertEquals(MESSAGE_COUNT * 2, msgsC.getMessageCount());
assertEquals("Correct forwards from A", MESSAGE_COUNT, brokers.get("BrokerA").broker.getDestination(ActiveMQDestination.transform(dest)).getDestinationStatistics().getForwards().getCount());
}
use of org.apache.activemq.util.MessageIdList in project activemq-artemis by apache.
the class ThreeBrokerTopicNetworkTest 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();
// 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());
}
Aggregations