You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by RMA <rm...@gmail.com> on 2014/07/16 19:26:59 UTC

Bridging from JMS to DIRECT without sending the JMS Reply in the DIRECT

Hi all,

I'm bit lost with a given task that I've been given as I'm a still a newbie
regarding Apache Camel. I'll provide a brief overview of the scenario and
the problem. 

I have a Camel Route that has two endpoints. The first one receives messages
from a JMS queue, umarshalls the message, sends the content to the second
endpoint (using the "Direct" component) and marshalls the reply sent from
that second endpoint.

The second endpoint receives from the aforementioned "Direct" endpoint and
implements some business logic.

What I was trying to achieve was to receive the message back into the "first
endpoint" so that it could reply back to the JMS client, since I've
explicitly chosen the "InOut" Message Exchange option.

Nevertheless what is happening is that (at least this is my suspicion) the
second endpoint is replying to the JMS client, which means that the
marshalling step (that is in the first endpoint) is skipped. As so the JMS
client is receiving a byte array instead of an XML message.

I've read the  JMS component <http://camel.apache.org/jms>   documentation
and I've seen the option "disableReplyTo", which seemed to be just what I
needed. Nevertheless, as my second endpoint uses the Direct component I
wasn't able to this option.

My question is: without changing the design (which means, having these two
endpoints as they are and using the Direct component on the second one) am I
able to accomplish what I intended? In other words, with this design am I
able to explicitly send the JMS reply from the first endpoint and not from
the second?

Thank you very much for your help.

Kind regards,
RMA



--
View this message in context: http://camel.465427.n5.nabble.com/Bridging-from-JMS-to-DIRECT-without-sending-the-JMS-Reply-in-the-DIRECT-tp5753926.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bridging from JMS to DIRECT without sending the JMS Reply in the DIRECT

Posted by RMA <rm...@gmail.com>.
Hi again Claus,

I ended up finding about the "covertBodyTo(String.class)" in  this post
<http://camel.465427.n5.nabble.com/How-to-use-JMS-TextMessage-Properties-td4574811.html> 
. Knowing that this is also your recommendation makes me feel more
comfortable about the implementation.

Once again thank you very much for the help!

Kind regards,
RMA




--
View this message in context: http://camel.465427.n5.nabble.com/Bridging-from-JMS-to-DIRECT-without-sending-the-JMS-Reply-in-the-DIRECT-tp5753926p5753975.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bridging from JMS to DIRECT without sending the JMS Reply in the DIRECT

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 17, 2014 at 1:06 PM, RMA <rm...@gmail.com> wrote:
> Hi Claus,
>
> First of all thank you very much for your answer. I've added some debug
> (using "process" with "system.out") to my routes and I can confirm the
> information you've given me.
>
> My new suspicious is now that the reply isn't sent as a JMS text message. In
> my asynchronous routes I explicitly add the option "?jmsMessageType=Text" in
> the "to()". I'll direct my investigation towards this new theory.

jmsMessageType=Text is only on the consumer side. If you want to reply
back as text message, make sure the message body is text based, such
as a String etc.

You can use covertBodyTo(string.class)

See on the JMS component page about mapping message body to JMS message types.

>
> Once again thank you very much for your help.
>
> Kind regards,
> RMA
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bridging-from-JMS-to-DIRECT-without-sending-the-JMS-Reply-in-the-DIRECT-tp5753926p5753959.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Bridging from JMS to DIRECT without sending the JMS Reply in the DIRECT

Posted by RMA <rm...@gmail.com>.
Hi Claus,

First of all thank you very much for your answer. I've added some debug
(using "process" with "system.out") to my routes and I can confirm the
information you've given me. 

My new suspicious is now that the reply isn't sent as a JMS text message. In
my asynchronous routes I explicitly add the option "?jmsMessageType=Text" in
the "to()". I'll direct my investigation towards this new theory.

Once again thank you very much for your help.

Kind regards,
RMA 





--
View this message in context: http://camel.465427.n5.nabble.com/Bridging-from-JMS-to-DIRECT-without-sending-the-JMS-Reply-in-the-DIRECT-tp5753926p5753959.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bridging from JMS to DIRECT without sending the JMS Reply in the DIRECT

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Its A -> B (and when B is complete) the control goes back to A, and
when A is complete, that "message" is sent back as reply to over JMS.

So after calling B and if you need to do more work before you can
reply over JMS, then just add further route processing steps.

On Wed, Jul 16, 2014 at 7:26 PM, RMA <rm...@gmail.com> wrote:
> Hi all,
>
> I'm bit lost with a given task that I've been given as I'm a still a newbie
> regarding Apache Camel. I'll provide a brief overview of the scenario and
> the problem.
>
> I have a Camel Route that has two endpoints. The first one receives messages
> from a JMS queue, umarshalls the message, sends the content to the second
> endpoint (using the "Direct" component) and marshalls the reply sent from
> that second endpoint.
>
> The second endpoint receives from the aforementioned "Direct" endpoint and
> implements some business logic.
>
> What I was trying to achieve was to receive the message back into the "first
> endpoint" so that it could reply back to the JMS client, since I've
> explicitly chosen the "InOut" Message Exchange option.
>
> Nevertheless what is happening is that (at least this is my suspicion) the
> second endpoint is replying to the JMS client, which means that the
> marshalling step (that is in the first endpoint) is skipped. As so the JMS
> client is receiving a byte array instead of an XML message.
>
> I've read the  JMS component <http://camel.apache.org/jms>   documentation
> and I've seen the option "disableReplyTo", which seemed to be just what I
> needed. Nevertheless, as my second endpoint uses the Direct component I
> wasn't able to this option.
>
> My question is: without changing the design (which means, having these two
> endpoints as they are and using the Direct component on the second one) am I
> able to accomplish what I intended? In other words, with this design am I
> able to explicitly send the JMS reply from the first endpoint and not from
> the second?
>
> Thank you very much for your help.
>
> Kind regards,
> RMA
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bridging-from-JMS-to-DIRECT-without-sending-the-JMS-Reply-in-the-DIRECT-tp5753926.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/