整合 Spring Boot
生产端
1、创建生产者 Spring Boot 工程
2、引入 starter
<!-- RabbitMQ 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
3、编写 yaml 配置,基本信息配置
4、定义交换机、队列、绑定关系的配置类
5、注入 RabbitTemplate,调用方法,完成消息发送
消费端
1、创建消费者 SpringBoot 工程
2、引入 starter
<!-- RabbitMQ 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
3、编写 yaml 配置,基本信息配置
4、定义监听类,使用 @RabbitListener 注解完成队列监听

浙公网安备 33010602011771号