使用Spring RabbitMessagingTemplate发布消息时验证交换,路由密钥

问题描述 投票:1回答:1

有没有办法在使用RabbitMessagingTemplate发送消息时验证交换和路由密钥/队列?目前,有一个默认的交换和路由键,它是空字符串,并且没有抛出错误。

messagingTemplate.convertAndSend(message.getExchange(), message.getRoutingKey(), message.getPayload());
spring rabbitmq amqp spring-amqp spring-rabbitmq
1个回答
2
投票

请参阅返回并确认回调:https://docs.spring.io/spring-amqp/docs/2.1.2.RELEASE/reference/html/_reference.html#template-confirms。因此,如果路由密钥上的交换或队列有任何问题,您将返回带有错误的消息

© www.soinside.com 2019 - 2024. All rights reserved.