use of com.linkedin.databus.client.pub.RegistrationId in project databus by linkedin.
the class ClientStatsRequestProcessor method findRegistration.
private DatabusRegistration findRegistration(DatabusRequest request, String prefix) throws RequestProcessingException {
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String registrationIdStr = category.substring(prefix.length());
RegistrationId regId = new RegistrationId(registrationIdStr);
Collection<DatabusRegistration> regs = _client.getAllRegistrations();
for (DatabusRegistration r : regs) {
if (regId.equals(r.getRegistrationId()))
return r;
if (r instanceof DatabusMultiPartitionRegistration) {
Map<DbusPartitionInfo, DatabusRegistration> childRegs = ((DatabusMultiPartitionRegistration) r).getPartitionRegs();
for (Entry<DbusPartitionInfo, DatabusRegistration> e : childRegs.entrySet()) if (regId.equals(e.getValue().getRegistrationId()))
return e.getValue();
}
}
throw new RequestProcessingException("Unable to find registration (" + regId + ") ");
}
use of com.linkedin.databus.client.pub.RegistrationId in project databus by linkedin.
the class ClientStatsRequestProcessor method findV3Registration.
private DatabusV3Registration findV3Registration(DatabusRequest request, String prefix) throws InvalidRequestParamValueException {
String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
String registrationIdStr = category.substring(prefix.length());
DatabusV3Registration reg = _client.getRegistration(new RegistrationId(registrationIdStr));
if (null == reg) {
LOG.warn("Invalid registrationId: " + registrationIdStr);
throw new InvalidRequestParamValueException(request.getName(), prefix, "No data available for this RegistrationId yet");
}
return reg;
}
Aggregations