# Spring-rabbitMQ **Repository Path**: shenzhanwang/Spring-rabbitMQ ## Basic Information - **Project Name**: Spring-rabbitMQ - **Description**: Spring boot整合消息队列RabbitMQ - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 920 - **Forks**: 474 - **Created**: 2017-02-23 - **Last Updated**: 2025-04-24 ## Categories & Tags **Categories**: message-server **Tags**: None ## README # Spring-rabbitMQ - 在业务逻辑的异步处理,系统解耦,分布式通信以及控制高并发的场景下,消息队列有着广泛的应用。本项目基于Spring的AMQP模块,整合流行的开源消息队列中间件rabbitMQ,实现一个向rabbitMQ添加和读取消息的功能。并比较了两种模式:生产者-消费者模式和发布-订阅模式的区别。AMQP作为比JMS更加高级的消息协议,支持更多的消息路由和消息模式。 - 包含的特性如下:  1. 如上图,生产者消费者模型:添加了一个队列,并创建了两个消费者用于监听队列消息,我们发现,当有消息到达时,两个消费者会交替收到消息。这一过程虽然不用创建交换机,但会使用默认的交换机,并用默认的直连(default-direct)策略连接队列;  2. 如下图,发布订阅模型,添加两个队列,分别各用一个消费者监听,设置一个交换机,类型为广播(fanout),交换机会将收到的消息广播给所有相连的队列:    3. direct直连交换机通信模型,包括一个direct交换机,三个binding,两个队列,两个消费者监听器,消息只会被投入到routingkey一致的队列中   4.topic主题交换机通信,包括一个topic交换机,三个binding,两个队列,两个消费者监听器,消息只会被投入到routingkey能够匹配的队列中,#表示0个或若干个关键字,*表示一个关键字   5. 进入http://localhost:8080/Spring-rabbitMQ/demo 可向rabbitMQ发送消息,如下图:  ### 好书推荐  |购买地址| |--| || ### 专利文章 | | 标题 | 技术领域 | |---|----|------| | 1 | [一种基于微服务架构的车联网大数据分析系统](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247484096&idx=1&sn=11677bc50cd18e448135319394238e80&chksm=c03b20a2f74ca9b41c7d1c1e60e1407e1530a98b86498822f387da26e551826f8136663b45a0#rd) | 微服务| | 2 | [一种流式数据场景下Elasticsearch索引的自动化扩容方法](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247484167&idx=1&sn=94587b5e196bbda2d6cc4b976b03d0c7&chksm=c03b2165f74ca873b77380a23c4e06b71adf6ffc40634440f467fb71c20aa4cc2fe72a5d65a9#rd) | 搜索引擎 | | 3 | [大数据钻取分析方法、装置、设备及存储介质](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247484385&idx=1&sn=6fe4a4ac34badd91db39b4cc042a3f18&chksm=c03b2183f74ca89508333f3d5c8330aa32248eda86e4cf7657a5a293e1bf9d49888fe78b1072#rd) | 大数据分析 | | 4 | [一种基于工作流引擎的自动化办公方法和系统](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247484895&idx=1&sn=1094f0b9abef603e8126dea68db75cca&chksm=c03b27bdf74caeab50d56ac110b9ab0d36bc9b9069e311083a5c4295ab03ee4b0595a00a3ba2#rd) | 工作流引擎 | | 5 | [一种低延迟高性能实时数据仓库搭建的方法和系统](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247485672&idx=1&sn=ef9b05e32790091f6e984d14624d9560&chksm=c03b2a8af74ca39c24c9354279036148cd72315f22d06ab63649808d70161d8b4f53d38cc5fb&scene=178&cur_album_id=3268880015212085251#rd) | 实时数仓 | | 6 | [一种基于数据治理的大数据中台架构系统](https://mp.weixin.qq.com/s?__biz=Mzg5MjY3OTk0OQ==&mid=2247485875&idx=1&sn=db58f023c92ca01cc1902e7bea806a48&chksm=c03b2bd1f74ca2c7b45f993386f443718a99a378a51d9be827c2e45b326c549a868089fbdd31&scene=178&cur_album_id=3268880015212085251#rd) | 数据中台 | ### 视频教程 |
| |--| | | ### 附录:中央技术储备仓库(Central Technique Reserve Repository) 1. [Spring boot整合Mybatis实现增删改查(支持多数据源)](https://gitee.com/shenzhanwang/SSM) 2. [Spring,SpringMVC和Hibernate的整合实现增删改查](https://gitee.com/shenzhanwang/SSH) 3. [Spring boot整合activiti工作流引擎实现OA开发](https://gitee.com/shenzhanwang/Spring-activiti) 4. [Ruoyi-boot集成工作流引擎Flowable实例](https://gitee.com/shenzhanwang/Ruoyi-flowable) 5. [Spring发布与调用REST风格的WebService](https://gitee.com/shenzhanwang/Spring-REST) 6. [Spring boot整合Axis调用SOAP风格的web服务](https://gitee.com/shenzhanwang/Spring-axis) 7. [Spring boot整合Apache Shiro实现RBAC权限控制](https://gitee.com/shenzhanwang/Spring-shiro) 8. [使用Spring security实现RBAC权限控制](https://gitee.com/shenzhanwang/spring-security-demo) 9. [Spring boot整合mongoDB文档数据库实现增删改查](https://gitee.com/shenzhanwang/Spring-mongoDB) 10. [Spring连接Redis实现缓存](https://gitee.com/shenzhanwang/Spring-redis) 11. [Spring连接图存数据库Neo4j实现增删改查](https://gitee.com/shenzhanwang/Spring-neo4j) 12. Spring boot整合列存数据库hbase实现增删改查 13. [Spring平台整合消息队列ActiveMQ实现发布订阅、生产者消费者模型(JMS)](https://gitee.com/shenzhanwang/Spring-activeMQ) 14. [Spring boot整合消息队列RabbitMQ实现四种消息模式(AMQP)](https://gitee.com/shenzhanwang/Spring-rabbitMQ) 15. Spring boot整合kafka 2.1.0实现大数据消息管道 16. [Spring boot整合websocket实现即时通讯](https://gitee.com/shenzhanwang/Spring-websocket) 17. [Spring security整合oauth2实现token认证](https://gitee.com/shenzhanwang/Spring-security-oauth2) 18. [Spring boot整合MinIO客户端实现文件管理](https://gitee.com/shenzhanwang/Spring-minio) 19. 23种设计模式,源码、注释、使用场景 20. [使用ETL工具Kettle的实例](https://gitee.com/shenzhanwang/Kettle-demo) 21. Git指南和分支管理策略 22. 使用Apache Doris搭建实时数仓 23. [zookeeper原理、架构、使用场景和可视化](https://gitee.com/shenzhanwang/zookeeper-practice) 24. Spring boot整合Apache dubbo v2.7.5实现分布式服务治理(SOA架构)  25. 使用Spring Cloud Alibaba v2.2.7实现微服务架构(MSA架构) 26. 使用Apache Paimon搭建流式数据湖 27. 使用kubernetes+docker+gitlab+spring cloud实现云服务的编排、持续集成和动态扩容 28. 使用Spark进行分布式计算 29. 使用Flink实现流批一体化的分布式计算 30. 搭建高可用nginx集群和Tomcat负载均衡 31. 使用mycat实现Mysql数据库的主从复制、读写分离、分表分库、负载均衡和高可用 32. [《Elasticsearch数据搜索与分析实战》源码](https://gitee.com/shenzhanwang/Spring-elastic_search)  33. 基于可靠消息最终一致性实现分布式事务(activeMQ) 34. Spring boot dubbo整合seata实现分布式事务 35. Spring cloud alibaba 整合seata实现分布式事务  36. 并发控制:数据库锁机制和事务隔离级别的实现 37. 并发控制:使用redission实现分布式锁 38. 并发控制:使用zookeeper实现分布式锁 39. 并发控制:Java多线程编程实例 40. 并发控制:使用netty实现高性能NIO通信 ### 关注微信公众号获取更多技术文章和源码 