public void addStartupListener(StartupListener listener) throws Exception { // either add to listener so we can invoke then later when CamelContext has been started // or invoke the callback right now if (isStarted()) { listener.onCamelContextStarted(this, true); } else { startupListeners.add(listener); } }
private void startService(Service service) throws Exception { // and register startup aware so they can be notified when // camel context has been started if (service instanceof StartupListener) { StartupListener listener = (StartupListener) service; addStartupListener(listener); } if (service instanceof CamelContextAware) { CamelContextAware aware = (CamelContextAware) service; aware.setCamelContext(this); } service.start(); }
@Override public void addStartupListener(StartupListener listener) throws Exception { context.addStartupListener(listener); }