My boss told me to add ERMA to my app, how do I do that?
It pretty simple, you'll need to do exactly three things:
- Add orbitz-lib-monitoring and possibly orbitz-api-monitoring to your application
- Configure the MonitorProcessor you're using
- Make sure the MonitoringEngine is started and shutdown correctly
How do I add orbitz-lib-monitoring to my app?
Add the orbitz-lib-monitoring and orbitz-api-monitoring libraries to your classpath. If you use a dependency manager like Savant or Ivy, you should only need to add orbitz-api-monitoring to your dependencies for shared libraries. Only runnable applications need the dependency on orbitz-lib-monitoring.
How do I "configure" the MonitorProcessor?
First you'll need to ensure that the MonitorProcessorFactory instance is set on the MonitoringEngine. Most people will set this reference right next to the code that starts up the engine.
Once you've set the instance of the factory you'll be using, you should check the documentation for that factory. Most people will be using the SimpleMonitorProcessorFactory because it's written already. You'll need to wire together that implementation yourself. Check out Configuring ERMA using Spring for steps on configuring ERMA.
Ok almost there, how do I do the startup and shutdown work?
This is the easiest step there is. All you need to do is make sure that MonitoringEngine.getInstance().startup() is called somewhere near the start of your application. Also, you should make sure that MonitoringEngine.getInstance().shutdown() is called somewhere before your app shuts down. It's that easy.
Isn't there an easier way?
Well, I suppose you could just skip steps 2 and 3 by using Spring to instantiate and call the lifecycle methods found on the MonitoringEngineManager. That class is found in orbitz-lib-monitoring.
Since you're looking for easy street, here's a usable spring bean declaration line, you slacker. :)
<bean id="ERMAInitializer" class="com.orbitz.monitoring.lib.MonitoringEngineManager" singleton="true" init-method="startup" destroy-method="shutdown"/>