Older Reuters interfaces were quite simple. Reuters SSL (Source Sink Library) is relatively easy to program. Simple enough to integrate into any application in a matter of days.
Reuters library operates on a concept of callbacks. Application should create one thread per Reuters channel or multiplex callbacks from various channels in the same thread. Those are architectural and design questions.
Here is an example of how a RIC (Reuters Instrument Code) query can be implemented quickly and efficiently.
To initialize SSL library, one needs to know their triarch user and service names.
string user = "user ID";
string serviceName = "service name";
// Initialize the library
int rc = sslInit(SSL_VERSION_NO);
if (rc < 0) return 1;
Next step is to open Reuters channel or socket connection (I think it is a socket under the hood).
// Open the Reuters channel
int channel = sslSnkMount((char *) user.c_str(), 0))
if (channel < 0) return 2;
You can use the channel variable to pass it on to all other library APIs. You can mount an array of channels for use, as required by your application. For example a quote server would probably need a dynamic list of channels that can be resized based on load. Once you have a channel, you can register a callback for that channel (or any other channel)
// Register a main callback
if (sslRegisterClassCallBack(channel, SSL_EC_DEFAULT_HANDLER, stHandler, (void*) NULL) < 0) return 3;
You can use the same callback for all channels or use a list of callbacks, one for each channel. It is up to you. It does not matter how you structure your code.
Next step is to setup monitoring for a RIC (Reuters Instrument Code). This can be done by issuing open on a RIC code and a given Reuters service name.
// At this point the channel is setup and ready for callbacks...
// To start monitorning quotes for MSFT issue...
if (sslSnkOpen(channel, (char *) serviceName.c_str(), "MSFT.O", 0, 0) < 0) return 4;
Now, your library should be firing events for MSFT. News or quotes, depending on the service name you have provided. One thing I should mention is that the static handler above can be setup for one channel or many channels.
Here is an example of a simple callback. The callback can detect the type of event that is fired and re-route the call to a specific function callback.
static SSL_EVENT_RETCODE _stHandler(int channel, SSL_EVENT_TYPE event, SSL_EVENT_INFO* pEventInfo, void* pClientData);
// Individual callbacks, based on the event received
void marketData(int Channel, SSL_EVENT_TYPE Event, SSL_EVENT_INFO *EventInfo);
void status(int Channel, SSL_EVENT_TYPE Event, SSL_EVENT_INFO *EventInfo);
void disconnect(int Channel, SSL_EVENT_TYPE Event, SSL_EVENT_INFO *EventInfo);
void serviceInfo(int Channel, SSL_EVENT_TYPE Event, SSL_EVENT_INFO *EventInfo);
SSL_EVENT_RETCODE _stHandler(int channel, SSL_EVENT_TYPE event, SSL_EVENT_INFO* pEventInfo, void* pClientData)
if ( (event == SSL_ET_ITEM_IMAGE || event == SSL_ET_ITEM_UPDATE) &&
(pEventInfo->ItemImage.ItemType.DataFormat == SSL_DF_MARKETFEED_RECORD))
marketData(channel, event, pEventInfo);
else if(event == SSL_ET_ITEM_STATUS_OK ||
event == SSL_ET_ITEM_STATUS_CLOSED ||
event == SSL_ET_ITEM_STATUS_STALE ||
event == SSL_ET_ITEM_STATUS_INFO)
itemStatus(channel, event, pEventInfo);
else if(event == SSL_ET_SESSION_DISCONNECTED)
disconnect(channel, event, pEventInfo);
else if(event == SSL_ET_SESSION_RECONNECTED)
reconnect(channel, event, pEventInfo);
else if(event == SSL_ET_SERVICE_INFO)
serviceInfo(channel, event, pEventInfo);
The above example can be integrated into a more complex design that would take into account various Reuters services, performance and/or expose the library interface as an asynchronous web service.
Here is Reuters SSL header file with all the prototypes of the above APIs: ssl.h