This is an automated email from the ASF dual-hosted git repository.

aloyszhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new c60a4c49d4 [INLONG-11153][Manager] Fix the problem of HTTP sink does 
not automatically allocate sort cluster (#11155)
c60a4c49d4 is described below

commit c60a4c49d4e2d6c939db0ca2c7e2b1b6dfa95a71
Author: fuweng11 <76141879+fuwen...@users.noreply.github.com>
AuthorDate: Tue Oct 8 14:06:28 2024 +0800

    [INLONG-11153][Manager] Fix the problem of HTTP sink does not automatically 
allocate sort cluster (#11155)
---
 .../inlong/manager/common/consts/SinkType.java     |  1 +
 .../resource/sink/http/HttpResourceOperator.java   | 57 ++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
index 16a1bfd3d8..45241383c1 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/SinkType.java
@@ -91,6 +91,7 @@ public class SinkType extends StreamType {
     public static final Set<String> SORT_STANDALONE_SINK = new HashSet<>();
 
     static {
+        SINK_TO_CLUSTER.put(HTTP, ClusterType.SORT_HTTP);
         SINK_TO_CLUSTER.put(CLS, ClusterType.SORT_CLS);
         SINK_TO_CLUSTER.put(ES, ClusterType.SORT_ES);
         SINK_TO_CLUSTER.put(PULSAR, ClusterType.SORT_PULSAR);
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/http/HttpResourceOperator.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/http/HttpResourceOperator.java
new file mode 100644
index 0000000000..eb73b4afdc
--- /dev/null
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/http/HttpResourceOperator.java
@@ -0,0 +1,57 @@
+/*
+ * 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.resource.sink.http;
+
+import org.apache.inlong.manager.common.consts.InlongConstants;
+import org.apache.inlong.manager.common.consts.SinkType;
+import org.apache.inlong.manager.common.enums.SinkStatus;
+import org.apache.inlong.manager.pojo.sink.SinkInfo;
+import 
org.apache.inlong.manager.service.resource.sink.AbstractStandaloneSinkResourceOperator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * Http resource operate for creating http resource
+ */
+@Service
+public class HttpResourceOperator extends 
AbstractStandaloneSinkResourceOperator {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(HttpResourceOperator.class);
+
+    @Override
+    public Boolean accept(String sinkType) {
+        return SinkType.HTTP.equals(sinkType);
+    }
+
+    @Override
+    public void createSinkResource(SinkInfo sinkInfo) {
+        LOG.info("begin to create sink resources sinkId={}", sinkInfo.getId());
+        if 
(InlongConstants.DISABLE_CREATE_RESOURCE.equals(sinkInfo.getEnableCreateResource()))
 {
+            LOG.warn("create resource was disabled, skip to create for [" + 
sinkInfo.getId() + "]");
+            return;
+        } else if 
(SinkStatus.CONFIG_SUCCESSFUL.getCode().equals(sinkInfo.getStatus())) {
+            LOG.warn("sink resource [" + sinkInfo.getId() + "] already 
success, skip to create");
+            return;
+        }
+        this.checkTaskAndConsumerGroup(sinkInfo);
+        this.assignCluster(sinkInfo);
+    }
+
+}

Reply via email to