External configuration for SelfDiagnose

Initialization of the SelfDiagnose component is done by reading the resource selfdiagnose.xml which must be located on the classpath of the Web application. This configuration declares the diagnostic tasks that are executed in the context of the Web application. The upcoming release (1.1) will have a new feature that allows you to override the local configuration and dynamically load the configuration from a provided URL:

http://your-app/selfdiagnose?config=http://some-other-server/selfdiagnose.xml

or even a local file can be passed:

http://your-app/selfdiagnose?config=file:///some-other-path/selfdiagnose.xml

You can restore to the application-defined tasks by:

http://your-app/selfdiagnose?reload=true

This feature allows for the following scenario in developing the configuration:

Create a local empty configuration (in e.g. /src/main/resources) such that the SelfDiagnose component is initialized upon starting the application. Now, create a copy of that configuration and store it on some local path. Next, open your favorite editor (TextMate will do just fine :-) ) and start declaring diagnostic tasks. For each task entered, you ask SelfDiagnose to load the local configuration and run all its tasks. Immediately, you can verify whether the tasks are properly configured and you can see the results. Repeat this until you have check all relevant (=environment dependent) resources. Finally, you replace the empty configuration with your local, completed one.

With the “external configuration” feature you can request any active SelfDiagnose component to run tasks defined elsewhere. Although the standard diagnostic tasks will only inspect the state of your running application, make sure that any custom task will do the same.

comments powered by Disqus