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,  <[email protected]> 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

Reply via email to