You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gnanaguru S <gn...@wipro.com> on 2013/01/31 09:50:33 UTC

How to find the number of routes in the camel context

Hi, 

Is there a way in camel, where we can count the number of routes in the
camel context ?

I have a need where I have to find the terminating endpoints/the last route.  

Regards
Guru
@gnanagurus
gnanaguru.com



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-find-the-number-of-routes-in-the-camel-context-tp5726601.html
Sent from the Camel - Users mailing list archive at Nabble.com.

AW: AW: How to find the number of routes in the camel context

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
Could you trigger the db operation by a special endpoint?
(Not sure if this is a "good design", so experts jump in ;) I'm just
thinking loud...)

from("direct:in")
    .to("direct:end") 
    /*this is new*/ 
    .process(new Processor() {
        public void process(Exchange exchange) {
            // trigger the db-operation via Java API call
        }
    });


Jan

                 

-----Ursprüngliche Nachricht-----
Von: Gnanaguru S [mailto:gnanaguru.sattanathan@wipro.com] 
Gesendet: Donnerstag, 31. Januar 2013 13:36
An: users@camel.apache.org
Betreff: Re: AW: How to find the number of routes in the camel context


Thanks Claus & Jan, 

I tried that, but I am not getting the right route count :(. 

Also I understand your concenr, if we have multiple terminal routes. 

I have a database operation when the final route is executed, that is the
reason am trying to get the route count. 

Otherwise if I can find when the camel context ends its execution, I can do
a data base operation there. Such that, how many terminal routes I have, I
can a database operation before the context is stopped. 

Even I tried with getEndpoints(), but even It does show the right count. 

Regards
Guru





--
View this message in context:
http://camel.465427.n5.nabble.com/How-to-find-the-number-of-routes-in-the-ca
mel-context-tp5726601p5726623.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AW: How to find the number of routes in the camel context

Posted by Gnanaguru S <gn...@wipro.com>.
Thanks Claus & Jan, 

I tried that, but I am not getting the right route count :(. 

Also I understand your concenr, if we have multiple terminal routes. 

I have a database operation when the final route is executed, that is the
reason am trying to get the route count. 

Otherwise if I can find when the camel context ends its execution, I can do
a data base operation there. Such that, how many terminal routes I have, I
can a database operation before the context is stopped. 

Even I tried with getEndpoints(), but even It does show the right count. 

Regards
Guru





--
View this message in context: http://camel.465427.n5.nabble.com/How-to-find-the-number-of-routes-in-the-camel-context-tp5726601p5726623.html
Sent from the Camel - Users mailing list archive at Nabble.com.

AW: How to find the number of routes in the camel context

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
You could use getRoutes() for getting the List of Routes.

But finding "the terminating endpoint" is not trivial (in my low Camel
knowledge).
Think of
  from("direct:in").wireTap("direct:tap").to("direct:out");
  from("direct:in2").to("direct:out");

What is the "terminating endpoint"? direct:tap or direct:out?
You also don't have a single start point ...


Jan

-----Ursprüngliche Nachricht-----
Von: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Gesendet: Donnerstag, 31. Januar 2013 10:20
An: users@camel.apache.org
Betreff: Re: How to find the number of routes in the camel context

On Thu, Jan 31, 2013 at 9:50 AM, Gnanaguru S
<gn...@wipro.com> wrote:
> Hi,
>
> Is there a way in camel, where we can count the number of routes in 
> the camel context ?
>

See the API on CamelContext

> I have a need where I have to find the terminating endpoints/the last
route.
>
> Regards
> Guru
> @gnanagurus
> gnanaguru.com
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-find-the-number-of-routes-in-
> the-camel-context-tp5726601.html Sent from the Camel - Users mailing 
> list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How to find the number of routes in the camel context

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 31, 2013 at 9:50 AM, Gnanaguru S
<gn...@wipro.com> wrote:
> Hi,
>
> Is there a way in camel, where we can count the number of routes in the
> camel context ?
>

See the API on CamelContext

> I have a need where I have to find the terminating endpoints/the last route.
>
> Regards
> Guru
> @gnanagurus
> gnanaguru.com
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-find-the-number-of-routes-in-the-camel-context-tp5726601.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen