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.
[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.