Hi Team,
We are currently upgrading our application from RFA API to EMA API and we are facing issues while unsubscribing a RIC in some scenarios. We are using the OmmConsumerClient as explained in the examples. But while unsubscribing a RIC we are still getting updates for it in the form of UpdateMessage.
We request you to please provide a working example to unsubscribe a RIC in Java using this OmmConsumerClient.
class AppClient implements OmmConsumerClient
{
public void onRefreshMsg(RefreshMsg refreshMsg, OmmConsumerEvent event)
{
System.out.println(refreshMsg);
}
public void onUpdateMsg(UpdateMsg updateMsg, OmmConsumerEvent event)
{
System.out.println(updateMsg);
}
public void onStatusMsg(StatusMsg statusMsg, OmmConsumerEvent event)
{
System.out.println(statusMsg);
}
public void onGenericMsg(GenericMsg genericMsg, OmmConsumerEvent consumerEvent){}
public void onAckMsg(AckMsg ackMsg, OmmConsumerEvent consumerEvent){}
public void onAllMsg(Msg msg, OmmConsumerEvent consumerEvent){}
}
public class Consumer
{
public static void main(String[] args)
{
OmmConsumer consumer = null;
try
{
AppClient appClient = new AppClient();
OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();
consumer = EmaFactory.createOmmConsumer(config.host("localhost:14002").username("user"));
ReqMsg reqMsg = EmaFactory.createReqMsg();
consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N"), 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();
}
}
}