Versions Compared

Key

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

Table of Contents

Status

Current state"Under DiscussionAccepted"

Discussion thread: here

JIRA: KAFKA-6966 

Release: 2.1

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

Code Block
languagejava
public interface TopologyDescription {
	// Other interfaces and variables within TopologyDescription are not shown here.

	interface Source extends Node {
		
	    	Set<String> topicstopicSet();

   		Pattern topicPattern();
	}	

	interface Sink extends Node {
	    String topic();

		// Add abstract method to return the TopicNameExtractor class in situations where dynamic routing is used.
		// Otherwise, return null.
    	TopicNameExtractor topicNameExtractor();
	}
}

...

Code Block
languagejava
public final static class Source extends AbstractNode implements TopologyDescription.Source {
	// Other methods and variables are not shown here


	@Override
	public String topics() {
    }

	@Override
	public Set<String> topicNamestopicSet() {
    	return topics;
	}

	@Override
	public Pattern topicPattern() {
    	return topicPattern;
	}
}


public final static class Sink extends AbstractNode implements TopologyDescription.Sink {
	// Other methods and variables are not shown here


	// Output the topic name if dynamic routing is not used. Otherwise, output the toString value of the TopicNameExtractor.
	@Override
	public TopicNameExtractor topicNameExtractor() {
    	if (topicNameExtractor instanceof StaticTopicNameExtractor) {
        	return null;
 		} else {
        	return topicNameExtractor;
		}
	}
}


Compatibility, Deprecation, and Migration Plan

No known compatibility issuesDeprecating topics() because it is no longer needed with the addition of topicSet(). In order to get the same functionality, a user can just call topicSet().toString().

Rejected Alternatives