日志记录提交
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
package com.baiyue.common.audit;
|
||||
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 审计 Outbox 的 RocketMQ 发布配置。
|
||||
* 该配置与基础审计配置隔离:未引入 RocketMQ 的服务仍可使用 HTTP 审计投递。
|
||||
*/
|
||||
@AutoConfiguration(after = BaiyueAuditAutoConfiguration.class)
|
||||
@EnableScheduling
|
||||
@ConditionalOnClass(name = "org.apache.rocketmq.spring.core.RocketMQTemplate")
|
||||
@ConditionalOnBean(type = {
|
||||
"com.baiyue.common.audit.AuditOutboxRepository",
|
||||
"org.apache.rocketmq.spring.core.RocketMQTemplate"
|
||||
})
|
||||
@ConditionalOnProperty(prefix = "baiyue.audit.outbox", name = "publisher-enabled", havingValue = "true")
|
||||
public class AuditOutboxRocketMqAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
AuditOutboxPublisher auditOutboxPublisher(AuditOutboxRepository repository,
|
||||
RocketMQTemplate rocketMQ,
|
||||
AuditProperties properties,
|
||||
@Value("${spring.application.name:unknown}-${random.uuid}") String owner) {
|
||||
return new AuditOutboxPublisher(repository, rocketMQ, properties, owner);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user