TyrantLucifer commented on code in PR #4364:
URL:
https://github.com/apache/incubator-seatunnel/pull/4364#discussion_r1141252666
##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSource.java:
##########
@@ -186,6 +189,24 @@ public void prepare(Config config) throws
PrepareFailException {
this.metadata.getProperties().put(key,
value.unwrapped()));
}
+ if (config.hasPath(MESSAGE_FORMAT_ERROR_HANDLE_WAY_OPTION.key())) {
+ MessageFormatErrorHandleWay formatErrorWayOption =
+
ReadonlyConfig.fromConfig(config).get(MESSAGE_FORMAT_ERROR_HANDLE_WAY_OPTION);
+ switch (formatErrorWayOption) {
+ case FAIL:
+ case SKIP:
+ this.messageFormatErrorHandleWay = formatErrorWayOption;
+ break;
+ default:
+ throw new PrepareFailException(
Review Comment:
throw new KafkaConnectorException, seatunnel unified exception in
connectors. You can refer to
https://github.com/apache/incubator-seatunnel/issues/3043 see more details.
##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSource.java:
##########
@@ -186,6 +189,24 @@ public void prepare(Config config) throws
PrepareFailException {
this.metadata.getProperties().put(key,
value.unwrapped()));
}
+ if (config.hasPath(MESSAGE_FORMAT_ERROR_HANDLE_WAY_OPTION.key())) {
+ MessageFormatErrorHandleWay formatErrorWayOption =
+
ReadonlyConfig.fromConfig(config).get(MESSAGE_FORMAT_ERROR_HANDLE_WAY_OPTION);
+ switch (formatErrorWayOption) {
+ case FAIL:
+ case SKIP:
+ this.messageFormatErrorHandleWay = formatErrorWayOption;
+ break;
+ default:
+ throw new PrepareFailException(
+ getPluginName(),
+ PluginType.SOURCE,
+ "Unsupported message format error handle way: " +
formatErrorWayOption);
+ }
+ } else {
Review Comment:
Remove this logic
##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSource.java:
##########
@@ -83,6 +85,7 @@
private SeaTunnelRowType typeInfo;
private JobContext jobContext;
private long discoveryIntervalMillis =
KEY_PARTITION_DISCOVERY_INTERVAL_MILLIS.defaultValue();
+ private MessageFormatErrorHandleWay messageFormatErrorHandleWay;
Review Comment:
```suggestion
private MessageFormatErrorHandleWay messageFormatErrorHandleWay =
MessageFormatErrorHandleWay.FAIL;
```
--
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]