How to subscribe to a list of RICs using Refinitiv Java EMA API ?

Hi,

The below sample code snippet at the github shows how to subscribe for one RIC for updates.

consumer.registerClient(EmaFactory.createReqMsg().serviceName("IDN_RDF").name("JPY="), appClient);

I'm looking for sample code to start subscription for more than one RIC (List of RICs).

Any help or pointers appreciated.

Thanks,

Mani


Best Answer

  • Jirapongse
    Answer ✓

    @Mani.A

    You can refer to the example 370 MarketPrice Batch that demonstrates basic usage of the EMA library while opening multiple item stream via a single request (a.k.a., batch request).

    The code looks like this:

                ElementList batch = EmaFactory.createElementList();
                OmmArray array = EmaFactory.createOmmArray();
                
                array.add(EmaFactory.createOmmArrayEntry().ascii("TRI.N"));
                array.add(EmaFactory.createOmmArrayEntry().ascii("IBM.N"));


                batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, array));
                
                consumer.registerClient(EmaFactory.createReqMsg().serviceName("IDN_RDF").payload(batch), appClient);

Answers