OK, I did just that. CAMEL-9872. :) /Jimi
________________________________________ From: Claus Ibsen <claus.ib...@gmail.com> Sent: Sunday, April 17, 2016 9:01 PM To: users@camel.apache.org Subject: Re: Trigger sanity check on startup, camel style? Hi Yeah you hit minor corner case, because the main class do not detect the veto. You are welcome to log a JIRA. On Sun, Apr 17, 2016 at 8:51 PM, <jimi.hulleg...@svensktnaringsliv.se> wrote: > Thanks Claus, > > However, I can't get it to work properly. The VetoCamelContextStartException > I throw has rethrowException=false, since I don't want a stacktrace printed. > But that seems to cause Camel to get stuck during "shutdown". It prints the > message about the veto, but then nothing happens, and the process doesn't > terminate. > > When debugging this in Eclipse it seems to get stuck in the method > waitUntilCompleted() in org.apache.camel.main.MainSupport. > > When using rethrowException=true all works fine, but as I said, I don't want > to use this because I don't want the stacktrace, only the message. > > Is this a known bug? > > /Jimi > ________________________________________ > From: Claus Ibsen <claus.ib...@gmail.com> > Sent: Sunday, April 17, 2016 11:30 AM > To: users@camel.apache.org > Subject: Re: Trigger sanity check on startup, camel style? > > You can implement an LifecycleStrategy, and then impl the callbacks > for onContextStart and there you can do your check and fail with the > VetoCamelContextStartException that gets logged as a WARN and stop > Camel from starting. > > > On Sun, Apr 17, 2016 at 11:18 AM, <jimi.hulleg...@svensktnaringsliv.se> > wrote: >> Hi, >> >> >> >> Is there a built in way in Camel to trigger some kind of sanity check on >> startup? For example, I would like to have Camel check that certain >> directories and configuration files exist on startup. So that, if they don't >> exist, Camel prints a user friendly error message and shuts down. So I want >> to fail fast, rather than failing later, when one of the routes is triggered. >> >> >> >> I use Camel with Spring XML, and start Camel with >> org.apache.camel.spring.Main, and I would prefer keeping the setup like >> that. So I am looking for some standard built in way to configure Camel to >> do this, using just Spring XML. So, just as I can configure a route using >> the <route> tag inside <camelContext>, I would like to be able to configure >> something like <sanityCheck> or <onStartup> or similar. Using existing >> components, preferably (since checking if a file or directory exist is >> fairly common use case I don't really see the need for every project/company >> having to write their own code for this). >> >> >> >> Regards >> /Jimi > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2