Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13691

Rename target topic to custom name.

    XMLWordPrintableJSON

Details

    Description

      When I use mirrormaker it replicates the topics with different name, name of target is built based on

      sourceClusterAlias + separator + topic  

       

      implementation is here.

      Proposed improvement consist in:
      Adding new config property key: target.replication.policy.topic_map

      E.I. 

      source-> target.replication.policy.class= org.apache.kafka.connect.mirror.RenameTopicReplicationPolicy
      
      source->target.replication.policy.separator = .
      source->target.replication.policy.topic_map= SOURCER_TOPIC_A,DESTINATION_TOPIC_A; SOURCER_TOPIC_B,DESTINATION_TOPIC_B; 

      and add new RenameTopicReplicationPolicy which will be responsible to:
      1. override configure method load target.replication.policy.topic_map into a Map where Key is source topic name and value is target topic name 

       

       2. override formatRemoteTopic so the target topic name will be loaded based on config

      @Override
      public String formatRemoteTopic(String sourceClusterAlias, String topic) {
          String targetTopic = topicMap.containsKey(topic) ?  topicMap.get(topic) : topic ;
          return super.formatRemoteTopic(sourceClusterAlias,targetTopic);
      } 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ecararus Eugeniu Cararus
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified