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

feat: 引擎等MQ场景接入SCS框架 #7443 #11131

Merged
merged 1 commit into from
Oct 25, 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 @@ -29,10 +29,11 @@ package com.tencent.devops.auth.common

import com.tencent.devops.auth.filter.BlackListAspect
import com.tencent.devops.auth.refresh.dispatch.AuthRefreshDispatch
import com.tencent.devops.auth.refresh.event.RefreshBroadCastEvent
import com.tencent.devops.auth.refresh.event.ManagerOrganizationChangeEvent
import com.tencent.devops.auth.refresh.event.ManagerUserChangeEvent
import com.tencent.devops.auth.refresh.event.StrategyUpdateEvent
import com.tencent.devops.auth.refresh.listener.AuthRefreshEventListener
import com.tencent.devops.auth.service.AuthUserBlackListService
import com.tencent.devops.auth.service.UserPermissionService
import com.tencent.devops.common.event.annotation.EventConsumer
import com.tencent.devops.common.stream.ScsConsumerBuilder
import org.springframework.beans.factory.annotation.Autowired
Expand All @@ -46,17 +47,20 @@ class AuthCoreConfiguration {
@Bean
fun refreshDispatch(streamBridge: StreamBridge) = AuthRefreshDispatch(streamBridge)

@Bean
fun authRefreshEventListener(
@Autowired userPermissionService: UserPermissionService
) = AuthRefreshEventListener(
userPermissionService = userPermissionService
)
@EventConsumer(true)
fun managerChangeConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<ManagerOrganizationChangeEvent> { refreshListener.execute(it) }

@EventConsumer(true)
fun managerUserChangeConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<ManagerUserChangeEvent> { refreshListener.execute(it) }

@EventConsumer(true)
fun refreshBroadCastConsumer(
fun strategyUpdateConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<RefreshBroadCastEvent> { refreshListener.execute(it) }
) = ScsConsumerBuilder.build<StrategyUpdateEvent> { refreshListener.execute(it) }

@Bean
fun blackListAspect(authUserBlackListService: AuthUserBlackListService) = BlackListAspect(authUserBlackListService)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.ManagerChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_MANGER_CHANGE_FANOUT)
data class ManagerOrganizationChangeEvent(
override val refreshType: String,
override var retryCount: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.UserChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_MANGER_USER_CHANGE_FANOUT)
data class ManagerUserChangeEvent(
override val refreshType: String,
val userChangeType: UserChangeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@

package com.tencent.devops.auth.refresh.event

import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.event.pojo.IEvent
import com.tencent.devops.common.service.trace.TraceTag
import com.tencent.devops.common.stream.constants.StreamBinding
import org.slf4j.MDC

@Event(StreamBinding.AUTH_REFRESH_FANOUT)
open class RefreshBroadCastEvent(
open val refreshType: String,
open var retryCount: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.StrategyChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_STRATEGY_UPDATE_FANOUT)
data class StrategyUpdateEvent(
override val refreshType: String,
override var retryCount: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ object StreamBinding {
const val GIT_WEBHOOK_UNLOCK_EVENT = "webhook.unlock.event"

// 蓝盾管理员
const val AUTH_REFRESH_FANOUT = "auth.refresh.exchange.fanout"
const val AUTH_MANGER_CHANGE_FANOUT = "auth.manager.change.fanout"
const val AUTH_MANGER_USER_CHANGE_FANOUT = "auth.manager.user.change.fanout"
const val AUTH_STRATEGY_UPDATE_FANOUT = "auth.strategy.update.fanout"

// 流水线webhook commit记录
const val PIPELINE_BUILD_COMMIT_FINISH_FANOUT = "engine.pipeline.build.commits.finish.fanout"
Expand Down Expand Up @@ -204,4 +206,4 @@ object StreamBinding {
const val PIPELINE_YAML_LISTENER_ENABLE = "pipeline.yaml.listener.enable"
const val PIPELINE_YAML_LISTENER_DISABLE = "pipeline.yaml.listener.disable"
const val PIPELINE_YAML_LISTENER_TRIGGER = "pipeline.yaml.listener.trigger"
}
}
Loading