ActiveMQ ReplyTo with ReplyToType as "shared" with multi threading is not working
sathiya36 Nov 2, 2015 8:58 AMGreetings.,
I'm stuck with a issue with activemq. I'm calling three services through activemq(replyTo type) and consolidating the response from the three services to send back the response.
The current activemq bean definition is not working. My request to "activemq:Queue2?replyToType=Shared&replyTo=Queue2Reply" itself is not consumed by the queue.
Your help is much appreciated.
My Implementation:
CamelRoute:
<route id="route-1" streamCache="true">
<from uri="activemq:Queue1?replyToType=Shared&replyTo=Queue1Reply" />
<to uri="direct:route2" />
</route>
<route id="route-2" streamCache="true">
<from uri="direct:route2" />
<to uri="activemq:Queue2?replyToType=Shared&replyTo=Queue2Reply" />
<choice>
<when><!--someconditions-->
<to uri="direct:route3" />
</when>
<otherwise>Stop the flow and return response</otherwise>
</route>
<route id="route-3" streamCache="true">
<from uri="direct:route3" />
<when>
<!-- Condition-->
<to uri="activemq:Queue3?replyToType=Shared&replyTo=Queue3Reply" />
</when>
<otherwise>
<to uri="activemq:Queue4?replyToType=Shared&replyTo=Queue4Reply" />
</otherwise>
</route>
Activemq Definition:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="userName" value="*********"/>
<property name="password" value="**********"/>
<property name="redeliveryPolicy" ref="redeliveryPolicy"/>
<property name="watchTopicAdvisories" value="false"/>
</bean>
<!-- setup spring jms TX manager -->
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="poolConnectionFactory" />
</bean>
<!-- setup JMS connection factory -->
<bean id="poolConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<!-- define our activemq component -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
<property name="concurrentConsumers" value="5"/>
<property name="requestTimeout" value="45000" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="poolConnectionFactory" />
<property name="transactionManager" ref="jmsTransactionManager" />
<property name="transacted" value="true" />
<property name="explicitQosEnabled" value="true"/>
<property name="jmsMessageType" value="Text"/>
<property name="disableTimeToLive" value="true" />
</bean>
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="2"/>
</bean>
</beans>
Regards.,
Sathiyaraja P