sandynz commented on code in PR #27542:
URL: https://github.com/apache/shardingsphere/pull/27542#discussion_r1280483603
##########
kernel/data-pipeline/scenario/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/config/CDCClientConfiguration.java:
##########
@@ -35,14 +36,17 @@ public final class CDCClientConfiguration {
private final int port;
- private final Consumer<List<Record>> consumer;
+ private final Consumer<List<Record>> dataConsumer;
+
+ private final ExceptionHandler errorHandler;
Review Comment:
`errorHandler` naming is different with other places
##########
kernel/data-pipeline/scenario/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ResponseFuture.java:
##########
@@ -30,12 +35,15 @@
* Response future.
*/
@RequiredArgsConstructor
-@Getter
@Setter
+@Getter
Review Comment:
`Getter` and `Setter` ordering could be improved
##########
kernel/data-pipeline/scenario/cdc/client/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/client/example/Bootstrap.java:
##########
@@ -40,7 +41,7 @@ public static void main(final String[] args) {
// Pay attention to the time zone, to avoid the problem of incorrect
time zone, it is best to ensure that the time zone of the program is consistent
with the time zone of the database server
// TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
String address = "127.0.0.1";
- CDCClientConfiguration clientConfig = new
CDCClientConfiguration(address, 33071, records -> log.info("records: {}",
records));
+ CDCClientConfiguration clientConfig = new
CDCClientConfiguration(address, 33071, records -> log.info("records: {}",
records), new LoggerExceptionHandler());
Review Comment:
Since `ExceptionHandler` is in `CDCClientConfiguration`, could we supply
which type of request in handleXxx method parameter? so users could handle it
by different types
##########
kernel/data-pipeline/scenario/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/handler/ExceptionHandler.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.shardingsphere.data.pipeline.cdc.client.handler;
+
+import
org.apache.shardingsphere.data.pipeline.cdc.client.util.ServerErrorResult;
+
+/**
+ * Exception handler.
+ */
+public interface ExceptionHandler {
+
+ /**
+ * Handler server exception.
+ *
+ * @param result error result
+ */
+ void handlerServerException(ServerErrorResult result);
+
+ /**
+ * Handler socket exception.
+ *
+ * @param throwable throwable
+ */
+ void handlerSocketException(Throwable throwable);
Review Comment:
`handlerServerException` could be `handleServerException`. And also
`handlerSocketException`.
--
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]