今天使用RabbitMQ做数据下发操作,当在发送端声明了Exchange后
打开RabbitMQ的管理控制台,可以查看,其中已经创建了Exchange
但并没有Queue
接着运行接收端,发现以下错误,即406错误
错误信息是
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'durable' for exchange 'UpdateData.*' in vhost '/': received 'false' but current is 'true'", classId=40, methodId=10, cause=
错误的原因是, 当在发送端与接收端都声明同一个Exchange时(当然会有先后顺序),第一次创建Exchange没有问题,但第二次创建会有问题
解决方法是,在发送端暂时不需要声明Exchange,只在接收端声明Exchange就可以了
参考地址:https://blog.csdn.net/yy756127197/article/details/78142957
参考地址:https://blog.csdn.net/tuoxinquyu/article/details/81324720