0%

RabbitMQ汇总

BASIC KNOWLEDGE

网上的基础教程

https://blog.csdn.net/hellozpc/article/details/81436980

两个消息分发机制

  • Round-robin dispatch(轮训分发)
  • Fair dispatch(公平分发)

开启Browser后台界面管理插件

1
2
docker pull rabbitmq:management
docker run -d --hostname my-rabbit --name some-rabbit -p 15555:15672 rabbitmq:management

15555端口可以自定义

PROBLEM SOLUTION

guest取消本地登录限制

https://blog.csdn.net/shenhonglei1234/article/details/82745601

1
2
3
4
5
6
7
8
## 注意对应版本
vi /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.7/ebin/rabbit.app

将:{loopback_users, [<<”guest”>>]},
改为:{loopback_users, []},
原因:rabbitmq从3.3.0开始禁止使用guest/guest权限通过除localhost外的访问

service rabbitmq-server restart

org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)

默认基于tcp的连接端口是5672,详情可见rabbit.app配置文件里面的

1
{tcp_listeners, [5672]}

还要注意防火墙是否屏蔽端口。

cannot deserialize from Object value (no delegate- or property-based Creator)

不小心在POJO加了lombok的@AllArgsConstructor注解,这个方法会私有化无参构造器,导致序列化失败。

How to delete all messages from a Queue

https://www.cloudamqp.com/blog/2016-06-14_how_to_delete_all_messages_in_a_queue.html#mgmt_interface