咱们选择基于Spring-Rabbit去操做RabbitMQ
https://github.com/spring-projects/spring-amqp
使用spring-boot-starter-amqp会自动添加spring-rabbit依赖,以下:git
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring‐boot‐starter‐amqp</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring‐boot‐starter‐test</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring‐boot‐starter‐logging</artifactId> </dependency>
加入引用的包
刷新一下包
消费者也加入包的引用
github
把springboot的日志文件拷贝过来。从cms的工程复制过来的
定义包
建立配置文件类
spring
再把生产者的整个的包复制到消费者里面
springboot