nizhikov commented on a change in pull request #49: URL: https://github.com/apache/ignite-extensions/pull/49#discussion_r648061510
########## File path: modules/cdc-to-kafka-ext/src/main/java/org/apache/ignite/cdc/ChangeDataCaptureIgniteToKafka.java ########## @@ -0,0 +1,172 @@ +/* + * 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.ignite.cdc; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.cdc.conflictplugin.CacheVersionConflictResolverImpl; +import org.apache.ignite.internal.cdc.ChangeDataCapture; +import org.apache.ignite.internal.util.typedef.internal.CU; +import org.apache.ignite.resources.LoggerResource; +import org.apache.kafka.clients.producer.KafkaProducer; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.apache.kafka.clients.producer.RecordMetadata; + +/** + * Change Data Consumer that streams all data changes to Kafka topic. + * {@link ChangeDataCaptureEvent} spread across Kafka topic partitions with {@code {ignite_partition} % {kafka_topic_count}} formula. + * Consumer will just fail in case of any error during write. Fail of consumer will lead to the fail of {@code ignite-cdc} application. + * It expected that {@code ignite-cdc} will be configured for automatic restarts with the OS tool to failover temporary errors + * such as Kafka unavailability or network issues. + * + * If you have plans to apply written messages to the other Ignite cluster in active-active manner, + * e.g. concurrent updates of the same entry in other cluster is possible, + * please, be aware of {@link CacheVersionConflictResolverImpl} conflict resolved. + * Configuration of {@link CacheVersionConflictResolverImpl} can be found in {@link ChangeDataCaptureKafkaToIgnite} documentation. + * + * @see ChangeDataCapture + * @see ChangeDataCaptureKafkaToIgnite + * @see CacheVersionConflictResolverImpl + */ +public class ChangeDataCaptureIgniteToKafka implements ChangeDataCaptureConsumer { Review comment: > What role it has, what it do? `ChangeDataCaptureIgniteToKafka` - CDC consumer that stream change from Ignite to Kafka topic :) > It's a KafkaConsumer because it's consuming to Kafka. This class consumes FROM Ignite and produces TO Kafka :) -- 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]
