becketqin commented on a change in pull request #8535: [FLINK-11693] Add KafkaSerializationSchema that uses ProducerRecord URL: https://github.com/apache/flink/pull/8535#discussion_r297784347
########## File path: flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/ContextAwareSerializationSchema.java ########## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.streaming.connectors.kafka; + +import org.apache.flink.annotation.PublicEvolving; + +/** + * An interface for {@link KafkaSerializationSchema KafkaSerializationSchemas} that need information + * about the context where the Kafka Producer is running along with information about the available + * partitions. + * + * <p>You only need to override the methods for the information that you need. However, {@link + * #getTargetTopic(Object)} is required because it is used to determine the available partitions. + */ +@PublicEvolving +public interface ContextAwareSerializationSchema<T> { Review comment: Does it make sense to name the class `KafkaContextAware`? If we do this, in the future, we can introduce a common `ContextAware` interface with setters for InstanceId, Parallelism and other common info. And the `ContextAware` may have multiple subclasses such as `HDFSContextAware`, `RedisContextAware`, etc. That change will be fully backwards compatible without any naming confusion. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
