Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
@InterfaceStability.Evolving
public interface ReplicationPolicy extends Configurable {
    ....
    /** Returns heartbeats topic name.*/
    default String heartbeatsTopic() { return "heartbeats";}

    /** Returns the offset-syncs topic for given cluster alias. */
    default String offsetSyncTopicoffsetSyncsTopic(String targetAlias) { return " mm2-offset-syncs." + targetCluster + ".internal";}

    /** Returns the name checkpoint topic for given cluster alias. */
    default String checkpointTopiccheckpointsTopic(String clusterAlias) { return clusterAlias + ".checkpointcheckpoints.internal"; }
    
    /** check if topic is a heartbeat topic, e.g heartbeats, us-west.heartbeats. */
    default boolean isHeartbeatTopicisHeartbeatsTopic(String topic) {
        return heartbeatsTopic().equals(originalTopic(topic));
    }

    /** check if topic is a checkpoint topic. */
    default boolean isCheckpointTopicisCheckpointsTopic(String topic) {return  topic.endsWith(".checkpointcheckpoints.internal")}

    /** Check topic is one of MM2 internal topic, this is used to make sure the topic doesn't need to be replicated.*/
    default boolean isMM2InternalTopic(String topic) {return  topic.endsWith(".internal");}

    /** Internal topics are never replicated. */
    default boolean isInternalTopic(String topic) {
		boolean isKafkaInternalTopic = topic.startsWith("__") || topic.startsWith(".") ||  topic.endsWith("-internal");
        return isMM2InternalTopic(topic) || isKafkaInternalTopic;
    }
}

...

  • heartbeatsTopic()heartbeats
  • checkpointTopiccheckpointsTopic(clusterAlias)→ clusterAlias.checkpoint.internal
  • offsetSyncTopicoffsetSyncsTopic(targetClusterclusterAlias)mm2-offset-syncs.targetClusteclusterAlias.internal
  • isMM2InternalTopic(topic.internal) -> return true if topic name has internal suffix

...