简体   繁体   中英

Validate exchange, routing key when publishing message using Spring RabbitMessagingTemplate

Is there a way to validate that the exchange and routing key/queue when sending message using RabbitMessagingTemplate? Currently, there is a default exchange and routing key which blank string and there's no error being thrown.

messagingTemplate.convertAndSend(message.getExchange(), message.getRoutingKey(), message.getPayload());

Please, see Returns and Confirms callback: https://docs.spring.io/spring-amqp/docs/2.1.2.RELEASE/reference/html/_reference.html#template-confirms . So, if there is anything wrong with exchange or queue on the routing key, you're going to have message returned with an error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM