question

Upvotes
Accepted
3 2 2 3

How do we know snapshot(RFA) request has been fulfilled?

Snapshot requests result in multiple responses, how do we know snapshot request has been fulfilled. So that we can close the connection with TREP.

treprfarfa-api
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.

Upvotes
Accepted
4.4k 10 6 9

It is best to just follow the "Closing Event Streams" procedure.

The application should call isEventStreamClosed() function on incoming messages to determine whether an event stream is closed.

If the isEventStreamClosed() function call returns true, then the stream is closed and the application can clean up its resources.

void processEvent(const rfa::common::Event & event )
{
	switch( event.getType() )
	{
	case ConnectionEventEnum:
		processConnectionEvent( static_cast<const ConnectionEvent &>( event ) );
		break;
	case OMMItemEventEnum:
		processOMMItemEvent( static_cast<const OMMItemEvent &>( event ) );
		break;
	case OMMCmdErrorEventEnum:
		processOMMCmdErrorEvent( static_cast<const OMMCmdErrorEvent &>( event ) );
		break;
	case LoggerNotifyEventEnum:
		processLoggerNotifyEvent( static_cast<const LoggerNotifyEvent &>( event ) );
		break;
	default:
		break;
	}
	if ( event.isEventStreamClosed() )
		//Event stream is closed. Application can clean up related resources.
}
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.

But when we request snapshot for multiple RIC's ex USD=, EUR= and GBP=. this "event.isEventStreamClosed()" is getting fired for every rate response for RIC. We Like to know the last RIC's request is fulfilled. so that we could close the connection.

In that case, you have to either count the number of request, or create a watch list.

Just increase count or add item to watch list when you call registerClient(), and decrease count/remove item when isEventStreamClosed() function returns true.

When count is zero or watch list is empty, then you can close the connection.

Hi @Warat-B, Thanks for your answer, It works now.

Upvotes
582 8 12 23

Hi @Rathish K T

If the application sent a non-streaming (snapshot) request for a valid item, the final refresh response of the multi-part refresh messages should have the REFRESH COMPLETE flag in the indication mask. Also, it should receive a COMPLETION_EVENT (the event stream is closed) after that.

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