refactor(mq): 拆分交换器并新增brotherSend方法

- 新增 AI_CHAT_EXCHANGE_NAME、BIG_BROTHER_EXCHANGE_NAME 两个HeadersExchange
- MQSender 新增 brotherSend 方法,支持按 tenantId 路由到大佬队列
- ServerBigBrotherServiceImpl 在保存/更新后,若 Redis 标记存在则异步发送消息
- 移除 HostInfoServiceImpl 多余空行,保持代码整洁
This commit is contained in:
2025-11-10 20:43:43 +08:00
parent b82dbacfee
commit 4d20448b82
4 changed files with 47 additions and 2 deletions

View File

@@ -22,6 +22,9 @@ public class RabbitMQConfig {
public static final String EXCHANGE_NAME = "user.headers.exchange";
public static final String AI_CHAT_EXCHANGE_NAME = "ai.chat.headers.exchange";
public static final String BIG_BROTHER_EXCHANGE_NAME = "big.brother.headers.exchange";
//创建队列
//true:表示持久化
//队列在默认情况下放到内存rabbitmq重启后就丢失了如果希望重启后队列
@@ -46,6 +49,21 @@ public class RabbitMQConfig {
.build();
}
@Bean
public HeadersExchange aiChatHeadersExchange() {
return ExchangeBuilder.headersExchange(AI_CHAT_EXCHANGE_NAME)
.durable(true)
.build();
}
@Bean
public HeadersExchange bigBrotherHeadersExchange() {
return ExchangeBuilder.headersExchange(BIG_BROTHER_EXCHANGE_NAME)
.durable(true)
.build();
}
@Bean
public RabbitAdmin rabbitAdmin(ConnectionFactory cf) {
return new RabbitAdmin(cf);