Roman N
Roman N

Reputation: 5110

List of Camel routes

I use Apache Camel in java ee project with wildfly.

Do routes with DSL, like this:

from("direct:route1").process(new Processor() {
    @Override
    public void process(Exchange exchange) throws Exception {
        // bla-bal-bale
    }
}).to("direct:route2");

Sometimes I get errors, so I need to check routes How to get all of Camel routes? Maybe there is any maven command?

Upvotes: 2

Views: 3267

Answers (4)

Prateek Mehta
Prateek Mehta

Reputation: 507

Use "route-list" command to see routes in Apache Karaf

Upvotes: 0

Miloš Milivojević
Miloš Milivojević

Reputation: 5369

To view the routes from your live Camel application, you would have to use JMX; since you need to access them from the terminal you can use jmxterm.

For a list of functionality/data that Camel exposes through JMX, as well as for other configuration instructions, I suggest you give the official documentation a look.

Upvotes: 2

Andy Longwill
Andy Longwill

Reputation: 634

If you must use a terminal then jmxterm as miloš-milivojević mentions will work.

If you can use a browser then I'd recommend running http://hawt.io/ on the same server. This provides a prettier JConsole via a browser with added functionality for viewing Camel routes (e.g. you can stop/start/debug routes)

Upvotes: 2

Darius X.
Darius X.

Reputation: 2937

You can get the CamelContext object. That supports a method with the signature:

Collection<Endpoint> getEndpoints();

You can iterate through that collection to get the various endpoints, and check for information you need. For example:

Collection<Endpoint> endPoints = context.getEndpoints();   
for (Endpoint nxtEndPoint : endPoints)
{
    System.out.println("ENDPOINT:"+ nxtEndPoint.getEndpointUri());
}

Upvotes: 1

Related Questions