dlg99 commented on a change in pull request #9927: URL: https://github.com/apache/pulsar/pull/9927#discussion_r597335899
########## File path: pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/PulsarKafkaConnectSinkConfig.java ########## @@ -0,0 +1,100 @@ +/** + * 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.pulsar.io.kafka.connect; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.util.Map; +import org.apache.pulsar.io.core.annotations.FieldDoc; + +@Data +@Accessors(chain = true) +public class PulsarKafkaConnectSinkConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + @FieldDoc( + defaultValue = "1", + help = "The batch size that Kafka producer will attempt to batch records together.") + private int batchSize = 1; Review comment: In kafka producer the batch size is 16384 *bytes* by default. Here it is number of messages the sink processes before flush. It is safer to set it to 1 and let user adjust it based on the VM size/type of kafka connect sink etc to avoid OOM or long delays between flushes. I don't serialize the data before passing it to the kafka connect sink, and .getMessage() (that can get byte[]) is 1. optional and 2. potentially copies data internally. I'll adjust the help message. -- 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]
