Cisco Cisco Customer Voice Portal 8.0(1) Developer's Guide

Page of 98
C
HAPTER 
13:
 
L
OGGERS
 
 
V
OICE
XML
 
P
ROGRAMMING 
G
UIDE 
 
 
 
FOR 
C
ISCO 
U
NIFIED 
C
USTOMER 
V
OICE 
P
ORTAL 
R
ELEASE 
4.0(1) 
 
 
 
 
68
 
would be handled in the same order they occurred within the call. To remedy this situation while 
keeping the design unfettered, it is possible to specify that Unified CVP VoiceXML Server pass 
a logger instance events in the same order they occurred in a call. With this option on, the logger 
developer can be assured that the events for a call would not be handled out of order. In fact, the 
Activity Logger included with the VoiceXML Server has this requirement. The penalty for this 
requirement, however, is a loss of some of the true asynchronous nature of the system as there 
will now be situations where events that are ready to be handled must wait for a previous event 
to be handled by the logger. If a logger hung while handling one event, the queue would forever 
contain the events that occurred after it in the call, and that call session would not be fully 
logged. 
Some of the conclusions that can be deduced from the Unified CVP VoiceXML Server logging 
design can be summarized in some best practices: 
    A logger developer need not worry about the time taken by the logger to handle an event as it 
will have no bearing on the performance of the call. With that said, the developer must also 
be aware of the expected call volume and ensure that the logger not take so long as to use up 
the event threads faster than they can be handled. 
    Loggers work under a multi-threaded environment and the logger developer must understand 
how to code with this in mind. A single logger class can be handling events for many calls 
and so it must manage internal and external resources in a synchronized manner to prevent 
non-deterministic behavior. 
    When possible, design the logger so that it does not rely on events within a call being passed 
to it in the order in which they occurred in the call. Doing so will maximize performance due 
to being able to handle events whenever they occur. Should the logger be unable to do so, 
require that the enforce call event order option be turned on for the logger. 
Logger Design 
Similar to configurable elements, a logger is constructed by creating a Java class that extends an 
abstract base class, 
ApplicationLoggerBase
. The base class defines abstract methods that must 
be implemented by the logger. A logger must implement a Java marker interface named 
LoggerPlugin
 to allow Unified CVP VoiceXML Studio to recognize it as a valid logger. 
Loggers have methods for initialization and destruction as well as an execution method to call 
when an event is to be handled. These methods may throw an 
EventException
 to indicate an 
error in the logger.  
All Java classes related to loggers are found in the 
com.audium.server.logger
 package while 
the logger event classes are found in the 
com.audium.server.logger.events
 package. 
Logger Methods 
void initialize(File configFile, LoggerApplicationAPI api)