justinwwhuang commented on code in PR #11354: URL: https://github.com/apache/inlong/pull/11354#discussion_r1802243086
########## inlong-sdk/dirty-data-sdk/src/main/java/org/apache/inlong/sdk/dirtydata/DirtyData.java: ########## @@ -0,0 +1,149 @@ +/* + * 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.inlong.sdk.dirtydata; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.Map; + +/** + * Dirty data base class, it is a wrapper of dirty data + */ +public class DirtyData { + + private static final String DIRTY_TYPE_KEY = "DIRTY_TYPE"; + + private static final String DIRTY_MESSAGE_KEY = "DIRTY_MESSAGE"; + private static final String SYSTEM_TIME_KEY = "SYSTEM_TIME"; + + private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + /** + * The identifier of dirty data, it will be used for filename generation of file dirty sink, + * topic generation of mq dirty sink, tablename generation of database, etc, + * and it supports variable replace like '${variable}'. + * There are several system variables[SYSTEM_TIME|DIRTY_TYPE|DIRTY_MESSAGE] are currently supported, + * and the support of other variables is determined by the connector. + */ + private final String identifier; + /** + * The labels of the dirty data, it will be written to store system of dirty + */ + private final String labels; + /** + * The log tag of dirty data, it is only used to format log as follows: + * [${logTag}] ${labels} ${data} + */ + private final String logTag; + /** + * Dirty type + */ + private final String dirtyType; + /** + * Dirty describe message, it is the cause of dirty data + */ + private final String dirtyMessage; + /** + * The real dirty data + */ + private final byte[] data; + + public DirtyData(byte[] data, String identifier, String labels, + String logTag, String dirtyType, String dirtyMessage) { + this.data = data; + this.dirtyType = dirtyType; + this.dirtyMessage = dirtyMessage; + Map<String, String> paramMap = genParamMap(); Review Comment: > it seems that paramMap is a useless param The following code is useful -- 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]
