We are trying to code as below.
1.Auto Listener waits for updates for a single dummy rate.
2.When there is an update the listener will pick rates for the rest of the 600 CCY rates from ATS.
However, Auto listener occupies 70-100% of CPU as we are waiting for the update(Consumer.dispatch) and also when we try to retrieve 600 CCY rates from Reuters. Sometime it hangs the server. As it does registerclient, it starts many threads which slows down the server.
Queries,
How do we overcome this issue? Is there a way to retrieve rates for 600 CCY rates in a single thread?
OmmConsumer consumer = null;
AppClientLive appClient = new AppClientLive();
try {
OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();
consumer = EmaFactory.createOmmConsumer(config.host(props.getProperty(MMRatesConstants.HOST_NAME_PROP)).username(props.getProperty(MMRatesConstants.USER_NAME_PROP)));
consumer.registerClient(EmaFactory.createReqMsg().serviceName(props.getProperty(MMRatesConstants.SERVICE_NAME_PROP)).name("MMRTUDT=MMR"), appClient);
while (true) {
if (MMRatesConstants.IS_MARKET_UPDATED){
break;
}
consumer.dispatch(1000);
}
}