camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sigmund <sigmund.lundg...@gmail.com>
Subject Re: Async request/response using producerTemplate
Date Thu, 07 Feb 2008 11:48:59 GMT

Found the problem, classpath issues/camel version. Got it working.

/S


Sigmund wrote:
> 
> Either way I try I get a class cast exception on the client side..
> 
> Client
> Long cryptoSendingId = (Long) producer.sendBody("jms:encryptQueue",
> cryptoSending);
> 
> implementing Processor on the server side and using this impl. also gives
> class cast exc.
>  
>    public void process(Exchange exchange) throws Exception {
>         log.debug("process");
>         Message out = exchange.getOut(true);
>         out.setBody(new Long(1L)); // test
>     }
> 
> In the case below I guess the return type must match the argument passed
> to the method?
> 
>     @MessageDriven(uri = "jms:encryptQueue")
>     public Long encrypt(CryptoSending cryptoSending) {
>         log.debug("encrypt");
>         return new Long(1L);
>     }
> 
> /S
> 
> 
> Sigmund wrote:
>> 
>> Hmm, tries just that before. I'll give it a try again.
>> 
>> Thanks
>> 
>> /S
>> 
>> 
>> James.Strachan wrote:
>>> 
>>> On 04/02/2008, Sigmund <sigmund.lundgren@gmail.com> wrote:
>>>>
>>>> I can manage with synchronous, but how do I set the response to be sent
>>>> back?
>>> 
>>> So the ProducerTemplate is the client side; it sends the request and
>>> receives the response.
>>> 
>>> Its the server side which takes the request object and sets the
>>> response. To implement the server side in Camel you'd use a route.
>>> 
>>> from("jms:someQueue").process(new Processor() {
>>>   public void process(Exchange exchange) {
>>>      Message out = exchange.getOut(true);
>>>      out.setBody(someResponseObject);
>>>    }
>>> };
>>> 
>>> or even easier is to use a Java bean method...
>>> 
>>> public class Foo {
>>> 
>>>  @MessageDriven(uri="jms:someQueue")
>>>   public String getResponse(String request) {...}
>>> }
>>> 
>>> See
>>> http://activemq.apache.org/camel/bean-integration.html
>>> 
>>> -- 
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>> 
>>> Open Source Integration
>>> http://open.iona.com
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Async-request-response-using-producerTemplate-tp15117797s22882p15332220.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message