use of com.linkedin.databus.client.monitoring.RegistrationStatsInfo in project databus by linkedin.
the class ClientStateRequestProcessor method processRegistrationInfo.
/**
* Provides an individual registrations details. The individual registration can be
* either that of V2/V3 and top-level or child. Top-level registrations are those that
* were created as a result of one of "registerXXX()" calls on databus-client. In the
* case of multi-partition registrations (like MPRegistration, V2/V3 CLB), only the
* parent registration is considered the top-level registration. Per-partition (child)
* registrations which were created as part of partition migration are NOT top-level
* registrations. The output format can be different depending on whether it is a V2/V3
* as we are dumping the entire Registration in the case of V2. In the case of V3, we
* create an intermediate objects. These are legacy formats which when changed could
* cause the integ-tests to fail.
*
* @param request
* DatabusRequest corresponding to the REST call.
* @throws IOException
* if unable to write to output channel.
* @throws RequestProcessingException
* when registration could not be located.
*/
private void processRegistrationInfo(DatabusRequest request) throws IOException, RequestProcessingException {
boolean found = true;
// V2 Registration lookup first
RegistrationStatsInfo regStatsInfo = null;
try {
DatabusRegistration r = findV2Registration(request, REGISTRATION_KEY_PREFIX);
writeJsonObjectToResponse(r, request);
} catch (RequestProcessingException ex) {
found = false;
}
// V3 Registration lookup if not found
if (!found) {
// if
DatabusV3Registration reg = findV3Registration(request, REGISTRATION_KEY_PREFIX);
// reg
// is
// null,
// the
// callee
// throws
// an
// exception.
DatabusSourcesConnection sourcesConn = _client.getDatabusSourcesConnection(reg.getRegistrationId().getId());
regStatsInfo = new RegistrationStatsInfo(reg, sourcesConn);
writeJsonObjectToResponse(regStatsInfo, request);
}
}
Aggregations