Versions Compared

Key

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

...

Code Block
languagejava
titleReplicationPolicy.java
public interface ReplicationPolicy {
    ...

    default boolean isMM2InternalTopic(String topic) {
        // With this change, we only consider a topic to be mm2 internal if it
        // 1. starts with "mm2" and ends wit "internal", or
        // 2. it is a checkpoint topic (as by default, it ends with ".checkpoints.internal", but can be overwritten by implementing classes)
        return  topic.startsWith("mm2") && topic.endsWith("internal")  || isCheckpointsTopic(topic);
    }

    default boolean isInternalTopic(String topic) {
        boolean isKafkaInternalTopic = topic.startsWith("__") || topic.startsWith(".");
        return isMM2InternalTopic(topic) || isKafkaInternalTopic;
    }

}

And remove the following override from modify the implementation of the isMM2InternalTopic method in the DefaultReplicationPolicy, as the default implementation in the interface checks if the topic ends with "internal" and ignore the separator, even if a custom one is usedto include the configurable internal suffix:

Code Block
languagejava
titleDefaultReplicationPolicy
public class DefaultReplicationPolicy implements ReplicationPolicy, Configurable { 
    ...

      

 // Remove
    @Override@Override
    public boolean isMM2InternalTopic(String topic) {
        return topic.startsWith("mm2") && topic.endsWith(internalSuffix()) || isCheckpointsTopic(topic);
    }    
}


Compatibility, Deprecation, and Migration Plan

...