You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yaog <ya...@gmail.com> on 2010/01/11 10:03:30 UTC

route debugging

Hi,

I have this rourte:

	<route id="route1">
			<from uri="direct:start" />
			<to uri="bean:compAImpl" />			
			<to uri="jms:compB" />
			<to uri="bean:compBImpl" />			
			<to uri="jms:compC" />
			<to uri="bean:compCImpl" />			
		</route>	


compAImpl is activated ok but then it gets stuck and I fail on timeout with
the jms.

can anyone identify what is wrong?

how do I debug a route that does not work as I think it should? Itried
adding trace-"true" on the camel context. Didn't help much. endpoint are
created ok.

Please advise.


-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27107483.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by James Strachan <ja...@gmail.com>.
2010/1/11 yaog <ya...@gmail.com>:
>
> Basically, I am evaluating Camel at the moment.
>
> It is desired by our architecture to have routes that activate different
> beans (through different queues) and be able to get their responses back to
> the caller thread.

So to activate your two beans when a message is sent to queue "compA"
or "compB" you'd write 2 routes like this...

<route>
  <from uri="jms:compA" />
  <to uri="bean:compAImpl" />
</route>
<route>
  <from uri="jms:compB" />
  <to uri="bean:compBImpl" />
</route>

Each route represents a 'consumer' on a queue. In this case you are
creating 2 consumers on queues compA and compB which when a message is
sent to them, you invoke beans and return the response.


The single route with a single pipeline you started this thread with
has a different effect...

   <route id="route1">
                       <from uri="direct:start" />
                       <to uri="bean:compAImpl" />
                       <to uri="jms:compB" />
                       <to uri="bean:compBImpl" />
                       <to uri="jms:compC" />
                       <to uri="bean:compCImpl" />
               </route>

this will just send a message to compB queue (i.e be a producer on
that queue, not a consumer) and wait for the response from that queue,
then send it on to the bean compBImpl. i.e. for the pipeline to work,
there must be a consumer on the queue compB. This is why Claus
suggested a separate route to act as the consumer on queue compB.


> So that is what I am trying to do. If I define different routes I will not
> be able to send the info back...

I don't follow this last sentence.



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

Open Source Integration
http://fusesource.com/

Re: route debugging

Posted by yaog <ya...@gmail.com>.
For the sake of others. This now works. Thanks for your help:

		<route id="route1">
			<from uri="direct:start" />
			<to uri="bean:compAImpl" />
			<to uri="jms:compB" />
			<to uri="jms:compC" />			
		</route>


		<route id="route2">
			<from uri="jms:compB" />
			<to uri="bean:compBImpl" />
		</route>

		<route id="route3">
			<from uri="jms:compC" />
			<to uri="bean:compCImpl" />
		</route>
-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27111964.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by James Strachan <ja...@gmail.com>.
2010/1/11 yaog <ya...@gmail.com>:
>
>
>
> Claus Ibsen-2 wrote:
>>
>>
>> You need a consumer on the JMS queue to send back the reply on the
>> temporary JMS queue.
>> If you do not use Camel for that then you need some other "stuff" to do
>> that.
>>
>> If you want to use Camel for that then you need to create a 2nd route
>> which I posted to you before.
>> Instead of that transform then let it invoke a bean instead
>>
>> <route>
>>   <from uri="jms:queue:foo"/>
>>   <bean ref="xxx" method="bar"/>
>> </route>
>>
>> <bean id="xxx" class="com.mycompany.XXX"/>
>>
>>
>
> And will the second route be able to reply something in the first route.
> Does Camel cover this?

Yes

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

Open Source Integration
http://fusesource.com/

Re: route debugging

Posted by yaog <ya...@gmail.com>.


Claus Ibsen-2 wrote:
> 
> 
> You need a consumer on the JMS queue to send back the reply on the
> temporary JMS queue.
> If you do not use Camel for that then you need some other "stuff" to do
> that.
> 
> If you want to use Camel for that then you need to create a 2nd route
> which I posted to you before.
> Instead of that transform then let it invoke a bean instead
> 
> <route>
>   <from uri="jms:queue:foo"/>
>   <bean ref="xxx" method="bar"/>
> </route>
> 
> <bean id="xxx" class="com.mycompany.XXX"/>
> 
> 

And will the second route be able to reply something in the first route.
Does Camel cover this?


-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27111761.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 3:35 PM, yaog <ya...@gmail.com> wrote:
>
> Basically, I am evaluating Camel at the moment.
>
> It is desired by our architecture to have routes that activate different
> beans (through different queues) and be able to get their responses back to
> the caller thread.
>

You need a consumer on the JMS queue to send back the reply on the
temporary JMS queue.
If you do not use Camel for that then you need some other "stuff" to do that.

If you want to use Camel for that then you need to create a 2nd route
which I posted to you before.
Instead of that transform then let it invoke a bean instead

<route>
  <from uri="jms:queue:foo"/>
  <bean ref="xxx" method="bar"/>
</route>

<bean id="xxx" class="com.mycompany.XXX"/>


> So that is what I am trying to do. If I define different routes I will not
> be able to send the info back...
> --
> View this message in context: http://old.nabble.com/route-debugging-tp27107483p27111395.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: route debugging

Posted by yaog <ya...@gmail.com>.
Basically, I am evaluating Camel at the moment.

