FIX Antenna Java provides API, which helps to detect problems with consumer communication. Sometimes it may be useful to apply different strategies in application to handle consumer with slow communication abilities.
To enable this functionality you have to set few options for FIX session:
Also, it needs to register a handler of FIXSessionSlowConsumerListener type for processing notification about detected sending problems. FIXSessionSlowConsumerListener interface has a single method with 3 parameters: reason, expectedValue, currentValue.
FIX Antenna notifies about two suspicious cases during messages sending:
- TRANSPORT_WRITE_DELAY - message sending (writing to outgoing transport) time exceed SLOW_CONSUMER_WRITE_DELAY_THRESHOLD timeout. In this case expectedValue contains SLOW_CONSUMER_WRITE_DELAY_THRESHOLD timeout and currentValue shows the real message sending time. Of course, currentValue > expectedValue.
- TRANSPORT_WRITE_NOT_COMPLETE - FIX Antenna wasn't able to write a whole message at one time. It means that consumer reads slowly or it still not processed the previous message and TCP buffer is full. In this case expectedValue contains the current message size and currentValue - the size, which transport was able to push (expectedValue > currentValue).