Log replay feature provides the ability to save time and money when to pay for connection to the Production Environment and this takes a lot of money. Instead this the Handler can record all events occurring on the Exchange and in the future be able to play them repeatedly. All you need to do is to save log files.
Before using a Handler to play the log files, it is necessary to prepare the appropriate settings. The instance of OnixS::ICE::iMpact::MarketData::HandlerSettings
created and OnixS::ICE::iMpact::MarketData::HandlerSettings::logs
should be filled by passing only path(s) to log file(s). The Handler constructor OnixS::ICE::iMpact::MarketData::Handler::Handler
takes this settings and handler reads all Base64-based data from the log file and processes these data as data received from the network.
During log replay, the Handler may cause errors. If this happens Handler calls the special callback OnixS::ICE::iMpact::MarketData::ErrorListener::onError
. When replay log is finished the Handler calls the OnixS::ICE::iMpact::MarketData::LogReplayListener::onReplayFinished
.
OnixS::ICE::iMpact::MarketData::LogReplayListener::onReplayFinished
event doesn't trigger the Handler to switch to the OnixS::ICE::iMpact::MarketData::HandlerStates::Stopped
state. If a user wants this transition it is required to call the OnixS::ICE::iMpact::MarketData::Handler::stop()
method explicitly.For replayed packets, the Handler uses the same timestamps as available in the log file. It's actual for both TCP and UDP data. The timestamp is available in OnixS::ICE::iMpact::MarketData::MessageInfo::receiveTime
and in OnixS::ICE::iMpact::MarketData::Packet::time
if the user uses OnixS::ICE::iMpact::MarketData::PacketProcessingListener
.
The Handler can generate more than one log file. This depends on the Handler's settings but if you want to record the whole trading day and then replay this data you will need to deal with multiple log files.
In order to replay the data from the multiple log files you need to add all the log files to OnixS::ICE::iMpact::MarketData::HandlerSettings::logs
in order they have been created. You should keep this order as there is no logic to sort the log records and the Handler will just read all the data sequentially.