You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "l.muscari" <l....@reply.it> on 2013/10/07 18:23:24 UTC

Getting route info problems.

hi, 
i'am a young developer and in this day i have to develop with apache camel
for first time.
So, i have a simple webapp, with a
org.apache.camel.component.servletlistener.SimpleCamelServletContextListener
listener 
and a servlet that implements  CamelContextLifecycle that manage the
lyfecycle of camel context.
in this servlet, i load some ROUTES from a properties file. till here all is
ok. 
now i have to do a simple web page (a jsp-page) that make the summary of
routes that have been loaded. 

to do this i need to retrieve the "from " a and "to ".

till now i try in vain to get these info from CamelContext, by taking it
from the servlet that implements CamelContextLifecycle and i can retrieve
tha camel context. but from this i can't get info i needed. 
 i can retrieve the "from" info by get the endpoint of single route from
camel context, but for "to" info i been not able. 

If you know a way to get this info from camel context (or eventually by
other way) please help me!!!

Luca



--
View this message in context: http://camel.465427.n5.nabble.com/Getting-route-info-problems-tp5741035.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Getting route info problems.

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

Please use the @user mailing list / user forum for these kind of
questions. You will have more people to help you there.

See
http://camel.apache.org/mailing-lists.html
http://camel.apache.org/discussion-forums.html

On Mon, Oct 7, 2013 at 6:23 PM, l.muscari <l....@reply.it> wrote:
> hi,
> i'am a young developer and in this day i have to develop with apache camel
> for first time.
> So, i have a simple webapp, with a
> org.apache.camel.component.servletlistener.SimpleCamelServletContextListener
> listener
> and a servlet that implements  CamelContextLifecycle that manage the
> lyfecycle of camel context.
> in this servlet, i load some ROUTES from a properties file. till here all is
> ok.
> now i have to do a simple web page (a jsp-page) that make the summary of
> routes that have been loaded.
>
> to do this i need to retrieve the "from " a and "to ".
>
> till now i try in vain to get these info from CamelContext, by taking it
> from the servlet that implements CamelContextLifecycle and i can retrieve
> tha camel context. but from this i can't get info i needed.
>  i can retrieve the "from" info by get the endpoint of single route from
> camel context, but for "to" info i been not able.
>
> If you know a way to get this info from camel context (or eventually by
> other way) please help me!!!
>
> Luca
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Getting-route-info-problems-tp5741035.html
> Sent from the Camel Development mailing list archive at Nabble.com.



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

Re: Getting route info problems.

Posted by Claus Ibsen <cl...@gmail.com>.
You can easily output the routes as XML as we do in the Karaf commands.
http://camel.apache.org/karaf.html

Though mind this questions belongs to the user mailing list / user
forum. So please move there.

On Tue, Oct 8, 2013 at 10:20 AM, matriv <ma...@gmail.com> wrote:
> Hello,
>
> It's not so easy to get the "to" as it is to get the "from" for a camel
> route. I have a similar webapp that you use to manage some specific camel
> routes and here is an example of a code that reads the existing routes from
> camel context and show them in a nice data grid interface:
>
> // Fetch destination endpoint
> String[] toSplitted;
> if (route.getRouteContext().getRoute().getOutputs().get(0) instanceof
> FilterDefinition) {
>         transformer =
> route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(0).getLabel();
>         if
> (route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().startsWith("log"))
> {
>                 toSplitted = null;
>         } else {
>                 toSplitted =
> route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().split(":");
>         }
> } else {
>         transformer =
> route.getRouteContext().getRoute().getOutputs().get(1).getLabel();
>         if
> (route.getRouteContext().getRoute().getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().startsWith("log"))
> {
>                 toSplitted = null;
>         } else {
>                 toSplitted =
> route.getRouteContext().getRoute().getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().split(":");
>         }
> }
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Getting-route-info-problems-tp5741035p5741099.html
> Sent from the Camel Development mailing list archive at Nabble.com.



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

Re: Getting route info problems.

Posted by matriv <ma...@gmail.com>.
Hello,

It's not so easy to get the "to" as it is to get the "from" for a camel
route. I have a similar webapp that you use to manage some specific camel
routes and here is an example of a code that reads the existing routes from
camel context and show them in a nice data grid interface:

// Fetch destination endpoint
String[] toSplitted;
if (route.getRouteContext().getRoute().getOutputs().get(0) instanceof
FilterDefinition) {
	transformer =
route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(0).getLabel();
	if
(route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().startsWith("log"))
{
		toSplitted = null;
	} else {
		toSplitted =
route.getRouteContext().getRoute().getOutputs().get(0).getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().split(":");
	}
} else {
	transformer =
route.getRouteContext().getRoute().getOutputs().get(1).getLabel();
	if
(route.getRouteContext().getRoute().getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().startsWith("log"))
{
		toSplitted = null;
	} else {
		toSplitted =
route.getRouteContext().getRoute().getOutputs().get(1).getOutputs().get(0).getOutputs().get(0).getLabel().split(":");
	}
}




--
View this message in context: http://camel.465427.n5.nabble.com/Getting-route-info-problems-tp5741035p5741099.html
Sent from the Camel Development mailing list archive at Nabble.com.