I have some questions about the discovery process for EMA connections. What we are currently using is just lifted from some sample code from about 2 years ago and looks like
class EndpointDiscoveryClient implements ServiceEndpointDiscoveryClient {
public void onSuccess(ServiceEndpointDiscoveryResp resp, ServiceEndpointDiscoveryEvent event) {
List<ServiceEndpointDiscoveryInfo> serviceEndpointDiscoveryInfos = resp.serviceEndpointInfoList();
for (ServiceEndpointDiscoveryInfo info : serviceEndpointDiscoveryInfos) {
List<String> locationList = info.locationList();
if (locationList.size() == 2 && locationList.get(0).startsWith(location)) {
host = info.endpoint();
port = info.port();
break;
}
}
}
}
Why test for size == 2
instead of size >= 2
? Will there ever be more than 2 (or just 1)?
Why only use the first one? Are there cases we would fail over to a different host, and if so how do we detect those cases?
We're currently using com.refinitiv.ema:ema:3.7.1.0