Java项目《谷粒商城》架构师级Java项目实战,对标阿里P6-P7,全网最强
总时长 104:45:00 共408P
此文章包含第258p-第p261的内容
消息确认
生产者 publishers
消费者 consumers


设置配置类
调用api
控制台
抵达brocker 代理



新版本ReturnCallback已弃用,可以这么写:rabbitTemplate.setReturnsCallback(System.out::println);
有这个方法,没过时啊,只是封装到了ReturnedMessage
投递到队列失败时才会回调
消费端确认机制


自动ack(危险,容易丢失数据)
手动dck(推荐开启)

如果通道中断(宕机等),消息会变成ready状态,通道打开为ack的时候会进入 unacked状态
进行ack 然后不是批量的签收 只ack自己
这里无法模拟真正宕机 所以其他的方法也运行了
IDEA还是会把进程走完,应该用 kill -9 pid 才能模拟服务器宕机
要想模拟真实的宕机,用netstat找出9000端口的进程,用taskkill杀掉进程
basicNack()的三个参数 id,是否批量拒绝,是否重新入队
重新入队后 还会进行投递,所以这里的数据变为了0
接收方法:开启手工模式

这里等订单模块需要的时候再进行详解