I am working on to application which subscribe data and create RIC if it does not exists. What would be the best way to check if RIC .does not exists as RefreshMessage / OnAllMsg does not provide NACKCode for InvalidContent.
I am working on to application which subscribe data and create RIC if it does not exists. What would be the best way to check if RIC .does not exists as RefreshMessage / OnAllMsg does not provide NACKCode for InvalidContent.
You need to cast it to the StatusMsg.
public void onAllMsg(Msg msg, OmmConsumerEvent consumerEvent){ ... if(msg.dataType() == DataTypes.STATUS_MSG) { StatusMsg statusMsg = (StatusMsg)msg; if(statusMsg.hasState()) System.out.println(statusMsg.state().statusText()); } }
You may need to check both stream state, data state, and data state code. The stream can be closed due to permission. The stream closed is OmmState.StreamState.CLOSED.
Sorry about the issue that you are facing.
If you subscribe to a RIC that is not available in ATS, you will get the status message with the CLOSED stream state and status text "RIC Not Found", as shown below.
<statusMsg domainType="RSSL_DMT_MARKET_PRICE" streamId="5" containerType="RSSL_DT_NO_DATA" flags="0x28 (RSSL_STMF_HAS_MSG_KEY|SSL_STMF_HAS_STATE)" dataState="RSSL_DATA_SUSPECT" streamState="RSSL_STREAM_CLOSED" code="RSSL_SC_NONE" text="RIC Not Found" ataSize="0"> <key flags="0x7 (RSSL_MKF_HAS_SERVICE_ID|RSSL_MKF_HAS_NAME|RSSL_MKF_HAS_NAME_TYPE)" serviceId="267" name="IBM.N" nameTyp="1"/> <dataBody> </dataBody> </statusMsg>
You can check the stream state. If the stream state is closed, it means you will not retrieve data from a subscribed RIC.
I hope that this information is of help
Thanks for the Info. OnAllMsg ( Msg, OmmConsumerEvent) : Msg only have one function msg.streamID(). There is no other function exposed as code, text etc. Please advise if its sufficient to compare msg.streamId() with OmmState.StreamState.CLOSED_REDIRECTED to make sure that resulted response is due to missing RIC.