question

Upvotes
Accepted
7 1 0 7

NACK Code If trying to subscribe RIC that are not exists.

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.

#technologyema-apiATS
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
79.7k 257 52 74

@vikas.chaudhary

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.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
79.7k 257 52 74

@vikas.chaudhary

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
7 1 0 7

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
7 1 0 7

Thanks for response. Appreciate it.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.