THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
// Calculates the number of hops between a client and an upstream Kafka cluster based on replication heartbeats.
// If the given cluster is not reachable, returns -1.
int replicationHops(Map<String, Object> properties, String upstreamClusterAlias)
// Find all heartbeat topics, e.g. A.B.heartbeat, visible from the client.
Set<String> heartbeatTopics(Map<String, Object> properties)
// Find all checkpoint topics, e.g. A.checkpoint.internal, visible from the client.
Set<String> checkpointTopics(Map<String, Object> properties)
// Find all upstream clusters reachable from the client
Set<String> upstreamClusters(Map<String, Object> properties)
// Construct a consumer that is subscribed to all heartbeat topics.
Set<String> heartbeatTopics(Map<String, Object> properties)
// Find the local offsets corresponding to the latest checkpoint from a specific upstream consumer group.
Map<TopicPartition, OffsetAndMetadata> translateOffsets(Map<String, Object> properties,
String targetClusterAlias, String consumerGroupId, Duration timeout)
|
The utility class assumes DefaultReplicationPolicy is used for replication.
MirrorClient
The RemoteClusterUtils class wraps a low-level MirrorClient, with the following exposed methods:
Code Block |
---|
MirrorClient(Map<String, Object> props) ... void close() ... ReplicationPolicy replicationPolicy() ... int replicationHops(String upstreamClusterAlias) ... Set<String> heartbeatTopics() ... Set<String> checkpointTopics() ... // Finds upstream clusters, which may be multiple hops away, based on incoming heartbeats. Set<String> upstreamClusters() ... // Find all remote topics on the cluster Set<String> remoteTopics() ... // Find all remote topics from the given source Set<String> remoteTopics(String source) ... // Find the local offsets corresponding to the latest checkpoint from a specific upstream consumer group. Map<TopicPartition, OffsetAndMetadata> remoteConsumerOffsets(String consumerGroupId, String remoteClusterAlias, Duration timeout) ... |
Replication Policies and Filters
...