Hi This is not strange, see http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
eg you need to keep the jvm running as creating a spring app context is not a blocking call when you call its start method etc. On Wed, May 21, 2014 at 10:24 AM, Josh Forman-Gornall <[email protected]> wrote: > Hi all, > > I am seeing some strange behaviour with a very basic spring/camel > application... can anyone help me understand this?: > > I have defined a spring bean for camelContext with one route (with > autoStartup="true") and when the bean is created, a thread will be created > which listens for incoming messages... > > In my static void main method, I am simply initialising the application > context: > new ClassPathXmlApplicationContext("application-context.xml"); > > If I do this, the camelContext initialises successfully but then the > application terminates immediately. However, if I add a Thread.sleep(2000) > after initialising the application-context, then the application never > terminates (because there is a thread listening for incoming messages).... > this is what I expected to happen - but why do I need to have a > Thread.sleep ? > > Thanks for any help, > Josh -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
