Hi,
I run `example360__MarketPrice__View` and `example370__MarketPrice__Batch`. Both worked fine.
I would like to combine Batch and View to reduce heap consumption.
But the following code, which I tried to merge example360 into example370, leads to an error.
public class Consumer
{
public static void main(String[] args)
{
OmmConsumer consumer = null;
try
{
AppClient appClient = new AppClient();
consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig().host("10.15.1.52:14002").username("new_user"));
OmmArray arrBatch = EmaFactory.createOmmArray();
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/7203.T"));
arrBatch.add(EmaFactory.createOmmArrayEntry().ascii("/2432.T"));
ElementList batch = EmaFactory.createElementList();
batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, arrBatch));
OmmArray arrayView = EmaFactory.createOmmArray();
arrayView.fixedWidth(2);
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(6));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(22));
arrayView.add(EmaFactory.createOmmArrayEntry().intValue(25));
ElementList view = EmaFactory.createElementList();
view.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
view.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, arrayView));
consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON_DD").payload(view).payload(batch), appClient);
Thread.sleep(60000); // API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()
}
catch (InterruptedException | OmmException excp)
{
System.out.println(excp.getMessage());
}
finally
{
if (consumer != null) consumer.uninitialize();
}
}
}
And the error is:
11 10, 2016 6:38:36 午後 com.thomsonreuters.ema.access.SingleItem rsslSubmit
重大: loggerMsg
ClientName: SingleItem
Severity: Error
Text: Internal error: rsslChannel.submit() failed in SingleItem.submit(RequestMsg)RsslChannel 0
Error Id -1
Internal sysError 0
Error Location ItemHandler.extractViewFromMsg
Error Text :ViewData element not found <-26>
loggerMsgEnd
Also, when I swap the order of `.payload(view).payload(batch)` to `.payload(batch).payload(view)`, the error is:
Failed to open or modify item request. Reason: ReactorReturnCodes.FAILURE. Error text: :ItemList not found.
11 10, 2016 6:52:24 午後 com.thomsonreuters.ema.access.SingleItem rsslSubmit
重大: loggerMsg
ClientName: SingleItem
Severity: Error
Text: Internal error: rsslChannel.submit() failed in SingleItem.submit(RequestMsg)RsslChannel 0
Error Id -1
Internal sysError 0
Error Location WlItemHandler.handleBatchRequest
Error Text :ItemList not found.
loggerMsgEnd
Could you tell me how to use both Batch and View at the same time?
Thank you.