[ https://issues.apache.org/jira/browse/KAFKA-4125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15822837#comment-15822837 ]
Guozhang Wang edited comment on KAFKA-4125 at 1/14/17 3:38 PM: --------------------------------------------------------------- Thanks for bringing this up [~mjsax]. I do agree that we have multiple API discussions spread in different places now. Maybe you can create a wiki in AK summarizing all those proposals and we can then discuss them together and perhaps propose a single KIP wrapping them all? Current ones I can think of are: 1. Rich functions. 2. Add {{key}} to {{mapValues}} / {{transformValues}}. 3. Add {{flatTransform}} and {{flatTransformValues}}. 4. Separate {{RecordContext}} from {{ProcessorContext}}. 5. Deprecate not user-facing functions from {{TopologyBuilder}}. 6. Remove {{loggingEnabled}} parameter in {{ProcessorContext.register}}. 7. Remove {{disableLogging}} from {{Stores}}. 8. Change return type of {{Transfomer.punctuate()}} from {{R}} to {{null}}. was (Author: guozhang): Thanks for bringing this up [~mjsax]. I do agree that we have multiple API discussions spread in different places now. Maybe you can create a wiki in AK summarizing all those proposals and we can then discuss them together and perhaps propose a single KIP wrapping them all? Current ones I can think of are: 1. Rich functions. 2. Add {{key}} to {{mapValues}} / {{transformValues}}. 3. Add {{flatTransform}} and {{flatTransformValues}}. 4. Separate {{RecordContext}} from {{ProcessorContext}}. 5. Deprecate not user-facing functions from {{TopologyBuilder}}. 6. Remove {{loggingEnabled}} parameter in {{ProcessorContext.register}}. 7. Remove {{disableLogging}} from {{Stores}}. > Provide low-level Processor API meta data in DSL layer > ------------------------------------------------------ > > Key: KAFKA-4125 > URL: https://issues.apache.org/jira/browse/KAFKA-4125 > Project: Kafka > Issue Type: Sub-task > Components: streams > Reporter: Matthias J. Sax > Assignee: Bill Bejeck > Priority: Minor > > For Processor API, user can get meta data like record offset, timestamp etc > via the provided {{Context}} object. It might be useful to allow uses to > access this information in DSL layer, too. > The idea would be, to do it "the Flink way", ie, by providing > RichFunctions; {{mapValue()}} for example. > Is takes a {{ValueMapper<V1, V2>}} that only has method > {noformat} > V2 apply(V1 value); > {noformat} > Thus, you cannot get any meta data within apply (it's completely "blind"). > We would add two more interfaces: {{RichFunction}} with a method > {{open(Context context)}} and > {noformat} > RichValueMapper<V1, V2> extends ValueMapper<V1, V2>, RichFunction > {noformat} > This way, the user can chose to implement Rich- or Standard-function and > we do not need to change existing APIs. Both can be handed into > {{KStream.mapValues()}} for example. Internally, we check if a Rich > function is provided, and if yes, hand in the {{Context}} object once, to > make it available to the user who can now access it within {{apply()}} -- or > course, the user must set a member variable in {{open()}} to hold the > reference to the Context object. -- This message was sent by Atlassian JIRA (v6.3.4#6332)