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
All Methods Static Methods Concrete Methods 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 Detail
-
replicationHops
public static int replicationHops(Map<String,Object> properties, String upstreamClusterAlias) throws InterruptedException, TimeoutException
Find 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, TimeoutException
Find all heartbeat topics- Throws:
InterruptedException
TimeoutException
-
checkpointTopics
public static Set<String> checkpointTopics(Map<String,Object> properties) throws InterruptedException, TimeoutException
Find all checkpoint topics- Throws:
InterruptedException
TimeoutException
-
upstreamClusters
public static Set<String> upstreamClusters(Map<String,Object> properties) throws InterruptedException, TimeoutException
Find 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, TimeoutException
Translate 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
-
-