Class MirrorClient

  • All Implemented Interfaces:
    AutoCloseable

    public class MirrorClient
    extends Object
    implements AutoCloseable
    Interprets MM2's internal topics (checkpoints, heartbeats) on a given cluster.

    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);
      
    • Method Detail

      • close

        public void close()
        Close internal clients.
        Specified by:
        close in interface AutoCloseable
      • replicationPolicy

        public ReplicationPolicy replicationPolicy()
        Get the ReplicationPolicy instance used to interpret remote topics. This instance is constructed based on relevant configuration properties, including replication.policy.class.
      • replicationHops

        public int replicationHops​(String upstreamClusterAlias)
                            throws InterruptedException
        Compute shortest number of hops from an upstream source cluster. For example, given replication flow A->B->C, there are two hops from A to C. Returns -1 if upstream cluster is unreachable.
        Throws:
        InterruptedException
      • remoteConsumerOffsets

        public Map<TopicPartition,​OffsetAndMetadata> remoteConsumerOffsets​(String consumerGroupId,
                                                                                 String remoteClusterAlias,
                                                                                 Duration timeout)
        Translate a remote consumer group's offsets into corresponding local offsets. Topics are automatically renamed according to the ReplicationPolicy.
        Parameters:
        consumerGroupId - group ID of remote consumer group
        remoteClusterAlias - alias of remote cluster
        timeout - timeout