JavaScript response filter - DB2

The JavaScript request filter is the most flexible of all response filters. It can potentially be called for any packet type, and can modify traffic in any way it sees fit.

Parameters

Example

You can easily add up the execution time for a connection with a JavaScript response filter for MONITORRD packets, and the code:

if ( ! context.connectionContext.executionTime) {

    context.connectionContext.executionTime = context.packet.ETIME;

}

else {

    context.connectionContext.executionTime += context.packet.ETIME;

}

If you then wanted to show the total execution time when the connection is closed, you could do so in a Connection close filter with the code:

log.info("Connection is closing for: " + context.connectionContext.userName +

    ", execution time: " + context.connectionContext.executionTime);