Basically, the completion event itself does not provide the reason of how the data stream is closed. The reason/information can be found in the status message that comes before the completion event so the application should look for the detail of the stream closure in the status message rather than in the completion event. Here are the examples of status messages when the stream is closed.
Invaid RIC Item: MESSAGE Msg Type: MsgType.STATUS_RESP Msg Model Type: MARKET_PRICE Indication Flags: Hint Flags: HAS_ATTRIB_INFO | HAS_STATE State: CLOSED, SUSPECT, NOT_FOUND, "The record could not be found" AttribInfo ServiceName: hEED ServiceId: 2114 Name: TEST.BK NameType: 1 (RIC) Payload: None No Permission: MESSAGE Msg Type: MsgType.STATUS_RESP Msg Model Type: MARKET_PRICE Indication Flags: Hint Flags: HAS_ATTRIB_INFO | HAS_STATE State: CLOSED, SUSPECT, NOT_ENTITLED, "Access Denied: User req to IDN for Specialist - SDPREREINTO" AttribInfo ServiceName: hEED ServiceId: 2114 Name: BRL10MNDF= NameType: 1 (RIC) Payload: None
If one ignores the explicit completion events in RFA/RSSL you can simply use msg.isFinal() under processEvent() to gain stateful awareness of the event. For RFA/SSL you can use event.isEventStreamClosed() instead.
Thanks Steve. We're trying to figure out how to determine if the completion event was a result of an entitlements issue versus some other issue. Are the other categories of reasons which can result in a completion event?
As in (a) data does not exist { retired or not yet launched }, (b) infrastructure failure, (c) DACS permissions, (d) API failure?
Would those be the complete list? What about time of request? We have seen cases in which we subscribed to a RIC 8 hours before the market opens and get a Completion_Event, but later on closer to the market open, we subscribe successfully.
We are getting thousands of these events every day and we are not sure why. Thank you.
[Edited] The completion event will be sent as final event from an event stream. It indicates that the event's stream has been closed, when the application call unregisterClient() to close the event stream. It should be an issue stated by Jirapongse below.
There are two ways in which an event stream can be closed:
An application should call isEventStreamClosed() function on incoming messages to determine whether an event stream is closed. Note that if an application registers for completion events and closes the event stream via an unregisterClient() call to RFA, the application must be prepared to receive either a completion event or some other event that closes the stream. If the application receives an event closing the stream other than a completion event, the application will not receive the completion event.
Normally, the application uses the completion events when it relinquishes the requests from different threads than the dispatching thread. After unregistering the handle, the application must wait for the completion event or verify isEventStreamClosed() before deleting an instance of an Event Handler.
I would like to suggest upgrading the application to use the latest version of RFA C++ (7.6 or 8.0) because there are a lot of issues fixed regarding the completion event.