1 Star 0 Fork 0

YayiBoy / rabbitmq_demo

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

#项目描述:在springboot中使用RabbitMQ

##springboot中RabbitMQ自动配置原理
1、自动配置类RabbitAutoConfiguration:
Ⅰ、自动配置了连接工厂ConnectionFactory,通过RabbitProperties中配置的端口、用户名、密码等内容直接连接
Ⅱ、RabbitProperties封装了RabbitMQ的配置,可以通过application.properties配置相应属性:host、user、password
Ⅲ、配置了RabbitTemplate的Bean:给RabbitMQ发送和接受消息
Ⅳ、配置了AmqpAdmin:RabbitMQ系统管理组件:
AmqpAdmin:用于创建和删除Queue,Exchange,binding,详细操作见测试类中操作
Ⅴ、使用@EnableRabbit + @RabbitListenner监听消息队列

##项目步骤: 1、创建一个spring boot项目,勾选web和RabbitMQ模块
2、在application.properties进行如下配置 spring.rabbitmq.addresses=192.168.101.3#自己的rabbit端口 spring.rabbitmq.username=guest spring.rabbitmq.password=guest
3、配置自定义序列化方式。。。
4、设置监听队列服务,一旦有消息到消息队列则进行操作:
①、首先在application主类中使用@EnableRabbit注释
②在service部分新增一个方法,方法用@rabbitListener注解,只要有消息到,这个方法就会被调用 、配置完成,即可进行操作,此处在测试类中进行数据测试

###注意:本项目所有对RabbitMQ的Exchange、Queue、Bind等具体操作,都在测试类中进行

Repository Comments ( 0 )

Sign in to post a comment

About

springboot实现rabbitMQ操作 expand collapse
Java
EPL-1.0
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Java
1
https://gitee.com/yayiboy/rabbitmq_demo.git
git@gitee.com:yayiboy/rabbitmq_demo.git
yayiboy
rabbitmq_demo
rabbitmq_demo
master

Search

161121 f78d6d6f 1850385 154831 86f8c370 1850385