question

Upvotes
Accepted
1 0 1 2

Can i have multiple batches or a batch contain multiple ItemList of arrays and multiple ViewData array

I am requesting batch of RIC array(ItemList) and FID array(ViewData) in java but now i also have some specific RIC for which i need to ask only specific fids which i cannot sent in one batch what approach i need to folllow? Can i have multiple batches or a batch contain multiple ItemList of arrays and multiple ViewData array?

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apijavabatch
icon clock
10 |1500

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

Upvote
Accepted
9.5k 10 5 7

Hello @MayassK

I understand that you would like to request some RICs with difference fields e.g. RIC JPY=, TRI.N, 0005.HK with FID 22 and 25 and RIC EUR=, PTT.BK with FID 5 and 11. Is this right?

To request RICs with difference fields, you need to have multiple batch. Each batch contains the RICs with you would like the same fields . The example source code below shows to request RIC JPY=, TRI.N, 0005.HK with FID 22 and 25 and RIC EUR=, PTT.BK with FID 5 and 11.

OmmArray arrayv1 = EmaFactory.createOmmArray();
arrayv1.fixedWidth(2);
arrayv1.add(EmaFactory.createOmmArrayEntry().intValue(22));
arrayv1.add(EmaFactory.createOmmArrayEntry().intValue(25));
          
OmmArray arrayb1 = EmaFactory.createOmmArray();
arrayb1.add(EmaFactory.createOmmArrayEntry().ascii("JPY="));
arrayb1.add(EmaFactory.createOmmArrayEntry().ascii("TRI.N"));
arrayb1.add(EmaFactory.createOmmArrayEntry().ascii("0005.HK"));

ElementList batchView1 = EmaFactory.createElementList();
batchView1.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrayb1));
batchView1.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
batchView1.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayv1));
          
consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON").payload(batchView1), appClient);

            

OmmArray arrayv2 = EmaFactory.createOmmArray();
arrayv2.fixedWidth(2);
arrayv2.add(EmaFactory.createOmmArrayEntry().intValue(5));
arrayv2.add(EmaFactory.createOmmArrayEntry().intValue(11)); 

OmmArray arrayb2 = EmaFactory.createOmmArray();
arrayb2.add(EmaFactory.createOmmArrayEntry().ascii("EUR="));
arrayb2.add(EmaFactory.createOmmArrayEntry().ascii("PTT.BK"));
            
ElementList batchView2 = EmaFactory.createElementList();
batchView2.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrayb2));
batchView2.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
batchView2.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayv2));

consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON").payload(batchView2), appClient);
icon clock
10 |1500

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

Thank you Pimchaya.Wongrukun for your help.

In your example code, your created two batch views but at runtime i am not sure about the number. It could be two or more.

Can you give me an example where I can create N number of batch views?

Thankyou!

Upvote
9.5k 10 5 7

Hello @MayassK

To create N number of batch views, one possible solution is to declare a method which creates a batch views request and send the request to the server. Hence, you can call the method N times at runtime whenever you would like to send a request.

For example, I declare a method named sendBatchViewRequest(..) under Consumer class

void sendBatchViewRequest(Vector<String> RICs, Vector<Integer> fids, OmmConsumer consumer, AppClient appClient, String service) {
        OmmArray arrayv = EmaFactory.createOmmArray();
        arrayv.fixedWidth(2);
        Iterator<Integer> fidIter = fids.iterator(); 
        while (fidIter.hasNext()) 
           arrayv.add(EmaFactory.createOmmArrayEntry().intValue(fidIter.next()));
        
        OmmArray arrayb = EmaFactory.createOmmArray();
        Iterator<String> RICIter = RICs.iterator(); 
        while (RICIter.hasNext()) 
           arrayb.add(EmaFactory.createOmmArrayEntry().ascii(RICIter.next()));
        
        ElementList batchView = EmaFactory.createElementList();
        batchView.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrayb));
        batchView.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
        batchView.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayv));
        
        consumer.registerClient(EmaFactory.createReqMsg().serviceName(service).payload(batchView), appClient);
}

Call the method to send a batch view request:

Consumer myConsumer = new Consumer();
Vector<String> RICsVector  = new Vector<String>();
RICsVector.add("EUR=");
RICsVector.add("PTT.BK");
Vector<Integer> fidsVector  = new Vector<Integer>();
fidsVector.add(5);
fidsVector.add(11);
myConsumer.sendBatchViewRequest(RICsVector,fidsVector,consumer,appClient,"ELEKTRTON");


icon clock
10 |1500

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

Click below to post an Idea Post Idea