springBoot连接rabbitMQ

springBoot连接rabbitMQ

十月 24, 2018

上篇文章讲述了安装rabbitmq的过程,下面介绍一下springBoot连接rabbitmq。

首先引入dependence:

1
2
3
4
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

连接配置:

1
2
3
4
5
6
7
8
# rabbitMQ
spring.rabbitmq.username=rudy
spring.rabbitmq.password=124512
spring.rabbitmq.host=ip
spring.rabbitmq.port=5672
spring.rabbitmq.virtual-host=/
# 手动ACK 默认 none
spring.rabbitmq.listener.simple.acknowledge-mode=manual
查看评论