1
votes

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());
1
That's what the AMQP spec says - unroutable messages are silently dropped; as @artem says, you need to enable returns to get an async notification of a failure to route.Gary Russell

1 Answers

2
votes

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