protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy(); camelContext.addComponent("async", new MyAsyncComponent()); shutdownStrategy.setTimeout(1000); shutdownStrategy.setTimeUnit(TimeUnit.MILLISECONDS); shutdownStrategy.setShutdownNowOnTimeout(true); ManagementStrategy managementStrategy = new DefaultManagementStrategy(); managementStrategy.addEventNotifier(en); camelContext.setManagementStrategy(managementStrategy); return camelContext; }
/** * Auxiliary method to configure the shutdown strategy associated with the CamelContext. As result * it will not wait longer than 1 second for any in-flight messages to complete execution. * * @param camelContext * The Camel context associated with the shutdown strategy. */ private void updateShutdownStrategy(CamelContext camelContext) { LOGGER.debug("Updating shutdown strategy for camel context: {}", camelContext.getName()); ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy(); shutdownStrategy.setTimeUnit(TimeUnit.SECONDS); shutdownStrategy.setTimeout(1L); shutdownStrategy.setShutdownNowOnTimeout(true); shutdownStrategy.setSuppressLoggingOnTimeout(true); }
protected CamelContext createCamelContext() throws Exception { CamelContext camelContext = super.createCamelContext(); ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy(); camelContext.addComponent("async", new MyAsyncComponent()); shutdownStrategy.setTimeout(1000); shutdownStrategy.setTimeUnit(TimeUnit.MILLISECONDS); shutdownStrategy.setShutdownNowOnTimeout(true); return camelContext; }
public ShutdownStrategy getShutdownStrategy() { return shutdownStrategy; }
public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) { this.shutdownStrategy = shutdownStrategy; }
@Override public ShutdownStrategy getShutdownStrategy() { return context.getShutdownStrategy(); }
@Override public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) { context.setShutdownStrategy(shutdownStrategy); }
/** * Gets the current shutdown strategy * * @return the strategy */ ShutdownStrategy getShutdownStrategy();
/** * Sets a custom shutdown strategy * * @param shutdownStrategy the custom strategy */ void setShutdownStrategy(ShutdownStrategy shutdownStrategy);