forked from apache/inlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INLONG-11153][Manager] Fix the problem of HTTP sink does not automat…
…ically allocate sort cluster (apache#11155)
- Loading branch information
1 parent
4917872
commit c5b9950
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../main/java/org/apache/inlong/manager/service/resource/sink/http/HttpResourceOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |