Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-11153][Manager] Fix the problem of HTTP sink does not automatically allocate sort cluster #11155

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}

}
Loading