nizhikov commented on a change in pull request #8909:
URL: https://github.com/apache/ignite/pull/8909#discussion_r638036783



##########
File path: 
modules/core/src/main/java/org/apache/ignite/cdc/ChangeDataCaptureConsumer.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.Iterator;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.cdc.ChangeDataCapture;
+import org.apache.ignite.lang.IgniteExperimental;
+import org.apache.ignite.resources.LoggerResource;
+
+/**
+ * Consumer of WAL data change events.
+ * This consumer will receive event of data changes during {@link 
ChangeDataCapture} application invocation.
+ * Lifecycle of consumer is the following:
+ * <ul>
+ *     <li>Start of the consumer {@link #start()}.</li>
+ *     <li>Notification of the consumer by the {@link #onChange(Iterator)} 
call.</li>
+ *     <li>Stop of the consumer {@link #stop()}.</li>
+ * </ul>
+ *
+ * In case consumer implementation wants to user {@link IgniteLogger}, please, 
use, {@link LoggerResource} annotation:
+ * <pre> {@code
+ * public class ChangeDataCaptureConsumer implements ChangeDataCaptureConsumer 
{
+ *     @LoggerReource
+ *     private IgniteLogger log;
+ *
+ *     ...
+ * }
+ * }</pre>
+ *
+ * Note, consumption of the {@link ChangeDataCaptureEvent} will started from 
the last saved offset.
+ * Offset of consumptions is saved on the disk every time {@link 
#onChange(Iterator)} returns {@code true}.
+ *
+ * @see ChangeDataCapture
+ * @see ChangeDataCaptureEvent
+ * @see ChangeEventOrder
+ */
+@IgniteExperimental
+public interface ChangeDataCaptureConsumer {
+    /**
+     * Starts the consumer.
+     */
+    public void start();
+
+    /**
+     * Handles entry changes events.
+     * If this method return {@code true} then current offset will be stored 
and ongoing notifications after CDC application fail/restart
+     * will be started from it.
+     *
+     * @param events Entry change events.
+     * @return {@code True} if current offset should be saved on the disk to 
continue from it in case any failures or restart.
+     */
+    public boolean onChange(Iterator<ChangeDataCaptureEvent> events);

Review comment:
       "change stream", "onEvent", "readEvent" and some other variants.
   Renamed to `onEvents`




-- 
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]


Reply via email to