// the route must be part of the camel context
String camelId = (String) mBeanServer.getAttribute(routeMBean, "CamelId");
if (camelId != null && camelId.equals(camelContext.getName())) {
String xml = (String) mBeanServer.invoke(routeMBean, "dumpRouteStatsAsXml", new Object[]{Boolean.FALSE, Boolean.TRUE}, new String[]{"boolean", "boolean"});
RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new StringReader(xml));
long count = route.getExchangesCompleted() + route.getExchangesFailed();
System.out.println(String.format(OUTPUT_FORMAT, route.getId(), count, route.getLastProcessingTime(), route.getDeltaProcessingTime(),
route.getMeanProcessingTime(), route.getMinProcessingTime(), route.getMaxProcessingTime(), route.getTotalProcessingTime(), route.getSelfProcessingTime()));
for (ProcessorStatDump ps : route.getProcessorStats()) {
// the self time is the total time of the processor itself
long selfTime = ps.getTotalProcessingTime();
count = ps.getExchangesCompleted() + ps.getExchangesFailed();
// indent route id with 2 spaces
System.out.println(String.format(OUTPUT_FORMAT, " " + ps.getId(), count, ps.getLastProcessingTime(), ps.getDeltaProcessingTime(),