public class MirrorClient extends Object implements 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(Map<String,Object> props) |
MirrorClient(MirrorClientConfig config) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
checkpointTopics()
Find all checkpoint topics on this cluster.
|
void |
close()
Close internal clients.
|
Set<String> |
heartbeatTopics()
Find all heartbeat topics on this cluster.
|
Map<TopicPartition,OffsetAndMetadata> |
remoteConsumerOffsets(String consumerGroupId,
String remoteClusterAlias,
Duration timeout)
Translate a remote consumer group's offsets into corresponding local offsets.
|
Set<String> |
remoteTopics()
Find all remote topics on this cluster.
|
Set<String> |
remoteTopics(String source)
Find all remote topics that have been replicated directly from the given source cluster.
|
int |
replicationHops(String upstreamClusterAlias)
Compute shortest number of hops from an upstream source cluster.
|
ReplicationPolicy |
replicationPolicy()
Get the ReplicationPolicy instance used to interpret remote topics.
|
Set<String> |
upstreamClusters()
Find upstream clusters, which may be multiple hops away, based on incoming heartbeats.
|
public MirrorClient(MirrorClientConfig config)
public void close()
close
in interface AutoCloseable
public ReplicationPolicy replicationPolicy()
replication.policy.class
.public int replicationHops(String upstreamClusterAlias) throws InterruptedException
InterruptedException
public Set<String> heartbeatTopics() throws InterruptedException
InterruptedException
public Set<String> checkpointTopics() throws InterruptedException
InterruptedException
public Set<String> upstreamClusters() throws InterruptedException
InterruptedException
public Set<String> remoteTopics() throws InterruptedException
InterruptedException
public Set<String> remoteTopics(String source) throws InterruptedException
InterruptedException
public Map<TopicPartition,OffsetAndMetadata> remoteConsumerOffsets(String consumerGroupId, String remoteClusterAlias, Duration timeout)
consumerGroupId
- group ID of remote consumer groupremoteClusterAlias
- alias of remote clustertimeout
- timeout