You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Status

Current state"Under Discussion"

Discussion thread: here

JIRA: KAFKA-6966 

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

Motivation

In the new dynamic routing feature, there is no (easy) way to get back the topic name that the Sink writes to if it uses dynamic routing. By adding topicNameExtractor any client of a Sink node can get the class of the TopicNameExtractor used to extract the final topic that the Sink writes to.

Public Interfaces


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


	interface Sink extends Node {
	    String topic();

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


Proposed Changes

Add the above interface change and add the following to InternalTopologyBuilder.java.

@Override
public Class<? extends TopicNameExtractor> topicNameExtractor() {
    if (topicNameExtractor instanceof StaticTopicNameExtractor)
        return null;
    else
        return topicNameExtractor.getClass();
}

For the string description, output the topic name if dynamic routing is not used. Otherwise, output the toString value of the TopicNameExtractor. This allows for the user to provide a better description of the topic name extractor besides just its class name.

Compatibility, Deprecation, and Migration Plan

No known compatibility issues.

Rejected Alternatives


  • No labels