org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory Java Examples
The following examples show how to use
org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyncopeCamelContext.java From syncope with Apache License 2.0 | 6 votes |
public SpringCamelContext 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(CamelRoute::getContent).collect(Collectors.toList())); } } return camelContext; }
Example #2
Source File: MetricsRouteBuilder.java From camelinaction2 with Apache License 2.0 | 5 votes |
@Override public void configure() throws Exception { // add dropwizard metrics to all our routes getContext().addRoutePolicyFactory(new MetricsRoutePolicyFactory()); from("timer:foo").id("foo") .delay(simple("${random(0,1000)}")) .log("Foo is done"); from("timer:bar").id("bar") .delay(simple("${random(0,5000)}")) .log("Bar is done"); }