RabbitMq使用总结

RabbitMq使用总结:

一: rabbitMq相关的介绍:

镇楼的官网:https://www.rabbitmq.com

RabbitMq使用总结_第1张图片

RabbitMq使用总结_第2张图片

RabbitMq使用总结_第3张图片

RabbitMq使用总结_第4张图片

https://www.cnblogs.com/xiangyuqi/p/8603993.html

概念介绍:https://www.jianshu.com/p/3ba4c1883c3d

RabbitMQ的基础介绍:https://www.cnblogs.com/bigberg/p/8136201.html

RabbitMQ消息确认机制之Confirm模式总结:https://blog.csdn.net/Weixiaohuai/article/details/94961012

确认机制:https://my.oschina.net/u/1860901/blog/968273/print

Spring-rabbit 说明文档:https://my.oschina.net/u/1045177/blog/408656

RabbitMQ注解方式配置说明:https://blog.csdn.net/zh350229319/article/details/52230674/

二:项目使用总结,先来一个坑,测试环境没问题,到了线上出问题,报下面的错:

RabbitMQ异常注意 reply-code=404, reply-text=NOT_FOUND - no exchange 'topic' in vhost '/', class-id=50, method-id=

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method(reply-code=404, reply-text=NOT_FOUND - no queue 'album.free.topaid.transcode.success..queue' in vhost '/', class-id=50, method-id=20)

1.看到这个报错,第一想到的是,应该是queue没有创建,一般测试环境都是设置的默认自动创建,仿真和线上是运维人员创建,那就找运维人员确认下,是不是创建了,创建的类型对不对,对下queue的名称,type类型是fanout还是topic,确认几个属性,auto-declare="true" auto-delete="false" durable="true" exclusive="false"是否一致,一般auto-declare="true"是不配置的,其他是默认的,确认了这些都没问题,陷入坑里了,什么原因那;

2.会不会是创建好的queue被服务再次重申覆盖,或者声明的有问题;这时候想到declared-by="admin"这个属性,在有多个admin的情况下exchange以及queue都需要声明是哪个管理的,原因找到了,测试和仿真没有问题是因为这两个环境,多个admin地址都是同一个,线上却是多个,在有多个地址的时候,不能确认是哪个admin管理的。

3.可能报403,406,530等,这些可以根据报错直接看出问题,比如

530:connection error; protocol method: #method(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'kumas', class-id=10, method-id=40)

说明:账户kumas没有对 “/” 的权限,在 mq 管理页面上添加权限即可

406:com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'test_data' in vhost '/': received 'true' but current is 'false', class-id=50, method-id=10

翻译过来就是exchange的durable已经true了不能改为false。所以使用的时候要注意如果exchange和queue的durable已经定义好了是不能更改的。除非客户端删掉exchange,queue然后重新启动。

RabbitMQ Cluster 常见错误码原因与解决办法:https://www.jianshu.com/p/1c4c42ff5114

下面是一个服务里配置的2个mq地址:

application-rabbitmq-context-v2.xml:












        
        
        
                
        



        


application-rabbitmq-context.xml:
















    
        
    


    






    
        
    


    






    
        
    


    

你可能感兴趣的:(MQ,rabbitMq,eply-code=404,reply-text=NOT_)