camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Vinogradov <alexey.vinogra...@db.com>
Subject Re: camelContext autoStartup=false does not prevent Camel from starting when Spring context starts
Date Wed, 25 May 2011 12:51:45 GMT
I propose the following patch for org.apache.camel.spring.SpringCamelContext

    public void afterPropertiesSet() throws Exception {
    	if(!isAutoStartup()){
    		maybeStart();
	}
    }

and the second fix

    public void onApplicationEvent(ApplicationEvent event) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("onApplicationEvent: " + event);
        }

        if (event instanceof ContextRefreshedEvent && !isAutoStartup() ||
event instanceof ContextStartedEvent) {
            // now lets start the CamelContext so that all its possible
            // dependencies are initialized
            try {
                maybeStart();
            } catch (Exception e) {
                throw wrapRuntimeCamelException(e);
            }
        } else if (event instanceof ContextStoppedEvent) {
            try {
                maybeStop();
            } catch (Exception e) {
                throw wrapRuntimeCamelException(e);
            }
        }

        if (eventEndpoint != null) {
            eventEndpoint.onApplicationEvent(event);
        } else {
            LOG.info("No spring-event endpoint enabled to handle event: " +
event);
        }
    }



--
View this message in context: http://camel.465427.n5.nabble.com/camelContext-autoStartup-false-does-not-prevent-Camel-from-starting-when-Spring-context-starts-tp4421992p4425168.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message