Package com.linkedin.databus.client.pub

Examples of com.linkedin.databus.client.pub.DatabusV3Registration


                                                  "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>();
View Full Code Here


    }

    // V3 Registration lookup if not found
    if (!found)
    {
      DatabusV3Registration reg = findV3Registration(request, REGISTRATION_KEY_PREFIX); // if
                                                                                        // reg
                                                                                        // is
                                                                                        // null,
                                                                                        // the
                                                                                        // callee
                                                                                        // throws
                                                                                        // an
                                                                                        // exception.
      DatabusSourcesConnection sourcesConn =
          _client.getDatabusSourcesConnection(reg.getRegistrationId().getId());
      regStatsInfo = new RegistrationStatsInfo(reg, sourcesConn);
      writeJsonObjectToResponse(regStatsInfo, request);
    }
  }
View Full Code Here

    // V3 Registration
    if (null != registrationIdMap)
    {
      for (Map.Entry<RegistrationId, DatabusV3Registration> entry : registrationIdMap.entrySet())
      {
        DatabusV3Registration reg = entry.getValue();
        List<DatabusSubscription> dsl = reg.getSubscriptions();
        regIds.put(entry.getKey().getId(), dsl);
      }
    }
    writeJsonObjectToResponse(regIds, request);
  }
View Full Code Here

    for (Entry<RegistrationId, DbusClusterInfo> e : clusterMap.entrySet())
    {
      if (clusterName.equalsIgnoreCase(e.getValue().getName()))
      {
        DatabusV3Registration reg = _client.getRegistration(e.getKey());
        if (reg instanceof DatabusV3MultiPartitionRegistration)
        {
          return (DatabusV3MultiPartitionRegistration) reg;
        }
        break;
View Full Code Here

   */
  private void pauseResumeRegistration(DatabusRequest request, boolean doPause) throws IOException,
      RequestProcessingException
  {
    DatabusRegistration r = null;
    DatabusV3Registration r2 = null;

    boolean found = true;
    boolean isRunning = false;
    boolean isPaused = false;
    boolean isSuspended = false;
    RegistrationId regId = null;
    RequestProcessingException rEx = null;
    RegStatePair regStatePair = null;
    try
    {
      r = findV2Registration(request, PAUSE_REGISTRATION);
      isRunning = r.getState().isRunning();
      isPaused = (r.getState() == DatabusRegistration.RegistrationState.PAUSED);
      isSuspended =
          (r.getState() == DatabusRegistration.RegistrationState.SUSPENDED_ON_ERROR);
      regId = r.getRegistrationId();
    }
    catch (RequestProcessingException ex)
    {
      found = false;
      rEx = ex;
    }

    if (!found)
    {
      try
      {
        r2 = findV3Registration(request, PAUSE_REGISTRATION);
        found = true;
        isRunning = r2.getState().isRunning();
        isPaused = (r2.getState() == RegistrationState.PAUSED);
        isSuspended = (r2.getState() == RegistrationState.SUSPENDED_ON_ERROR);
        regId = r.getRegistrationId();
      }
      catch (RequestProcessingException ex)
      {
        found = false;
        rEx = ex;
      }
    }

    if (!found)
      throw rEx;

    LOG.info("REST call to pause registration : " + regId);

    if (isRunning)
    {
      if (doPause)
      {
        if (!isPaused)
        {
          if (null != r)
          {
            r.pause();
            regStatePair = new RegStatePair(r.getState(), r.getRegistrationId());
          }
          else
          {
            r2.pause();
            regStatePair = new RegStatePair(r2.getState().name(), r2.getRegistrationId());
          }
        }
      }
      else
      {
        if (isPaused || isSuspended)
        {
          if (null != r)
          {
            r.resume();
            regStatePair = new RegStatePair(r.getState(), r.getRegistrationId());
          }
          else
          {
            r2.resume();
            regStatePair = new RegStatePair(r2.getState().name(), r2.getRegistrationId());
          }
        }
      }
    }
    writeJsonObjectToResponse(regStatePair, request);
View Full Code Here

     */
    if ((null != regMap) && (null != topLevelRegs))
    {
      for (RegInfo reg : topLevelRegs)
      {
        DatabusV3Registration r = regMap.get(reg.getRegId());
        if (r.getState().isRunning())
        {
          if (r.getState() != RegistrationState.PAUSED)
            r.pause();
        }
      }
    }
    writeJsonObjectToResponse(getAllTopLevelRegStates(), request);
  }
View Full Code Here

     */
    if ((null != regMap) && (null != topLevelRegs))
    {
      for (RegInfo reg : topLevelRegs)
      {
        DatabusV3Registration r = regMap.get(reg.getRegId());
        if (r.getState().isRunning())
        {
          if ((r.getState() == RegistrationState.PAUSED)
              || (r.getState() == RegistrationState.SUSPENDED_ON_ERROR))
            r.resume();
        }
      }
    }
    writeJsonObjectToResponse(getAllTopLevelRegStates(), request);
  }
View Full Code Here

     */
    Map<RegistrationId, DatabusV3Registration> regMap = _client.getRegistrationIdMap();
    for (Entry<RegistrationId, DatabusV3Registration> e : regMap.entrySet())
    {
      RegInfo regInfo = null;
      DatabusV3Registration r = e.getValue();
      // If not top-level, skip
      if (null != r.getParentRegistration())
      {
        continue;
      }

      Map<DbusPartitionInfo, RegInfo> childR = null;
      if (r instanceof DatabusV3MultiPartitionRegistration)
      {
        // ass the children regs to parent.
        Map<PhysicalPartition, DatabusV3Registration> childRegs =
            ((DatabusV3MultiPartitionRegistration) r).getPartionRegs();
        childR = new HashMap<DbusPartitionInfo, RegInfo>();
        for (Entry<PhysicalPartition, DatabusV3Registration> e2 : childRegs.entrySet())
        {
          childR.put(new DbusPartitionInfoImpl(e2.getKey().getId()),
                     new RegInfo(e.getValue().getState().name(),
                                 e.getValue().getRegistrationId(),
                                 e.getValue().getStatus(),
                                 null,
                                 e.getValue().getSubscriptions()));
        }
      }
      regInfo =
          new RegInfo(r.getState().name(),
                      r.getRegistrationId(),
                      r.getStatus(),
                      null,
                      r.getSubscriptions(),
                      true,
                      childR);
      regListMap.put(e.getKey(), regInfo);
    }
    return regListMap.values();
View Full Code Here

    for (Entry<PhysicalPartition, DatabusV3Registration> e : reg.getPartionRegs()
                                                                .entrySet())
    {
      if (partition == e.getKey().getId())
      {
        DatabusV3Registration r = e.getValue();
        return new RegInfo(r.getState().name(),
                           r.getRegistrationId(),
                           r.getStatus(),
                           null,
                           r.getSubscriptions());
      }
    }

    throw new RequestProcessingException("Partition(" + partition + ") for cluster ("
        + cluster + ") not found !!");
View Full Code Here

  }

  private void processInboundEventsRegistrationV3(DatabusRequest request)
      throws IOException, RequestProcessingException
  {
    DatabusV3Registration reg = findV3Registration(request, INBOUND_EVENTS_REG_KEY_PREFIX);
    writeJsonObjectToResponse(reg.getRelayEventStats().getTotalStats(), request);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.pub.DatabusV3Registration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.