1 图解
![](https://img.haomeiwen.com/i3879083/2923bb148a21bf0c.png)
2 代码
url:
https://github.com/3748/RabbitMq.git
package:
com.test.rabbitmq.simple
3 代码介绍
3.1 引入必须依赖
pom.xml
3.2 获取MQ连接
com.test.rabbitmq.util.ConnectionUtil
3.3 消息生产者
com.test.rabbitmq.simple.SimpleProducer
3.4 启动生产者
3.5 消息消费者
com.test.rabbitmq.simple.SimpleConsumer
3.6 启动消费者
消费者获取到消息,此时队列会将消息删除
4 应用场景
聊天
5 缺点
消息可能没有被消费者正确处理,已经从队列中消失,造成消息的丢失
网友评论