-
RabbitMQ是一个开源的消息代理和队列服务器,用来通过普通协议在完全不同的应用之间共享数据,RabbitMQ是使用Erlang语言来编写的,并且RabbitMQ是基于AMQP协议的。
开源、性能优秀,稳定性保障
与SpringAMQP完美的整合、API丰富
集群模式丰富,表达式配置,HA模式,镜像队列模型
保证数据不丢失的前提做到可靠性、可用性
AMQP全称:Advanced Message Queuing Protocal(高级消息队列)
查看全部 -
滴滴头条,美团都在用这个
可靠性投递
通过confirm模式
消息入库
ack
查看全部 -
2
查看全部 -
8
查看全部 -
ack手工签收
查看全部 -
手工签收必须依赖通道
分为消息体和消息头
手工签收有一个basicAck的响应
查看全部 -
1
查看全部 -
1
查看全部 -
路由规则
broker就是服务
查看全部 -
publisher-confirms 异步等待消息结果
查看全部 -
step1. 数据入库同时消息(msg)入库
step2.发送消息
step3.请求确认 confirm
step4.读取数据库msg消息修改状态status:1
step5.但发送消息网络中断,通过定时任务查询状态为status:0的消息
step6.抓取消息,重新投递
step7.最大尝试次数 3次 不能成功则状态修改为2。
查看全部 -
@Component
public class ContentInfoSender {
@Autowired
private RabbitTemplate rabbitTemplate;
public void sendContentInfo(ContentInfo contentInfo){
rabbitTemplate.convertAndSend(Constants.CONTENTEXCHANGE,Constants.CONTENTQUEUE + contentInfo.getMsgInfo().getAcceptUserId(),contentInfo);
}
}查看全部 -
<!--整合rabbitmq-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>rabbitmq:
host:
port: 5672
username:
password:
virtual-host:
connection-timeout:查看全部 -
课程总结
查看全部 -
RabbitMQ简介
查看全部
举报