Package com.linkedin.databus.client.pub

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


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


   */
  private DatabusRegistration findV2Registration(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();

    if (null != regs)
    {
      for (DatabusRegistration r : regs)
      {
        if (regId.equals(r.getRegistrationId()))
        {
          return r;
        }

        /**
         * Important Note: There is an important implementation difference on which
         * registrations are stored in the global registration data-structure maintained
         * by the client (DatabusHttp[V3]ClientImpls) between V2 and V3.
         *
         * 1. In the case of V2, only top-level registrations are stored in the global
         * data-structure (DatabusHttpClientImpl.regList 2. In the case of V3, all
         * registrations are stored in the global data-structure.
         *
         * In the case of V3, this is needed so that all registrations can act on the
         * relay external view change. This can be refactored in the future by moving the
         * relay-external view change to registration impl ( reduce the complexity in
         * ClientImpl ). The V2 implementation did not have this logic and was following a
         * more intuitive structure of preserving the hierarchy. The below code handles
         * the discrepancy for V2.
         */
        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();
            }
          }
        }
View Full Code Here

  private DatabusV3Registration findV3Registration(DatabusRequest request, String prefix) throws RequestProcessingException
  {
    String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
    String regIdStr = category.substring(prefix.length());
    RegistrationId regId = new RegistrationId(regIdStr);
    return findV3Registration(regId, request);
  }
View Full Code Here

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

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

      throw new DatabusClientException("No consumer callback has been specified.");

    if ((null == sources) || (sources.length == 0))
      throw new DatabusClientException("Please specify Databus sources to be consumed: register(consumer, source1, source2, ...");

    RegistrationId regId =
        RegistrationIdGenerator.generateNewId(consumer.getClass().getSimpleName(),
                                              DatabusSubscription.createSubscriptionList(Arrays.asList(sources)));
    DatabusV2RegistrationImpl reg = new DatabusV2RegistrationImpl(regId,
                                                                  this,
                                                                  getCheckpointPersistenceProvider());
View Full Code Here

      throw new DatabusClientException("No consumer callbacks have been specified.");

    if ((null == sources) || (sources.length == 0))
      throw new DatabusClientException("Please specify Databus sources to be consumed: register(consumer, source1, source2, ...");

    RegistrationId regId =
        RegistrationIdGenerator.generateNewId(consumers.iterator().next().getClass().getSimpleName(),
                                              DatabusSubscription.createSubscriptionList(Arrays.asList(sources)));
    DatabusV2RegistrationImpl reg = new DatabusV2RegistrationImpl(regId,
                                                                  this,
                                                                  getCheckpointPersistenceProvider());
View Full Code Here

    ClusterCheckpointPersistenceProvider.StaticConfig ckptPersistenceProviderConfig =
        new ClusterCheckpointPersistenceProvider.StaticConfig(c.getZkAddr(),c.getClusterName(),c.getMaxCkptWritesSkipped(),c.getCheckpointIntervalMs());

    DbusClusterInfo clusterInfo = new DbusClusterInfo(c.getClusterName(), c.getNumPartitions(), c.getQuorum());

    RegistrationId regId = RegistrationIdGenerator.generateNewId(c.getClusterName());

    DatabusV2ClusterRegistrationImpl reg =
        new DatabusV2ClusterRegistrationImpl(regId, this, ckptPersistenceProviderConfig, clusterInfo, consumerFactory, filterFactory, partitionListener, sources);
    _regList.add(reg);
    reg.onRegister();
View Full Code Here

    for (DatabusMultiPartitionRegistration reg : regs)
    {
      if (reg instanceof DatabusV2ClusterRegistrationImpl)
      {
        DatabusV2ClusterRegistrationImpl r = (DatabusV2ClusterRegistrationImpl) reg;
        clusters.put(new RegistrationId(r.getRegistrationId().getId()),r.getClusterInfo());
      }
    }
    return clusters;
  }
View Full Code Here

      if (ds != null)
        subscription.append(ds.generateSubscriptionString());
    }

    String id = generateUniqueString(prefix, subscription.toString());
    RegistrationId rid = new RegistrationId(id);
    return rid;
  }
View Full Code Here

TOP

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

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.