Package org.apache.kafka.connect.mirror
Class RemoteClusterUtils
java.lang.Object
org.apache.kafka.connect.mirror.RemoteClusterUtils
public final class RemoteClusterUtils extends Object
Convenience methods for multi-cluster environments. Wraps MirrorClient (@see MirrorClient).
Properties passed to these methods are used to construct internal Admin and Consumer clients. Sub-configs like "admin.xyz" are also supported. For example:
bootstrap.servers = host1:9092 consumer.client.id = mm2-client
-
Method Summary
Modifier and Type Method Description static Set<String>
checkpointTopics(Map<String,Object> properties)
Find all checkpoint topicsstatic Set<String>
heartbeatTopics(Map<String,Object> properties)
Find all heartbeat topicsstatic int
replicationHops(Map<String,Object> properties, String upstreamClusterAlias)
Find shortest number of hops from an upstream cluster.static Map<TopicPartition,OffsetAndMetadata>
translateOffsets(Map<String,Object> properties, String remoteClusterAlias, String consumerGroupId, Duration timeout)
Translate a remote consumer group's offsets into corresponding local offsets.static Set<String>
upstreamClusters(Map<String,Object> properties)
Find all upstream clusters
-
Method Details
-
replicationHops
public static int replicationHops(Map<String,Object> properties, String upstreamClusterAlias) throws InterruptedException, TimeoutExceptionFind shortest number of hops from an upstream cluster. Returns -1 if the cluster is unreachable- Throws:
InterruptedException
TimeoutException
-
heartbeatTopics
public static Set<String> heartbeatTopics(Map<String,Object> properties) throws InterruptedException, TimeoutExceptionFind all heartbeat topics- Throws:
InterruptedException
TimeoutException
-
checkpointTopics
public static Set<String> checkpointTopics(Map<String,Object> properties) throws InterruptedException, TimeoutExceptionFind all checkpoint topics- Throws:
InterruptedException
TimeoutException
-
upstreamClusters
public static Set<String> upstreamClusters(Map<String,Object> properties) throws InterruptedException, TimeoutExceptionFind all upstream clusters- Throws:
InterruptedException
TimeoutException
-
translateOffsets
public static Map<TopicPartition,OffsetAndMetadata> translateOffsets(Map<String,Object> properties, String remoteClusterAlias, String consumerGroupId, Duration timeout) throws InterruptedException, TimeoutExceptionTranslate a remote consumer group's offsets into corresponding local offsets. Topics are automatically renamed according to the ReplicationPolicy.- Parameters:
properties
-consumerGroupId
- group ID of remote consumer groupremoteClusterAlias
- alias of remote clustertimeout
- timeout- Throws:
InterruptedException
TimeoutException
- See Also:
MirrorClientConfig
-