EMA C++ can not pass a OmmArray to OmmConsumerClient

he.wu
he.wu Newcomer

I create a class who inherited the OmmConsumerClient, and I pass a OmmArray to the construction function in order to decode the fids that I want

RefinitivClient::RefinitivClient(const OmmArray & fids)

: m_fids(fids)

{

}


void RefinitivClient::decode(const refinitiv::ema::access::FieldList & fl)

{

ElementList search;

search.addArray("test", m_fids.complete()).complete();

}

It will charge all of the fids

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @he.wu

    I have tested it with the Cons120 example in the RTSDK-2.0.1.L2.win.rrg package. The main function contains the following code.


    OmmArray fidArray;
            fidArray.fixedWidth(2).addInt(22).addInt(25).addInt(30).addInt(31).addInt(3);
            
            AppClient client(fidArray);
            OmmConsumer consumer(OmmConsumerConfig().host("localhost:14002").username("user"));
                
            consumer.registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "JPY=" ), client );

    The decode function contains the following code.

    void AppClient::decode( const FieldList& fl )
    {
        ElementList search;


        search.addArray("test", m_fids.complete()).complete();
        while (fl.forth(search))    {
            const FieldEntry& fe = fl.getEntry();
            cout << "Filter Fid: " << fl.getEntry().getFieldId() << " Name: " << fl.getEntry().getName() << " value: " << fl.getEntry().getLoad().toString() << endl;
        } 
    }

    The output contains the required fields.

    1624941943808.png

Answers