FAQ
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.

Search Discussions

  • Claus Ibsen at Apr 16, 2012 at 7:36 am
    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 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/
  • Nafees at Apr 16, 2012 at 8:19 am
    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.
  • Claus Ibsen at Apr 16, 2012 at 9:02 am

    On Mon, Apr 16, 2012 at 10:02 AM, Nafees 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/
  • Nafees at Apr 16, 2012 at 10:11 am
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedApr 16, '12 at 7:29a
activeApr 16, '12 at 10:11a
posts5
users2
websitecamel.apache.org

2 users in discussion

Nafees: 3 posts Claus Ibsen: 2 posts

People

Translate

site design / logo © 2022 Grokbase