use of org.apache.camel.spring.boot.CamelContextConfiguration 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.spring.boot.CamelContextConfiguration in project syndesis by syndesisio.
the class IntegrationRuntimeAutoConfiguration method integrationContextRuntimeConfiguration.
@Bean
public CamelContextConfiguration integrationContextRuntimeConfiguration(Optional<IntegrationLoggingListener> loggingListener) {
return new CamelContextConfiguration() {
@Override
public void beforeApplicationStart(CamelContext camelContext) {
final String location = configuration.getConfigurationLocation();
final List<IntegrationStepHandler> handlers = new ArrayList<>();
// register handlers discovered from application context
handlers.addAll(integrationStepHandlers);
// register handlers discovered using service loader
for (IntegrationStepHandler handler : ServiceLoader.load(IntegrationStepHandler.class, Thread.currentThread().getContextClassLoader())) {
handlers.add(handler);
}
// IntegrationRouteBuilder automatically add known handlers to
// the list of provided ones, know handlers have priority
final RouteBuilder routeBuilder = new IntegrationRouteBuilder(location, handlers, loggingListener.isPresent());
try {
// Register routes to the camel context
camelContext.addRoutes(routeBuilder);
} catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception e) {
throw new IllegalArgumentException(e);
}
}
@Override
public void afterApplicationStart(CamelContext camelContext) {
// noop
}
};
}
Aggregations