From c37b1dce39d7959117d3d4c34bc614874383ef4c Mon Sep 17 00:00:00 2001 From: yaoxuwan Date: Thu, 26 Dec 2024 11:18:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20nodeUpdateAccessDateEventConsumer?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=88=B0common-metadata=20#2879?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metadata/MetadataAutoConfiguration.kt | 14 +++++ .../config/RepositoryConsumerConfig.kt | 53 ------------------- 2 files changed, 14 insertions(+), 53 deletions(-) delete mode 100644 src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/config/RepositoryConsumerConfig.kt diff --git a/src/backend/common/common-metadata/metadata-service/src/main/kotlin/com/tencent/bkrepo/common/metadata/MetadataAutoConfiguration.kt b/src/backend/common/common-metadata/metadata-service/src/main/kotlin/com/tencent/bkrepo/common/metadata/MetadataAutoConfiguration.kt index 7a66eb1c49..38772b1d7f 100644 --- a/src/backend/common/common-metadata/metadata-service/src/main/kotlin/com/tencent/bkrepo/common/metadata/MetadataAutoConfiguration.kt +++ b/src/backend/common/common-metadata/metadata-service/src/main/kotlin/com/tencent/bkrepo/common/metadata/MetadataAutoConfiguration.kt @@ -32,10 +32,12 @@ import com.tencent.bkrepo.auth.api.ServicePermissionClient import com.tencent.bkrepo.auth.api.ServiceUserClient import com.tencent.bkrepo.common.api.pojo.ClusterArchitecture import com.tencent.bkrepo.common.api.pojo.ClusterNodeType +import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent import com.tencent.bkrepo.common.artifact.properties.ArtifactEventProperties import com.tencent.bkrepo.common.artifact.properties.RouterControllerProperties import com.tencent.bkrepo.common.metadata.condition.SyncCondition import com.tencent.bkrepo.common.metadata.config.RepositoryProperties +import com.tencent.bkrepo.common.metadata.listener.NodeUpdateAccessDateEventListener import com.tencent.bkrepo.common.metadata.permission.EdgePermissionManager import com.tencent.bkrepo.common.metadata.permission.PermissionManager import com.tencent.bkrepo.common.metadata.permission.ProxyPermissionManager @@ -55,6 +57,8 @@ import org.springframework.context.annotation.Bean import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Conditional import org.springframework.context.annotation.Configuration +import org.springframework.messaging.Message +import java.util.function.Consumer @Configuration @ConditionalOnWebApplication @@ -136,4 +140,14 @@ class MetadataAutoConfiguration { principalManager = principalManager ) } + + // 之前继承Consumer方式框架升级后会报错,https://github.com/spring-cloud/spring-cloud-stream/issues/2704 + @Bean("nodeUpdateAccessDate") + fun nodeUpdateAccessDateEventConsumer( + nodeUpdateAccessDateEventListener: NodeUpdateAccessDateEventListener + ): Consumer> { + return Consumer { + nodeUpdateAccessDateEventListener.accept(it) + } + } } diff --git a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/config/RepositoryConsumerConfig.kt b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/config/RepositoryConsumerConfig.kt deleted file mode 100644 index 239f534c78..0000000000 --- a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/config/RepositoryConsumerConfig.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. - * - * Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved. - * - * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. - * - * A copy of the MIT License is included in this file. - * - * - * Terms of the MIT License: - * --------------------------------------------------- - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.tencent.bkrepo.repository.config - -import com.tencent.bkrepo.common.artifact.event.base.ArtifactEvent -import com.tencent.bkrepo.common.metadata.listener.NodeUpdateAccessDateEventListener -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.messaging.Message -import java.util.function.Consumer - -@Configuration -class RepositoryConsumerConfig { - - // 之前继承Consumer方式框架升级后会报错,https://github.com/spring-cloud/spring-cloud-stream/issues/2704 - @Bean("nodeUpdateAccessDate") - fun nodeUpdateAccessDateEventConsumer( - nodeUpdateAccessDateEventListener: NodeUpdateAccessDateEventListener - ): Consumer> { - return Consumer { - nodeUpdateAccessDateEventListener.accept(it) - } - } -}