camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Forman-Gornall <joshfg...@gmail.com>
Subject Strange behaviour with spring + camel
Date Wed, 21 May 2014 08:24:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message