I'm trying to transfer messages between 2 ActiveMQ brokers through Apache Camel and the trouble is that I can achive rate of transportation only about 135 messages per second. I want to increase that number. The situation is I have 2 ActiveMQ brokers on remote server. I want to take messages from queue on first broker and transfer these messages to several queues on second broker via Camel route.
this is how I establish connections:
CamelContext context = new DefaultCamelContext();
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "admin", "tcp://10.1**.6.195:62222");
ActiveMQConnectionFactory connectionFactory2 = new ActiveMQConnectionFactory("admin", "admin", "tcp://10.1**.6.195:
PooledConnectionFactory pf1 = new PooledConnectionFactory(connectionFactory);
pf1.setMaximumActiveSessionPerConnection(45);
pf1.setMaxConnections(40);
PooledConnectionFactory pf2 = new PooledConnectionFactory(connectionFactory2);
pf2.setMaximumActiveSessionPerConnection(45);
pf2.setMaxConnections(40);
context.addComponent("broker1", JmsComponent.jmsComponentAutoAcknowledge(pf1));
context.addComponent("broker2", JmsComponent.jmsComponentAutoAcknowledge(pf2));
my route:
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
onException(SetParamsException.class)
.filter()
.method(new IsDisableFlowLoggingFilter(), "filter")
.process(new CreateErrorHandlerLogMessageProcessor())
.to("broker2:queue:ESB.EVENT.LOGGING");
from(fromBroker+":queue:"+sourceQueue+"?maxConcurrentConsumers=500&concurrentConsumers=40&asyncConsumer=true")
.process(new SetParamsProcessor())
.to("seda:EVENT.LOGGING")
.to("seda:EVENT.TRANSACTION.LOGGING")
.to("seda:EVENT.MONITOR.LOG")
.to("xslt:file://transform.xsl")
.to("broker2:queue:testMQDestinationOLOLO?maxConcurrentConsumers=500&concurrentConsumers=20&asyncConsumer=true")
from("seda:EVENT.LOGGING")
.filter()
.method(new IsDisableFlowLoggingFilter(), "filter")
.process(new CreateEventMessageProcessor())
.to("broker2:queue:EVENT.LOGGING");
from("seda:EVENT.TRANSACTION.LOGGING")
.process(new CreateTransactionDetailsMessageProcessor())
.to("broker2:queue:EVENT.TRANSACTION.LOGGING");
from("seda:EVENT.MONITOR.LOG")
.process(new CreateMonitoringMessageProcessor())
.to("broker2:queue:EVENT.MONITOR.LOG");
}
});
context.start();
This configuration gives me ~135 messages per second. I think that because my consumers work successively instead of parallel. Can anyone around help me with rate increasing?
PS: btw, ping to remote server ~2ms