Field length different between image data and update data

Hi folks,


I am using rfa8.1.0 C++ for encoding a field of RMTES_STRING with length of 255.

The length of this field with RespMsg::RefreshEnum (image data) is corresponding to 256 while with RespMsg::UpdateEnum this field can be sent with a length much more longer (1500).

Is there any explanation for this behavior ?


Thanks,

Best Answer

  • @iamtho

    I couldn't find the setFromString method in the Buffer class.

    Buffer bf;
    bf.setFrom((unsigned char*)"TEST String", 11);

    Anyway, you may enable tracing in the API to verify the outgoing messages.

    \Connections\<ConnectionName>\traceMsgToFile = true
    \Connections\<ConnectionName>\traceMsgDomains = "all"
    \Connections\<ConnectionName>\traceMsgMaxMsgSize = 5000000
    \Connections\<ConnectionName>\traceMsgMultipleFiles = true
    \Connections\<ConnectionName>\tracePing = true

    Please change <ConnectionName> to the name of your connection. The RSSL tracing log would be created with the connection name, a process ID, and a ".xml" extension, such as <ConnectionName>_7648.xml in the same directory of the application.

    If you find a string that is longer than 255 bytes in the trace file, it could be a problem in the application or RFA.

Answers

  • @tho.nguyen-khac-ext

    Thanks for reaching out to us.

    How did you encode the data?

    I modified the StarterProvider_Interactive example in the RFA C++ package to encode the SEG_TEXT field.

    void Encoder::encodeMarketPriceFieldList(FieldList* pFieldList, bool bRefresh)
    {
        assert(pFieldList);
        FieldListWriteIterator fieldListWIt;


       ...

        field.clear();
        Buffer bf;
        bf.setFrom((unsigned char*)"TEST String", 11);
        field.setFieldID(258);//SEG_TEXT
        dataBuffer.setBuffer(bf, DataBuffer::StringAsciiEnum);
        field.setData(dataBuffer);
    fieldListWIt.bind(field);



        fieldListWIt.complete();
    }

    The following is the data retrieved by a consumer.

    <updateMsg domainType="RSSL_DMT_MARKET_PRICE" streamId="4" containerType="RSSL_DT_FIELD_LIST" flags="0x0" updateType="0 (RDM_UPD_EVENT_TYPE_UNSPECIFIED)" dataSize="26">
        <dataBody>
            <fieldList flags="0x8 (RSSL_FLF_HAS_STANDARD_DATA)">
                <fieldEntry fieldId="2" data="64"/>
                <fieldEntry fieldId="6" data="0C7A"/>
                <fieldEntry fieldId="258" data="5445 5354 2053 7472 696E 67"/>
            </fieldList>
        </dataBody>
    </updateMsg>


    <!-- End Message (Channel IPC descriptor = 528) -->
    UpdateMsg
        streamId="5"
        domain="MarketPrice Domain"
        updateTypeNum="0"
        name="IBM.N"
        serviceId="1"
        serviceName="DIRECT_FEED"
        Payload dataType="FieldList"
            FieldList
                FieldEntry fid="2" name="RDNDISPLAY" dataType="UInt" value="100"
                FieldEntry fid="6" name="TRDPRC_1" dataType="Real" value="1.22"
                FieldEntry fid="258" name="SEG_TEXT" dataType="Rmtes" value="TEST String"
            FieldListEnd


        PayloadEnd
    UpdateMsgEnd

    I hope that this information is of help

  • Hi Jirapongse,
    Thank you for your help.
    My code based on the example below in RFA C++ package

    void StarterProvider_NonInteractive::submitMsg()
    {
    /*
    */
    RespStatus status;
    if(!pTS->bSubmitted)
    {
    status.setStreamState(RespStatus::OpenEnum);
    status.setDataState(RespStatus::OkEnum);
    status.setStatusCode(RespStatus::NoneEnum);
    status.setStatusText(RFA_String("UnSolicited Refresh Completed", 0, false));
    setMarketPriceMsg(RespMsg::RefreshEnum, pTS->attribInfo, status, pCSH, true);
    /*
    */
    }
    else
    {
    setMarketPriceMsg(RespMsg::UpdateEnum, pTS->attribInfo, status, pCSH, pTS->bAttribInfoInUpdates)
    /*
    */
    }
    }


    void StarterProvider_NonInteractive::setMarketPriceMsg(RespMsg::RespType respType, /**/)
    {
    /**/
    bf.setFromString("veryLongString");
    field.setFieldID(4281);//NEWSCODE05 with length : 255
    dataBuffer.setBuffer(bf, DataBuffer::StringRMTESEnum);
    field.setData(dataBuffer);
    fieldListWIt.bind(field);
    /*/
    }


    The point is when calling

    setMarketPriceMsg(RespMsg::RefreshEnum, ...);

    the data retrieved by a consumer is stripped to 255 charracters but

    setMarketPriceMsg(RespMsg::UpdateEnum, ...);

    the data retrived is totally fine (all the content is received with more than 1500 characters)

    I can not explain this behavior.

  • Hi Jirapongse,

    Thanks for your help.

    Yes, I think that could be a problem in the RFA.

    A string with more than 255 characters cannot be encoded/sent/decoded.

    I should use a vector.