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



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

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

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

最新更新