chestnut-c commented on code in PR #8155: URL: https://github.com/apache/inlong/pull/8155#discussion_r1217621016
########## inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/extract/PulsarFactory.java: ########## @@ -0,0 +1,81 @@ +/* + * 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.manager.pojo.sort.node.extract; + +import org.apache.inlong.manager.pojo.sort.node.ExtractNodeFactory; +import org.apache.inlong.manager.pojo.source.pulsar.PulsarSource; +import org.apache.inlong.manager.pojo.stream.StreamNode; +import org.apache.inlong.sort.protocol.FieldInfo; +import org.apache.inlong.sort.protocol.enums.PulsarScanStartupMode; +import org.apache.inlong.sort.protocol.node.ExtractNode; +import org.apache.inlong.sort.protocol.node.extract.PulsarExtractNode; +import org.apache.inlong.sort.protocol.node.format.Format; + +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Map; + +/** + * The Factory for creating Pulsar extract nodes. + */ +public class PulsarFactory extends ExtractNodeFactory { + + /** + * Create Pulsar extract node + * + * @param streamNodeInfo Pulsar source info + * @return Pulsar extract node info + */ + @Override + public ExtractNode createNode(StreamNode streamNodeInfo) { + PulsarSource pulsarSource = (PulsarSource) streamNodeInfo; + List<FieldInfo> fieldInfos = parseFieldInfos(pulsarSource.getFieldList(), pulsarSource.getSourceName()); + Map<String, String> properties = parseProperties(pulsarSource.getProperties()); + + String fullTopicName = + pulsarSource.getTenant() + "/" + pulsarSource.getNamespace() + "/" + pulsarSource.getTopic(); + + Format format = KafkaFactory.parsingFormat(pulsarSource.getSerializationType(), Review Comment: > `PulsarFactory` why use `KafkaFactory.parsingFormat`? It has been modified ########## inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sort/node/NodeProducer.java: ########## @@ -0,0 +1,93 @@ +/* + * 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.manager.pojo.sort.node; + +import org.apache.inlong.manager.common.consts.SourceType; +import org.apache.inlong.manager.pojo.sort.node.extract.HudiFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.KafkaFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.MongoFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.MysqlBinlogFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.OracleFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.PostgreSqlFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.PulsarFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.RedisFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.SqlServerFactory; +import org.apache.inlong.manager.pojo.sort.node.extract.TubeMqFactory; +import org.apache.inlong.manager.pojo.source.StreamSource; +import org.apache.inlong.manager.pojo.stream.StreamNode; +import org.apache.inlong.sort.protocol.node.ExtractNode; + +import com.google.common.collect.Lists; +import org.apache.commons.collections.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * The ExtractNode producer. + */ +public class NodeProducer { Review Comment: > Why not just call it `NodeFactory`, or `NodeProvider`? Producer more likes a concept in MQ. It has been modified -- 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]
