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;
}
Aggregations