You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/09/02 00:33:22 UTC

[GitHub] [inlong] ciscozhou commented on a diff in pull request #5542: [INLONG-5302][Manager] Supports the extension of data consumption for different MQs

ciscozhou commented on code in PR #5542:
URL: https://github.com/apache/inlong/pull/5542#discussion_r961198067


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/consume/InlongConsumeServiceImpl.java:
##########
@@ -0,0 +1,223 @@
+/*
+ * 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.service.consume;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.inlong.manager.common.consts.InlongConstants;
+import org.apache.inlong.manager.common.enums.ConsumeStatus;
+import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
+import org.apache.inlong.manager.common.exceptions.BusinessException;
+import org.apache.inlong.manager.common.util.CommonBeanUtils;
+import org.apache.inlong.manager.common.util.Preconditions;
+import org.apache.inlong.manager.dao.entity.InlongConsumeEntity;
+import org.apache.inlong.manager.dao.mapper.InlongConsumeEntityMapper;
+import org.apache.inlong.manager.pojo.common.OrderFieldEnum;
+import org.apache.inlong.manager.pojo.common.OrderTypeEnum;
+import org.apache.inlong.manager.pojo.common.PageResult;
+import org.apache.inlong.manager.pojo.consume.InlongConsumeBriefInfo;
+import org.apache.inlong.manager.pojo.consume.InlongConsumeCountInfo;
+import org.apache.inlong.manager.pojo.consume.InlongConsumeInfo;
+import org.apache.inlong.manager.pojo.consume.InlongConsumePageRequest;
+import org.apache.inlong.manager.pojo.consume.InlongConsumeRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import static org.apache.inlong.manager.pojo.common.PageRequest.MAX_PAGE_SIZE;
+
+/**
+ * Inlong consume service layer implementation
+ */
+@Service
+public class InlongConsumeServiceImpl implements InlongConsumeService {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(InlongConsumeServiceImpl.class);
+
+    @Autowired
+    private InlongConsumeEntityMapper consumeMapper;
+    @Autowired
+    private InlongConsumeOperatorFactory consumeOperatorFactory;
+
+    @Override
+    public Integer save(InlongConsumeRequest request, String operator) {
+        LOGGER.debug("begin to save inlong consume={} by user={}", request, operator);
+        Preconditions.checkNotNull(request, "inlong consume request cannot be null");
+        Preconditions.checkNotNull(request.getTopic(), "inlong consume topic cannot be null");
+        String consumerGroup = request.getConsumerGroup();
+        Preconditions.checkNotNull(consumerGroup, "inlong consume topic cannot be null");
+        if (consumerGroupExists(consumerGroup, request.getId())) {
+            throw new BusinessException(String.format("consumer group %s already exist", consumerGroup));
+        }
+
+        //if (GroupStatus.notAllowedUpdate(curStatus)) {

Review Comment:
   removed



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org