You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nafees <s....@gmail.com> on 2012/04/16 09:24:38 UTC
How to invoke a route based on incoming ftp message..
Hi ,
I am new to Apache Camel. I am facing this problem..
Depending on message coming from activemq , i have to select the
appropriate route ..
// a bean which is sending message to activemq using jms
from("bean:idProducer?method=sendMessage").to("jms:queue:myqueue1");
// from message coming from activemq.. if user send ftp as message i need to
incoke route1 or route 2
from("jms:queue:myqueue1")
.choice()
.when(body().contains("ftp")).to("bean:mediationSource?method=ftpServer")
.to("bean:mediationSource?method=localLocation")
.to("bean:mediationSource?method=pickFile")
.beanRef("ggsnToBdrProcessor")
.when(body().contains("local")).to("bean:mediationSource?method=localDataLocation")
.to("bean:mediationSource?method=pickFile")
.beanRef("ggsnToBdrProcessor");
what could i do in this regard and i want to consume the jms message only
once and run the routes.
Thanks in advance
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-a-route-based-on-incoming-ftp-message-tp5643121p5643121.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke a route based on incoming ftp message..
Posted by Nafees <s....@gmail.com>.
Thanks. I will try to implement your suggestions. Thank u so much...
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-a-route-based-on-incoming-ftp-message-tp5643121p5643395.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke a route based on incoming ftp message..
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Apr 16, 2012 at 10:02 AM, Nafees <s....@gmail.com> wrote:
> Thanks for reply.
>
> Is there any way, in which I can just send message once to activemq apart
> from using it inside a route and depending on data received from that .. I
> want to call the routes..
>
You can send a message to AMQ using a tool such as jconsole, hermes,
Fuse IDE etc.
And Apache ActiveMQ has some command line tools as well.
http://activemq.apache.org/tools.html
http://activemq.apache.org/activemq-command-line-tools-reference.html
>From Camel you can send a message once using for example the timer
endpoint, and then set the repeatCount=1
from("timer:once?repeatCount=1")
.transform(constant("Hello World"))
.to("activemq:queue:someQueueName");
You can also send a message to AMQ using Camel from Java code using
the ProducerTemplate.
http://camel.apache.org/producertemplate.html
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-a-route-based-on-incoming-ftp-message-tp5643121p5643196.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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: How to invoke a route based on incoming ftp message..
Posted by Nafees <s....@gmail.com>.
Thanks for reply.
Is there any way, in which I can just send message once to activemq apart
from using it inside a route and depending on data received from that .. I
want to call the routes..
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-a-route-based-on-incoming-ftp-message-tp5643121p5643196.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke a route based on incoming ftp message..
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What is your problem, your route seems at first glance okay.
You are right to use the Content Based Router to route depending on the message.
http://camel.apache.org/content-based-router.html
On Mon, Apr 16, 2012 at 9:24 AM, Nafees <s....@gmail.com> wrote:
> Hi ,
>
> I am new to Apache Camel. I am facing this problem..
>
> Depending on message coming from activemq , i have to select the
> appropriate route ..
>
> // a bean which is sending message to activemq using jms
> from("bean:idProducer?method=sendMessage").to("jms:queue:myqueue1");
>
Mind that when doing this, Camel will keep calling the bean
continuously which mean a lot of messages is sent to the queue.
You may want to look at using a timer to trigger messages to be routed
at a slower pace
http://camel.apache.org/timer
> // from message coming from activemq.. if user send ftp as message i need to
> incoke route1 or route 2
> from("jms:queue:myqueue1")
> .choice()
>
> .when(body().contains("ftp")).to("bean:mediationSource?method=ftpServer")
>
This predicate will just check that the message body contains the
string "ftp". Is this what you want to do?
> .to("bean:mediationSource?method=localLocation")
>
> .to("bean:mediationSource?method=pickFile")
> .beanRef("ggsnToBdrProcessor")
>
>
> .when(body().contains("local")).to("bean:mediationSource?method=localDataLocation")
>
> .to("bean:mediationSource?method=pickFile")
> .beanRef("ggsnToBdrProcessor");
>
>
> what could i do in this regard and i want to consume the jms message only
> once and run the routes.
>
> Thanks in advance
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-a-route-based-on-incoming-ftp-message-tp5643121p5643121.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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/