camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: ProducerTemplate and JMSReplyTo
Date Fri, 15 Feb 2008 11:53:24 GMT
On 15/02/2008, Magnus Heino <magnus@filur.org> wrote:
> On Fri, Feb 15, 2008 at 12:28 PM, James Strachan <james.strachan@gmail.com>
>  wrote:
>
>
>  > On 15/02/2008, Magnus Heino <magnus@filur.org> wrote:
>  > > Seems like a easy thing to me, but I can't get it working.
>  > >
>  > >  I have this:
>  > >
>  > >  @EndpointInject(uri = "jms:queue:updateRequest")
>  > >     private ProducerTemplate<Exchange> producer;
>  > >
>  > >  and want to send a message, and set JMSReplyTo.
>  > >
>  > >  How do I do it?
>  > >
>  > >  this.producer.sendBodyAndHeader("mybody, "JMSReplyTo",
>  > >  "jms:queue:updateReceipt");
>  > >
>  > >  That doesn't work...
>  >
>  > The easiest way is to just set the pattern on the exchange to InOut
>  >
>  > exchange.setPattern(ExchangePattern.InOut)
>  >
>  > and it'll use a temporary queue to do request reply.
>  >
>
>
> How do I do this using the producer above? Where do I get hold of this
>  exchange? Please be explicit, I just don't get this :-P

Oh sorry - I forgot you were using the send* method and not having
access to the underlying Exchange.

Firstly you can pass a Processor to most of the send* methods to get
the Exchange before its sent if you wanna noodle/transform it.

But the method I should have directed you to is...


producer.requestBodyAndHeader(...)

which does the same thing under the covers (i.e. uses an InOut
exchange rather than InOnly)



>  > Though if you wanna set the JMSReplyTo queue, you need to currently
>  > set the actual JMS Destination as the header value.
>  >
>  > I guess we could get smart - and have some kinda converter method so
>  > that if its a String we convert it to the queue name?
>  >
>  > So we could do something like...
>  > producer.sendBodyAndHeader("mybody, "JMSReplyTo", "queue:updateReceipt");
>  >
>  >
>  > >  What I really want to do is listen to a jms queue, unmarshal the result
>  > with
>  > >  jaxb, forward that to a spring bean, and return the result from the
>  > spring
>  > >  bean to the jsmreplyto in the received message. Seems like a basic
>  > simple
>  > >  thing, but how? :)
>  >
>  > Oh thats even easier :)
>  >
>  >
>  > from("jms:myQueue").bean("myBeanName", "theMethod");
>  >
>  > Make sure you've camel-jaxb and camel-jms on the classpath and it
>  > should just work.
>
>
>
> Ok, thats actually how I'm doing it. But right now the response is sent
>  nowhere, but then I just need to set this exchange pattern then I guess..
>  somehow..

Is there a JMSReplyTo header on the message when you get it on the server side?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message