You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mattmadhavan <ma...@yahoo.com> on 2011/11/12 03:01:23 UTC

Help creating a route amq1-->bean-->amq2 - with timeouts

Hello,
I have been struggling recently to define  a simple rout!

I want the messages sent to a JMS (AMQ) to be sent to a method of a bean and
then reply sent to another queue.

Also the bean may take more than 20 secs to process. So I would like to add
a large timeout value as well.

This is what I have now! 

    <camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/blueprint">
        <route id="in-bound" autoStartup="true">
            <description>Camel In-Bound Route</description>
            <from uri="activemq:TestHarness.A"/>
			<to uri="bean:messageReceiver?method=onMessage"/>
        </route>
   </camelContext>

How do I extend this?


Any help will be appreciated in advance

Thanks
Matt


--
View this message in context: http://camel.465427.n5.nabble.com/Help-creating-a-route-amq1-bean-amq2-with-timeouts-tp4986086p4986086.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help creating a route amq1-->bean-->amq2 - with timeouts

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

If you do request/reply over JMS then read the JMS wiki page
http://camel.apache.org/jms

There is a requestTimeout option which defaults to 20000 millis = 20 sec.


On Sun, Nov 13, 2011 at 1:05 AM, mattmadhavan <ma...@yahoo.com> wrote:
> Hi Christian,
> Thank you very much for the reply! I appreciate it.
>
> I have couple of more questions please!
> /
> I send receive the message as follows:/
>  Transfer reply = (Transfer) template.requestBody("activemq:TestHarness.A",
> transfer);
>
> on the oneMessage method of the bean, I think I should just return a value
> rt?
>
> public Object onMessage(Object obj) {
>    Transfer transfer = (Transfer) obj;
>     do some wotk
>
>    return transfer;
> }
>
> Will it work with the above configuration you sent?
>
> Also while testing the onMessage call may take long time to return! How can
> I specify a timeout value more than the default 20000 milli secs?
>
> I appreciate your help in advance!
>
> Thanks
> Matt
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Help-creating-a-route-amq1-bean-amq2-with-timeouts-tp4986086p4987824.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Help creating a route amq1-->bean-->amq2 - with timeouts

Posted by mattmadhavan <ma...@yahoo.com>.
Hi Christian,
Thank you very much for the reply! I appreciate it.

I have couple of more questions please!
/
I send receive the message as follows:/
 Transfer reply = (Transfer) template.requestBody("activemq:TestHarness.A",
transfer);

on the oneMessage method of the bean, I think I should just return a value
rt?

public Object onMessage(Object obj) {
    Transfer transfer = (Transfer) obj;
     do some wotk

    return transfer;
}

Will it work with the above configuration you sent?

Also while testing the onMessage call may take long time to return! How can
I specify a timeout value more than the default 20000 milli secs?

I appreciate your help in advance!

Thanks
Matt



--
View this message in context: http://camel.465427.n5.nabble.com/Help-creating-a-route-amq1-bean-amq2-with-timeouts-tp4986086p4987824.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help creating a route amq1-->bean-->amq2 - with timeouts

Posted by Christian Müller <ch...@gmail.com>.
Hey Matt!

Welcome in the Apache Camel community!

Something like this should fit your needs:

<camelContext id="camelContext" xmlns="
http://camel.apache.org/schema/blueprint">
   <route id="in-bound" autoStartup="true">
     <description>Camel In-Bound Route</description>
     <from uri="activemq:TestHarness.A?concurrentConsumers=10"/>
     <to uri="bean:messageReceiver?method=onMessage"/>
     <to uri="activemq:TestHarness.B"/>
  </route>
<camelContext>

By default, the ActiveMQ component use the InOnly message exchange pattern.
This means you consume a message, process the message and put the response
into another queue.
The WIKI pages at [1] and [2] are also useful. There you can find more
information about concurrentConsumers option.

[1] http://camel.apache.org/jms.html
[2] http://camel.apache.org/activemq.html

Best,
Christian


On Fri, Nov 11, 2011 at 6:01 PM, mattmadhavan <ma...@yahoo.com>wrote:

> Hello,
> I have been struggling recently to define  a simple rout!
>
> I want the messages sent to a JMS (AMQ) to be sent to a method of a bean
> and
> then reply sent to another queue.
>
> Also the bean may take more than 20 secs to process. So I would like to add
> a large timeout value as well.
>
> This is what I have now!
>
>    <camelContext id="camelContext"
> xmlns="http://camel.apache.org/schema/blueprint">
>        <route id="in-bound" autoStartup="true">
>            <description>Camel In-Bound Route</description>
>            <from uri="activemq:TestHarness.A"/>
>                        <to uri="bean:messageReceiver?method=onMessage"/>
>        </route>
>   </camelContext>
>
> How do I extend this?
>
>
> Any help will be appreciated in advance
>
> Thanks
> Matt
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-creating-a-route-amq1-bean-amq2-with-timeouts-tp4986086p4986086.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>