Java 类org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory 实例源码

项目:Camel    文件:Application.java   
@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
        }
    };
}
项目:camelinaction2    文件:MetricsRouteBuilder.java   
@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");
}
项目:kupra    文件:KupraConfiguration.java   
@Bean
public MetricsRoutePolicyFactory getMetricsRoutePolicyFactory(){
    return new MetricsRoutePolicyFactory();
}