refactor(mq): 拆分交换器并新增brotherSend方法
- 新增 AI_CHAT_EXCHANGE_NAME、BIG_BROTHER_EXCHANGE_NAME 两个HeadersExchange - MQSender 新增 brotherSend 方法,支持按 tenantId 路由到大佬队列 - ServerBigBrotherServiceImpl 在保存/更新后,若 Redis 标记存在则异步发送消息 - 移除 HostInfoServiceImpl 多余空行,保持代码整洁
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user