However, results will vary dramatically depending on thread and AMQ performance/QoS configurations. Refer to the AMQ performance page and the camel-jms page for more information...
private static final Logger logger =
Logger.getLogger(AMQRouteTest. class.getName());
@EndpointInject(uri = "mock:mock")
protected MockEndpoint mock;
protected MockEndpoint mock;
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
String url ="vm://test-broker?broker.
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url)
camelContext.addComponent("
JmsComponent. jmsComponentAutoAcknowledge( connectionFactory));
return camelContext;
}
@Test
public void test() throws Exception {
int messageCnt = 10000, poolSize = 5;
mock. setMinimumExpectedMessageCount (messageCnt);
ExecutorService executor = Executors.newFixedThreadPool( poolSize);
return camelContext;
}
@Test
public void test() throws Exception {
int messageCnt = 10000, poolSize = 5;
mock.
ExecutorService executor = Executors.newFixedThreadPool(
for (int i = 0; i < messageCnt; i++) {
executor.submit(new Callable() {
public Object call() throws Exception {
template.sendBody("activemq:
return null;
}
});
}
mock.assertIsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activemq:queue:test?
.process(new Processor() {
long totalLatency, msgCnt;
public void process(Exchange exch) throws Exception {
totalLatency += (System.currentTimeMillis() - exch.getIn().getBody(Long.
if(++msgCnt % 1000 == 0) {
logger.info("avgLatency=" + (totalLatency/msgCnt));
}
}
})
.to("mock:mock");
}
};
}
The Camel log component can log throughput for you, using the group options:
ReplyDeletehttp://camel.apache.org/log