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 the that 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(); }
Compatibility, Deprecation, and Migration Plan
No known compatibility issues.