JavaScript request filter - Cassandra

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

Parameters


Example: tweak the Startup request

A Cassandra client sends a Startup packet to formally open a connection to a Cassandra server. This packet, among other things, usually contains the name of the driver and its version. It may be useful to modify this so that the server sees a different version than what the client really is.

To do so, you would create a JavaScript request filter with the parameter:

You would then add the following code to the filter. Note that you can change this filter's behavior based on the actual client's version, IP, etc...

context.packet.setEntry("DRIVER_NAME", "My driver");

context.packet.setEntry("DRIVER_VERSION", "1.0");