Spring Boot 集成 RabbitMQ 非常简单,如果只是简单的使用配置非常少,Spring Boot 提供了
spring-boot-starter-amqp
项目对消息各种支持。
简单使用
1、pom.xml 文件添加 spring-boot-starter-amqp
依赖
2、配置文件
配置 RabbitMQ 的安装地址、端口以及账户信息
3、队列配置
4、生产者
rabbitTemplate 是 Spring Boot 提供的默认实现
5、消费者
6、测试
注意:发送者和接收者的 queue name 必须一致,不然不能接收
参考资料:
https://blog.csdn.net/herry66/article/details/123422005
作者:Jeebiz 创建时间:2023-03-30 10:35
最后编辑:Jeebiz 更新时间:2025-04-24 19:00
最后编辑:Jeebiz 更新时间:2025-04-24 19:00