use of org.apache.activemq.ActiveMQPrefetchPolicy in project activemq-artemis by apache.
the class ConcurrentProducerQueueConsumerTest method createConnectionFactory.
@Override
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString());
ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
prefetchPolicy.setAll(1);
factory.setPrefetchPolicy(prefetchPolicy);
factory.setDispatchAsync(true);
return factory;
}
use of org.apache.activemq.ActiveMQPrefetchPolicy in project activemq-artemis by apache.
the class SimpleNetworkTest method setUp.
@Override
protected void setUp() throws Exception {
if (consumerBroker == null) {
consumerBroker = createConsumerBroker(consumerBindAddress);
}
if (producerBroker == null) {
producerBroker = createProducerBroker(producerBindAddress);
}
consumerFactory = createConnectionFactory(consumerBindAddress);
consumerFactory.setDispatchAsync(true);
ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy();
policy.setQueuePrefetch(100);
consumerFactory.setPrefetchPolicy(policy);
producerFactory = createConnectionFactory(producerBindAddress);
Connection con = consumerFactory.createConnection();
Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
producers = new PerfProducer[numberofProducers * numberOfDestinations];
consumers = new PerfConsumer[numberOfConsumers * numberOfDestinations];
for (int k = 0; k < numberOfDestinations; k++) {
Destination destination = createDestination(session, destinationName + ":" + k);
LOG.info("Testing against destination: " + destination);
for (int i = 0; i < numberOfConsumers; i++) {
consumers[i] = createConsumer(consumerFactory, destination, i);
consumers[i].start();
}
for (int i = 0; i < numberofProducers; i++) {
array = new byte[playloadSize];
for (int j = i; j < array.length; j++) {
array[j] = (byte) j;
}
producers[i] = createProducer(producerFactory, destination, i, array);
producers[i].start();
}
}
con.close();
}
Aggregations