It is desired by our architecture to have routes that activate different
beans (through different queues) and be able to get their responses back to
the caller thread.

So that is what I am trying to do. If I define different routes I will not
be able to send the info back...
-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27111395.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by James Strachan <ja...@gmail.com>.
2010/1/11 yaog <ya...@gmail.com>:
>
> well, If I have;
>
> <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <to uri="jms:compB" />
>                        <to uri="bean:compBImpl" />
> </route>
>
> and compBImpl returns a String, why isn't that equivalent to the transform
> you mention?

Claus was talking about creating a separate route to implement the
service at "jms:compB" which your route is attempting to communicate
with. i.e. something which consumes from queue "compB" and returns
responses based on the message its given.

Do you already have some service consuming from jms:compB? Or did you
think the pipeline you've created sends to jms:compB and consumes from
it at the same time?

Maybe its worth stepping back here a little - what are you trying to
do with the  "compB" queue?

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

Open Source Integration
http://fusesource.com/

Re: route debugging

Posted by Willem Jiang <wi...@gmail.com>.
First you should know camel using a Pipeline[1] to connect all the 
endpoints and processors together.
If the MEP is InOut, if Pipeline can't get the response from jms:compB 
endpoint, the Pipeline will not send the message to the next endpoint or 
processor.

For the "to endpoint", camel will create a producer(like a send 
processor) for the endpoint, for the "from endpoint", camel will create 
a consumer for the endpoint (creating a JMS listener for the JMS endpoint).

So the compBImple will not be invoked when the JMS message is sent to 
Queue compB.

[1]https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java

Willem
yaog wrote:
> well, If I have;
> 
> <route id="route1"> 
>                         <from uri="direct:start" /> 
>                         <to uri="bean:compAImpl" />	
>                         <to uri="jms:compB" /> 
>                         <to uri="bean:compBImpl" />	                        
> </route>	
> 
> and compBImpl returns a String, why isn't that equivalent to the transform
> you mention?
> 
> 


Re: route debugging

Posted by yaog <ya...@gmail.com>.
well, If I have;

<route id="route1"> 
                        <from uri="direct:start" /> 
                        <to uri="bean:compAImpl" />	
                        <to uri="jms:compB" /> 
                        <to uri="bean:compBImpl" />	                        
</route>	

and compBImpl returns a String, why isn't that equivalent to the transform
you mention?


-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27109901.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 12:17 PM, yaog <ya...@gmail.com> wrote:
>
> Maybe I am missing something? I know for sure that Camel creates for me a
> temp reply queue. as far as I understand from the documentation, the fact
> that my listeners attempts a return of an Object should cause Camel to send
> that response via the reply queue.
>
> Where am I wrong?

You need a 2nd route to consume and return that reply on the temp
queue, such as shown below:

<route>
   <from uri="jms:compB"/>
   <!-- do something with message, here we just return a fixed message -->
   <transform><constant>Hi from B</constant></transform>
</route>



> --
> View this message in context: http://old.nabble.com/route-debugging-tp27107483p27108985.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: route debugging

Posted by yaog <ya...@gmail.com>.
Maybe I am missing something? I know for sure that Camel creates for me a
temp reply queue. as far as I understand from the documentation, the fact
that my listeners attempts a return of an Object should cause Camel to send
that response via the reply queue. 

Where am I wrong?
-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27108985.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 10:31 AM, yaog <ya...@gmail.com> wrote:
>
> InOnly indeed solved my problem, however why doesn't InOut work if my beans
> return an Objet and Camel creates a temp replyTo queue?
> --

request/reply over JMS requires 2 queues: 1 for request, 1 for reply.

And it also require a consumer on the "other" side to listen to the
request queue and send the reply back on the reply queue.
And this is what you lack, and hence why you get a timeout.

So if you add a route that consumes from that queue and maybe does
something to the message so you can see its changed when it comes
back.
Then that should work with InOut.


> View this message in context: http://old.nabble.com/route-debugging-tp27107483p27107783.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: route debugging

Posted by yaog <ya...@gmail.com>.
InOnly indeed solved my problem, however why doesn't InOut work if my beans
return an Objet and Camel creates a temp replyTo queue?
-- 
View this message in context: http://old.nabble.com/route-debugging-tp27107483p27107783.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: route debugging

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 11, 2010 at 10:03 AM, yaog <ya...@gmail.com> wrote:
>
> Hi,
>
> I have this rourte:
>
>        <route id="route1">
>                        <from uri="direct:start" />
>                        <to uri="bean:compAImpl" />
>                        <to uri="jms:compB" />
>                        <to uri="bean:compBImpl" />
>                        <to uri="jms:compC" />
>                        <to uri="bean:compCImpl" />
>                </route>
>
>
> compAImpl is activated ok but then it gets stuck and I fail on timeout with
> the jms.
>

That is because you are very likely doing a request/reply messaging
style, eg using InOut MEP.
Send using InOnly to the JMS queue (or use wireTap to tap the message
to the JMS queue).

See this unit test how to
http://svn.apache.org/viewvc?rev=897802&view=rev


> can anyone identify what is wrong?
>
> how do I debug a route that does not work as I think it should? Itried
> adding trace-"true" on the camel context. Didn't help much. endpoint are
> created ok.
>
> Please advise.
>
>
> --
> View this message in context: http://old.nabble.com/route-debugging-tp27107483p27107483.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus