public class MirrorClient
extends java.lang.Object
implements java.lang.AutoCloseable
Given a top-level "mm2.properties" configuration file, MirrorClients can be constructed for individual clusters as follows:
MirrorMakerConfig mmConfig = new MirrorMakerConfig(props); MirrorClientConfig mmClientConfig = mmConfig.clientConfig("some-cluster"); MirrorClient mmClient = new Mirrorclient(mmClientConfig);
Constructor and Description |
---|
MirrorClient(java.util.Map<java.lang.String,java.lang.Object> props) |
MirrorClient(MirrorClientConfig config) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.String> |
checkpointTopics()
Find all checkpoint topics on this cluster.
|
void |
close()
Close internal clients.
|
java.util.Set<java.lang.String> |
heartbeatTopics()
Find all heartbeat topics on this cluster.
|
java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> |
remoteConsumerOffsets(java.lang.String consumerGroupId,
java.lang.String remoteClusterAlias,
java.time.Duration timeout)
Translate a remote consumer group's offsets into corresponding local offsets.
|
java.util.Set<java.lang.String> |
remoteTopics()
Find all remote topics on this cluster.
|
java.util.Set<java.lang.String> |
remoteTopics(java.lang.String source)
Find all remote topics that have been replicated directly from the given source cluster.
|
int |
replicationHops(java.lang.String upstreamClusterAlias)
Compute shortest number of hops from an upstream source cluster.
|
ReplicationPolicy |
replicationPolicy()
Get the ReplicationPolicy instance used to interpret remote topics.
|
java.util.Set<java.lang.String> |
upstreamClusters()
Find upstream clusters, which may be multiple hops away, based on incoming heartbeats.
|
public MirrorClient(java.util.Map<java.lang.String,java.lang.Object> props)
public MirrorClient(MirrorClientConfig config)
public void close()
close
in interface java.lang.AutoCloseable
public ReplicationPolicy replicationPolicy()
replication.policy.class
.public int replicationHops(java.lang.String upstreamClusterAlias) throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> heartbeatTopics() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> checkpointTopics() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> upstreamClusters() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> remoteTopics() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Set<java.lang.String> remoteTopics(java.lang.String source) throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> remoteConsumerOffsets(java.lang.String consumerGroupId, java.lang.String remoteClusterAlias, java.time.Duration timeout)
consumerGroupId
- group ID of remote consumer groupremoteClusterAlias
- alias of remote clustertimeout
- timeout