camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Strange behaviour with spring + camel
Date Wed, 21 May 2014 08:29:49 GMT

This is not strange, see

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
<> 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.
Twitter: davsclaus
Author of Camel in Action:

View raw message