We are saving the handle returned by
when we subscribe to a RIC. When we are no longer interested, we call
with the saved handle.
It looks like EMA reuses handles and we are facing the following issue.
So it looks like the handle returned by registerClient becomes invalid at some point as it is no longer associated with the instrument we subscribed for. When does it happen? Is there a documentation for it? When should we not call unregister?
You are correct - only OpenEnum indicates the stream remains open - once the stream is closed, the handle will become invalid as the API has unregistered the handle.
OpenEnum Indicates the stream is opened and will incur interest after the final refresh. NonStreamingEnum Indicates the item will not incur interest after the final refresh - i.e stream is closed immediately after the refresh.
ClosedEnum Indicates the stream is closed.
ClosedRecoverEnum Indicates the stream is closed, typically unobtainable or identity indeterminable due to a comms outage. The item may be available in the future.
ClosedRedirectedEnum Indicates the stream is closed and has been renamed. The stream is available with another name. This stream state is only valid for refresh messages. The new item name is in the Name get accessor methods.
To expand on the Redirected : The current stream is closed and has new identifying information. The user can issue a new request for the data using the new message key data from the redirect message. This state can result from either a RefreshMsg or a StatusMsg e.g. if a RIC is renamed by the feed. You can read more about this in section 18.104.22.168 of the ETA Devguide
The register handle returned is typically used to either match up refreshes/updates to a specific item or to use it to explicitly close an open stream. The unregister call is only valid for open streams. When you register interest in an item and you receive a status code indicating the stream is closed, the handle associated with that particular item is no longer valid. As far as EMA is concerned, that handle is available for use/reuse. The closed handle should not be associated with that item anymore - it is open for reuse by EMA.