时间:2024-9-1 作者:老大夫 分类: RabbitMQ
注意:备份交换机一定要选择fanout类型,因为原交换机转入备份交换机时并不会指定路由键
注意:这里是要和备份交换机绑定
public static final String EXCHANGE_DIRECT_BACKUP = "exchange.direct.order.backup";
public static final String QUEUE_NAME_BACKUP = "queue.order.backup";
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = QUEUE_NAME_BACKUP, durable = "true"),
exchange = @Exchange(value = EXCHANGE_DIRECT_BACKUP),
key = {""}
))
public void processMessageBackup(String dateString,
Message message,
Channel channel) {
log.info("BackUp: " + dateString);
}
·
推荐阅读:
RabbitMQ交换机类型
Operation007-SpringBoot
Operation019-Federation
Operation006-Topics
Operation018-Stream
Operation004-PubSub
Operation001-Install
Operation008-Confirm01-A-Producer生产者端消息确认机制
Operation020-Shovel
Operation005-Routing
行动消除疑虑