RabbitMQ整合SpringBoot
一.RabbitMQ整合SpringBoot(手动ack)
1.创建SpringBoot工程
2.导入依赖
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
3.编写配置文件
application.yml
spring: rabbitmq: host: 192.168.247.128 port: 5672 username: root password: 123 virtual-host: /root listener: simple: acknowledge-mode