コード例 #1
0
  /** Exposes the mapping between a mpRegistration -> Set of individual registrations */
  private void processMPRegistrations(DatabusRequest request)
      throws IOException, RequestProcessingException {
    Map<RegistrationId, DatabusV3Registration> registrationIdMap = _client.getRegistrationIdMap();

    if (null == registrationIdMap)
      throw new InvalidRequestParamValueException(
          request.getName(), REGISTRATIONS_KEY, "Present only for Databus V3 clients");

    Map<String, List<String>> ridList = new TreeMap<String, List<String>>();
    for (Map.Entry<RegistrationId, DatabusV3Registration> entry : registrationIdMap.entrySet()) {
      DatabusV3Registration reg = entry.getValue();
      if (reg instanceof DatabusV3MultiPartitionRegistration) {
        Collection<DatabusV3Registration> dvrList =
            ((DatabusV3MultiPartitionRegistration) reg).getPartionRegs().values();
        List<String> mpRegList = new ArrayList<String>();
        for (DatabusV3Registration dvr : dvrList) {
          mpRegList.add(dvr.getId().getId());
        }
        ridList.put(entry.getKey().getId(), mpRegList);
      }
    }

    writeJsonObjectToResponse(ridList, request);

    return;
  }
コード例 #2
0
  private void processV3Registrations(DatabusRequest request)
      throws IOException, RequestProcessingException {
    Map<RegistrationId, DatabusV3Registration> registrationIdMap = _client.getRegistrationIdMap();

    if (null == registrationIdMap)
      throw new InvalidRequestParamValueException(
          request.getName(), REGISTRATIONS_KEY, "Present only for Databus V3 clients");

    Map<String, List<DatabusSubscription>> regIds =
        new TreeMap<String, List<DatabusSubscription>>();
    for (Map.Entry<RegistrationId, DatabusV3Registration> entry : registrationIdMap.entrySet()) {
      DatabusV3Registration reg = entry.getValue();
      if (reg instanceof DatabusV3MultiPartitionRegistration) continue;
      List<DatabusSubscription> dsl = reg.getSubscriptions();
      regIds.put(entry.getKey().getId(), dsl);
    }

    writeJsonObjectToResponse(regIds, request);

    return;
  }