You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mayur_bm <ma...@gmail.com> on 2015/05/14 12:19:26 UTC
rapid consumption of ActiveMQ messages
i am sending appx 1000 messages/sec in to ActiveMQ queue, via Camel Route.
Camel Context is as follows:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="MsgServlet" xmlns="http://camel.apache.org/schema/spring">
<route id="ConfigComponent">
<from uri="timer:foo?period=25s"/>
<to
uri="http://10.53.138.245:8080/demo/DemoServlet?component=1"/>
<to uri="bean:InitConfig?method=process"/>
</route>
<route id="servletToProcessor">
<from uri="jetty:http://10.53.138.100:10666/mytestservice"/>
<unmarshal>
<json library="Jackson"/>
</unmarshal>
<to uri="bean:MsgProcessor?method=process"/>
<to uri="activemq:queue:inbox" pattern="InOnly"/>
</route>
<route id="inToOutRoute">
<from uri="activemq:queue:inbox"/>
<to uri="bean:ESPProcessor?method=process"/>
</route>
</camelContext>
<bean id="InitConfig" class="org.sap.camel.iot.example.InitConfig">
</bean>
<bean id="MsgProcessor" class="org.sap.camel.iot.example.MsgProcessor">
</bean>
<bean id="ESPProcessor"
class="org.sap.camel.iot.example.ESPProcessor">
</bean>
<bean id="MMSProcessor"
class="org.sap.camel.iot.example.MMSProcessor">
</bean>
<broker id="broker" brokerName="myBroker" useShutdownHook="false"
useJmx="true"
persistent="true" dataDirectory="activemq-data"
xmlns="http://activemq.apache.org/schema/core">
<transportConnectors>
<transportConnector name="vm" uri="vm://myBroker"/>
<transportConnector name="tcp" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue="inbox" maxPageSize="1000" memoryLimit="100MB"
queuePrefetch="2000"/>
</policyEntries>
</policyMap>
</destinationPolicy>
</broker>
<bean class="org.apache.activemq.camel.component.ActiveMQComponent"
id="amq">
<property name="connectionFactory" ref="pooledCF" />
</bean>
<bean class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop" id="pooledCF" init-method="start">
<property name="connectionFactory" ref="AMQCF" />
<property name="maxConnections" value="2" />
</bean>
<bean class="org.apache.activemq.ActiveMQConnectionFactory" id="AMQCF">
<property name="brokerURL"
value="vm://myBroker?create=false&waitForStart=5000"/>
<property name="userName" value="karaf"/>
<property name="password" value="karaf"/>
<property name="copyMessageOnSend" value="true" />
<property name="useAsyncSend" value="true" />
<property name="prefetchPolicy.queuePrefetch" value="2000"/>
</bean>
</beans>
issue i am facing is, its taking lot of time to empty the queue. what
configuration changes i need to do to clean up the queue at earliest?
Regards,
Mayur
--
View this message in context: http://camel.465427.n5.nabble.com/rapid-consumption-of-ActiveMQ-messages-tp5767100.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: rapid consumption of ActiveMQ messages
Posted by mayur_bm <ma...@gmail.com>.
Thanks Guru,
is this solution means there will be 5 concurrent connection to my message
processor and each connection will be draining the ActiveMQ queue?.
Regards,
Mayur
--
View this message in context: http://camel.465427.n5.nabble.com/rapid-consumption-of-ActiveMQ-messages-tp5767100p5767128.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: rapid consumption of ActiveMQ messages
Posted by Gnanaguru S <gn...@gmail.com>.
One way to achieve what you want is, as he suggested add concurrent
consumers.
Also you can add Thread profile.
Regards
Guru
--
View this message in context: http://camel.465427.n5.nabble.com/rapid-consumption-of-ActiveMQ-messages-tp5767100p5767113.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: rapid consumption of ActiveMQ messages
Posted by akoufoudakis <ak...@gmail.com>.
If you want to speed up, you can use concurrentConsumers option.
http://camel.apache.org/competing-consumers.html.
--
View this message in context: http://camel.465427.n5.nabble.com/rapid-consumption-of-ActiveMQ-messages-tp5767100p5767102.html
Sent from the Camel - Users mailing list archive at Nabble.com.