java - Camel response from bean back onto ActiveMQ queue -


i'm using camel (with camel-ejb dependency) route messages activemq bean's method. far i've got receiving message in requesthandler bean.

<amq:connectionfactory id="amqconnectionfactory"     brokerurl="tcp://localhost:61616" />  <bean class="org.springframework.jms.connection.cachingconnectionfactory"     id="connectionfactory">     <constructor-arg ref="amqconnectionfactory" />     <property name="sessioncachesize" value="100" /> </bean>  <bean class="org.springframework.jms.core.jmstemplate" id="jmstemplate">     <constructor-arg ref="connectionfactory" /> </bean>  <camel:camelcontext id="camelcontext">     <camel:route>         <camel:from uri="activemq:queue:inqueue" />         <camel:setexchangepattern pattern="inout"/>         <camel:to uri="bean:requesthandler?method=handlerequest" />     </camel:route> </camel:camelcontext> 

if change handlerequest return string, how modify route put string on queue person sending me message?

thanks!

edit:

client code:

(in camel-context.xml)

<camel:camelcontext id="camel-client">     <camel:template id="cameltemplate" /> </camel:camelcontext>  <bean id="jms" class="org.apache.activemq.camel.component.activemqcomponent">     <property name="brokerurl" value="tcp://localhost:61616" /> </bean> 

(in camelclient.java)

public class camelclient  {     public static void main(string[] args) {          applicationcontext context = new classpathxmlapplicationcontext("camel-context.xml");         producertemplate ptemplate = context.getbean("cameltemplate", producertemplate.class);          system.out.println("message sending started");         string ret = ptemplate.requestbody("activemq:queue:inqueue", "47264", string.class);         system.out.println("message received:" + ret);     } } 

and try adding log step in route

<camel:route>     <camel:from uri="activemq:queue:inqueue" />     <camel:setexchangepattern pattern="inout"/>     <camel:to uri="bean:requesthandler?method=handlerequest" />     <camel:to uri="log:reply" /> </camel:route> 

and show code requesthandler bean does, can let better.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -