Search in sources :

Example 16 with RegistrationId

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 + ") ");
}
Also used : DatabusRegistration(com.linkedin.databus.client.pub.DatabusRegistration) DatabusMultiPartitionRegistration(com.linkedin.databus.client.registration.DatabusMultiPartitionRegistration) RegistrationId(com.linkedin.databus.client.pub.RegistrationId) RequestProcessingException(com.linkedin.databus2.core.container.request.RequestProcessingException) DbusPartitionInfo(com.linkedin.databus.client.pub.DbusPartitionInfo)

Example 17 with RegistrationId

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;
}
Also used : DatabusV3Registration(com.linkedin.databus.client.pub.DatabusV3Registration) RegistrationId(com.linkedin.databus.client.pub.RegistrationId) InvalidRequestParamValueException(com.linkedin.databus2.core.container.request.InvalidRequestParamValueException)

Aggregations

RegistrationId (com.linkedin.databus.client.pub.RegistrationId)17 DatabusV3Registration (com.linkedin.databus.client.pub.DatabusV3Registration)7 DatabusRegistration (com.linkedin.databus.client.pub.DatabusRegistration)5 DatabusClientException (com.linkedin.databus.client.pub.DatabusClientException)4 HashMap (java.util.HashMap)4 DbusPartitionInfo (com.linkedin.databus.client.pub.DbusPartitionInfo)3 DatabusMultiPartitionRegistration (com.linkedin.databus.client.registration.DatabusMultiPartitionRegistration)3 RequestProcessingException (com.linkedin.databus2.core.container.request.RequestProcessingException)3 ClusterCheckpointPersistenceProvider (com.linkedin.databus.client.pub.ClusterCheckpointPersistenceProvider)2 DatabusCombinedConsumer (com.linkedin.databus.client.pub.DatabusCombinedConsumer)2 DatabusV3MultiPartitionRegistration (com.linkedin.databus.client.pub.DatabusV3MultiPartitionRegistration)2 DbusClusterInfo (com.linkedin.databus.client.pub.DbusClusterInfo)2 DatabusV2ClusterRegistrationImpl (com.linkedin.databus.client.registration.DatabusV2ClusterRegistrationImpl)2 DatabusV2RegistrationImpl (com.linkedin.databus.client.registration.DatabusV2RegistrationImpl)2 DatabusSubscription (com.linkedin.databus.core.data_model.DatabusSubscription)2 InvalidRequestParamValueException (com.linkedin.databus2.core.container.request.InvalidRequestParamValueException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 DbusPartitionInfoImpl (com.linkedin.databus.client.DbusPartitionInfoImpl)1