Skip to content

Commit

Permalink
feat: 引擎等MQ场景接入SCS框架 TencentBlueKing#7443
Browse files Browse the repository at this point in the history
  • Loading branch information
stubenhuang committed Oct 30, 2024
1 parent 79278a2 commit 25c1ab9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.tencent.devops.common.stream.config

import com.tencent.devops.common.event.dispatcher.SampleEventDispatcher
import com.tencent.devops.common.stream.config.interceptor.BkChannelInterceptor
import com.tencent.devops.common.stream.customizer.BkProducerMessageHandlerCustomizer
import org.springframework.cloud.stream.function.StreamBridge
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand All @@ -15,4 +16,7 @@ class CommonEventConfiguration {
@Bean
@GlobalChannelInterceptor
fun bkChannelInterceptor() = BkChannelInterceptor()

@Bean
fun bkProducerMessageHandlerCustomizer() = BkProducerMessageHandlerCustomizer()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.tencent.devops.common.stream.customizer

import org.slf4j.LoggerFactory
import org.springframework.cloud.stream.config.ProducerMessageHandlerCustomizer
import org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint

class BkProducerMessageHandlerCustomizer : ProducerMessageHandlerCustomizer<AmqpOutboundEndpoint> {
override fun configure(handler: AmqpOutboundEndpoint, destinationName: String) {
logger.info("handler customizer , destinationName: $destinationName , handler: ${handler.beanName}")
handler.rabbitTemplate?.isUsePublisherConnection = false // 生产者和消费者共享连接池, 提高性能
}

companion object {
private val logger = LoggerFactory.getLogger(BkProducerMessageHandlerCustomizer::class.java)
}
}

0 comments on commit 25c1ab9

Please sign in to comment.