Search in sources :

Example 1 with ClusterRegistrationStaticConfig

use of com.linkedin.databus.client.registration.ClusterRegistrationStaticConfig in project databus by linkedin.

the class DatabusHttpClientImpl method registerCluster.

@Override
public DatabusRegistration registerCluster(String cluster, DbusClusterConsumerFactory consumerFactory, DbusServerSideFilterFactory filterFactory, DbusPartitionListener partitionListener, String... sources) throws DatabusClientException {
    if ((null == sources) || (sources.length == 0))
        throw new DatabusClientException("Sources is empty !!");
    if (_activeClusters.contains(cluster))
        throw new DatabusClientException("Cluster :" + cluster + " has already been registed to this client instance." + " Only one registration per cluster is allowed for a databus client instance !!");
    ClusterRegistrationStaticConfig c = _clientStaticConfig.getClientCluster(cluster);
    if (null == c)
        throw new DatabusClientException("Cluster Configuration for cluster (" + cluster + ") not provided !!");
    if (null == consumerFactory)
        throw new DatabusClientException("Consumer Factory is null !!");
    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();
    _activeClusters.add(cluster);
    return reg;
}
Also used : DatabusV2ClusterRegistrationImpl(com.linkedin.databus.client.registration.DatabusV2ClusterRegistrationImpl) ClusterCheckpointPersistenceProvider(com.linkedin.databus.client.pub.ClusterCheckpointPersistenceProvider) DbusClusterInfo(com.linkedin.databus.client.pub.DbusClusterInfo) RegistrationId(com.linkedin.databus.client.pub.RegistrationId) ClusterRegistrationStaticConfig(com.linkedin.databus.client.registration.ClusterRegistrationStaticConfig) ClusterRegistrationStaticConfig(com.linkedin.databus.client.registration.ClusterRegistrationStaticConfig) DatabusClientException(com.linkedin.databus.client.pub.DatabusClientException)

Aggregations

ClusterCheckpointPersistenceProvider (com.linkedin.databus.client.pub.ClusterCheckpointPersistenceProvider)1 DatabusClientException (com.linkedin.databus.client.pub.DatabusClientException)1 DbusClusterInfo (com.linkedin.databus.client.pub.DbusClusterInfo)1 RegistrationId (com.linkedin.databus.client.pub.RegistrationId)1 ClusterRegistrationStaticConfig (com.linkedin.databus.client.registration.ClusterRegistrationStaticConfig)1 DatabusV2ClusterRegistrationImpl (com.linkedin.databus.client.registration.DatabusV2ClusterRegistrationImpl)1