question

Upvotes
Accepted
4 0 1 4

How should we implement the consumer's rdmLoginMsgCallback()

Hi

I've a problem following the UPA ValueAdd package example of consumer's rdmLoginMsgCallback() implementation. This is what written in the example:

@Override
public int rdmLoginMsgCallback(RDMLoginMsgEvent event)
{
	ChannelInfo chnlInfo = (ChannelInfo)event.reactorChannel().userSpecObj();
	LoginMsgType msgType = event.rdmLoginMsg().rdmMsgType();


	switch (msgType)
	{
		case REFRESH:
			System.out.println("Received Login Refresh for Username: " + ((LoginRefresh)event.rdmLoginMsg()).userName());
			System.out.println(event.rdmLoginMsg().toString());
			
			// save loginRefresh
			((LoginRefresh)event.rdmLoginMsg()).copy(chnlInfo.loginRefresh);
				
			// set login stream id in MarketPriceHandler and YieldCurveHandler
			chnlInfo.marketPriceHandler.loginStreamId(event.rdmLoginMsg().streamId());
			chnlInfo.yieldCurveHandler.loginStreamId(event.rdmLoginMsg().streamId());
			break;
		case STATUS:
			LoginStatus loginStatus = (LoginStatus)event.rdmLoginMsg();
			System.out.println("Received Login StatusMsg");
			if (loginStatus.checkHasState())
	    	{
				System.out.println("	" + loginStatus.state());
	    	}
			break;
		default:
			System.out.println("Received Unhandled Login Msg Type: " + msgType);
			break;
	}
	
    return ReactorCallbackReturnCodes.SUCCESS;
}

Unfortunately, this implementation causes infinite login retry attempts at a very rapid rate (i.e. no pause during each retry even we set reconnectMinDelay / reconnectMaxDelay both to 10000 ms) .

My question is, what is the proper way to implement this method if we want the consumer to not retrying login when received Login StatusMsg?

I had tried modifying the code to return ReactorCallbackReturnCodes.FAILURE in that case and it seems to work pretty well but not sure if that's a correct approach.

elektronrefinitiv-realtimeelektron-sdkrrtjavaeta-apielektron-transport-api
icon clock
10 |1500

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

Upvote
Accepted
9.5k 10 5 7

reconnectMinDelay / reconnectMaxDelay is the minimum/maximum time the Reactor waits (in milliseconds) before attempting to reconnect a failed channel. Both are used in the connection step not in login step. Your application could connect already(connection step was done) but it fails during login step. UPA Java does not have option to control the maximum number of login retry and the rapid rate. That why's your application infinite login retry attempts at a very rapid rate.

You can return ReactorCallbackReturnCodes.FAILURE to stop infinite login retry attempts because try to login with the same invalid login request does not help. Application will alway login fails. Then, you should observe the login status and fix login request. This will make sure that your application will be able to login successfully and can get data in the next time.
icon clock
10 |1500

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

Upvotes
4 0 1 4

Thanks for the confirmation. :)

icon clock
10 |1500

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