You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bruno Dusausoy <bd...@yp5.be> on 2012/07/23 09:36:37 UTC

Request-reply with Camel Spring AMQP

Hi,

I know this is not an official Camel component but is it possible to do 
request/reply with the Camel Spring AMQP component ?
I don't see any example on the internet.

Basically here's my context :

     <!-- Beans and Rabbit MQ Configuration here ... -->

     <camelContext xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="file:src/data?noop=true"/>
             <to uri="direct:beforeRabbit"/>
         </route>
         <route>
             <from uri="direct:beforeRabbit"/>
             <log message="Sending to RabbitMQ"/>
             <to 
uri="spring-amqp:mytest:myQueue:testKey?exchangePattern=InOut&amp;durable=true&amp;autodelete=false"/>
             <bean ref="outBean" method="process"/>
         </route>
         <route>
             <from 
uri="spring-amqp:mytest:myQueue:testKey?durable=true&amp;autodelete=false"/>
             <bean ref="processBean" method="process"/>
         </route>
     </camelContext>


And the beans :

public class OutBean {

     public void process(@Body String message) {
         System.out.println(message);
     }
}

public class ProcessBean {

     public String process() {
         return "Process completed";
     }
}


What I'm trying to do - this is a proof-of-concept - is to send the file 
through RabbitMQ and then get a response "Process completed" from the 
ProcessBean which is then displayed by the OutBean.

This isn't working. What is displayed is the body of the file, not the 
String "Process completed".

Am I doing something wrong ?

Thanks.
-- 
Bruno Dusausoy
Software engineer
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

Re: Request-reply with Camel Spring AMQP

Posted by Willem Jiang <wi...@gmail.com>.
I just take a quick look at the document of Camel Spring AMQP 
component[1], it doesn't support to setup the exchangePattern option.

 From your description, it looks like it is still use the InOnly 
exchange pattern.

On Mon Jul 23 15:36:37 2012, Bruno Dusausoy wrote:
> Hi,
>
> I know this is not an official Camel component but is it possible to
> do request/reply with the Camel Spring AMQP component ?
> I don't see any example on the internet.
>
> Basically here's my context :
>
>     <!-- Beans and Rabbit MQ Configuration here ... -->
>
>     <camelContext xmlns="http://camel.apache.org/schema/spring">
>         <route>
>             <from uri="file:src/data?noop=true"/>
>             <to uri="direct:beforeRabbit"/>
>         </route>
>         <route>
>             <from uri="direct:beforeRabbit"/>
>             <log message="Sending to RabbitMQ"/>
>             <to
> uri="spring-amqp:mytest:myQueue:testKey?exchangePattern=InOut&amp;durable=true&amp;autodelete=false"/>
>
>             <bean ref="outBean" method="process"/>
>         </route>
>         <route>
>             <from
> uri="spring-amqp:mytest:myQueue:testKey?durable=true&amp;autodelete=false"/>
>
>             <bean ref="processBean" method="process"/>
>         </route>
>     </camelContext>
>
>
> And the beans :
>
> public class OutBean {
>
>     public void process(@Body String message) {
>         System.out.println(message);
>     }
> }
>
> public class ProcessBean {
>
>     public String process() {
>         return "Process completed";
>     }
> }
>
>
> What I'm trying to do - this is a proof-of-concept - is to send the
> file through RabbitMQ and then get a response "Process completed" from
> the ProcessBean which is then displayed by the OutBean.
>
> This isn't working. What is displayed is the body of the file, not the
> String "Process completed".
>
> Am I doing something wrong ?
>
> Thanks.


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang