In version 1.4 it definitely does block. I started off with a while loop but then implemented MainSupport and took the example from the Spring Example project but stripped out all Spring specific stuff. Works nicely.
I might put something on the wiki to make it a little bit more obvious. Thanks Claus Ibsen-2 wrote: > > On Thu, Feb 25, 2010 at 4:03 PM, jpcook <[email protected]> > wrote: >> >> Hi, >> >> I noticed that calling start() on camel context doesn't block the thread >> anymore which it used to do in earlier versions of camel. I think this is >> the correct behavior of Camel 2.0. >> > > To my knowledge invoking start() have newer blocked. It should not block. > Its your choice to run Camel standalone and you must keep your app > running how you like it. > > Most people run Camel in some existing container which have start / > stop scripts already. > >> But I wondered if there was a simple example of starting the context and >> stopping it exiting straight away without using Spring? >> >> I've been looking at the MainSupport class from org.apache.camel.util as >> a >> starting point to have blocked until you hit ctrl + c or call stop() on >> CamelContext but the only example I can see has lots of Spring stuff in >> it? >> > > We could maybe improve the MainSupport in camel-core to make it easier > to use for use cases like yours. > You can extend it and implement the needed methods. > > Or frankly you can do a while(true) loop and have a shutdown hook > registered which will stop Camel. > This is done in those MainSupport classes. > > >> Thanks >> -- >> View this message in context: >> http://old.nabble.com/Starting-camel-context-not-blocking-tp27714451p27714451.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://old.nabble.com/Starting-camel-context-not-blocking-tp27714451p27716969.html Sent from the Camel - Users mailing list archive at Nabble.com.
