lizhiboo commented on a change in pull request #800: URL: https://github.com/apache/rocketmq-externals/pull/800#discussion_r704183604
########## File path: rocketmq-connect-hudi/src/main/java/org/apache/rocketmq/connect/hudi/connector/HudiSinkTask.java ########## @@ -0,0 +1,124 @@ + +/* + * 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.rocketmq.connect.hudi.connector; + +import io.openmessaging.KeyValue; +import io.openmessaging.connector.api.common.QueueMetaData; +import io.openmessaging.connector.api.data.SinkDataEntry; +import io.openmessaging.connector.api.sink.SinkTask; +import org.apache.rocketmq.connect.hudi.config.HudiConnectConfig; +import org.apache.rocketmq.connect.hudi.config.ConfigUtil; +import org.apache.rocketmq.connect.hudi.sink.Updater; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + + +/** + * In the naming, we are using database for "keyspaces" and table for "columnFamily" + * This is because we kind of want the abstract data source to be aligned with SQL databases + */ +public class HudiSinkTask extends SinkTask { + private static final Logger log = LoggerFactory.getLogger(HudiSinkTask.class); + + private HudiConnectConfig hudiConnectConfig; + private Updater updater; + private BlockingQueue<Updater> tableQueue = new LinkedBlockingQueue<Updater>(); + + public HudiSinkTask() { + this.hudiConnectConfig = new HudiConnectConfig(); + } + + @Override + public void put(Collection<SinkDataEntry> sinkDataEntries) { + try { + if (tableQueue.size() > 1) { + updater = tableQueue.poll(1000, TimeUnit.MILLISECONDS); Review comment: done -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
