use of org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory in project camel by apache.
the class Application method contextConfiguration.
@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext context) {
LOG.info("Configuring Camel metrics on all routes");
MetricsRoutePolicyFactory fac = new MetricsRoutePolicyFactory();
fac.setMetricsRegistry(metricRegistry);
context.addRoutePolicyFactory(fac);
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
// noop
}
};
}
use of org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory in project syncope by apache.
the class SyncopeCamelContext method getCamelContext.
public CamelContext getCamelContext() {
synchronized (this) {
if (camelContext == null) {
camelContext = ApplicationContextProvider.getBeanFactory().getBean(SpringCamelContext.class);
camelContext.addRoutePolicyFactory(new MetricsRoutePolicyFactory());
}
if (camelContext.getRoutes().isEmpty()) {
List<CamelRoute> routes = routeDAO.findAll();
LOG.debug("{} route(s) are going to be loaded ", routes.size());
loadRouteDefinitions(routes.stream().map(input -> input.getContent()).collect(Collectors.toList()));
}
}
return camelContext;
}
Aggregations