OnixS C++ CME Market Data Handler  2.56.0.0
Listening to Warnings

Warnings Concept

Miscellaneous non-critical issues may occur while Handler is being executed. Handler will handle such issues by itself, thus no special handling is required for such cases. However, sometimes it's reasonable to be notified about such events. For this reason, handler exposes OnixS::CME::MarketData::WarningListener class and will invoke its OnixS::CME::MarketData::WarningListener::onWarning member each time a non-critical issue will take place.

An instance of OnixS::CME::MarketData::Warning class is delivered through a noted callback. This instance exposes source (OnixS::CME::MarketData::Warning::source), code (OnixS::CME::MarketData::Warning::code) and human-readable description ( OnixS::CME::MarketData::Warning::description) of an issue. In most cases \ b description is the most meaningful information about an issue. Code provides ability to differ some known issues. Finally, same issues may have different meaning, therefore source member is available.

Example

Following example depicts how to subscribe to warnings as well as how similar warnings may have different meaning:

class BooksOutOfDateDetector : public WarningListener
{
public:
BooksOutOfDateDetector(Handler& handler)
{
handler.registerWarningListener(this);
}
~BooksOutOfDateDetector()
{
}
void onWarning(const Warning& warning, const ChannelId& channelId)
{
if (KnownWarnings::NoNetworkActivity == warning.code())
{
if (warning.source() == "IncrementalFeedGroup")
{
cout
<< "WARNING! No data available on incremental channel. "
<< "Books are getting outdated!!!"
<< endl;
}
else if (
warning.source() == "IncrementalFeedA" ||
warning.source() == "IncrementalFeedB")
{
cout
<< "No data on one of incremental feeds. "
<< "However, books are still up-to-date because "
<< "data availability on at least one feed."
<< endl;
}
}
}
};
...
Handler handler(handlerSettings);
BooksOutOfDateDetector detector(handler);
...