# rabbit-mq **Repository Path**: note-java/rabbit-mq ## Basic Information - **Project Name**: rabbit-mq - **Description**: rabbitMQ学习笔记 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-09-04 - **Last Updated**: 2025-06-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: rabbit搭建 ## README # RabbitMQ 示例项目 ## 介绍 这是一个使用 RabbitMQ 的示例项目,演示了如何在 Spring Boot 应用中实现不同的消息队列模式,包括点对点模式、路由模式、订阅模式、主题模式和工作队列模式。 ## 软件架构 - **Spring Boot**: 提供快速开发框架 - **RabbitMQ**: 实现消息队列功能 - **application.yml**: 配置文件 - **index.html**: 静态页面 - **模块划分**: - `RabbitMqApplication`: 启动类 - `RabbitMqConfig`: 队列与交换机配置 - `pointtopoint`: 点对点模式 - `workqueue`: 工作队列模式 - `subscribe`: 订阅模式 - `topic`: 主题模式 - `route`: 路由模式 ## 安装教程 1. 安装并启动 [RabbitMQ](https://www.rabbitmq.com/download.html) 2. 安装 [JDK 1.8+](https://adoptium.net/zh-CN/temurin/releases/?version=8) 3. 安装 [Maven](https://maven.apache.org/download.cgi) 4. 克隆项目:`git clone [项目地址]` 5. 构建项目:`mvn clean package` 6. 启动应用:`mvn spring-boot:run` 或使用 IDE 运行 `RabbitMqApplication.java` ## 使用说明 - **点对点模式(Point-to-Point)**: - 生产者:`PointProduce.send()` - 消费者:`PointConsume.listenHelloMsg()` - **工作队列模式(Work Queue)**: - 生产者:`WorkMqProduce.send()` - 消费者:`WorkMqConsume.listenWork1()` 和 `listenWork2()` - **订阅模式(Fanout Exchange)**: - 生产者:`SubscribeProduce.send()` - 消费者:`SubscribeConsume.listenDead1()` 和 `listenDead2()` - **路由模式(Direct Exchange)**: - 生产者:`RouteProduce.send()` - 消费者:`RouteConsume.listenDead1()` 和 `listenDead2()` - **主题模式(Topic Exchange)**: - 生产者:`TopicProduce.send()` - 消费者:`TopicConsume.listenDead1()` 和 `listenDead2()` ## 参与贡献 1. Fork 项目 2. 创建新分支 3. 提交代码 4. 创建 Pull Request ## 特技 - 支持多种 RabbitMQ 消息模式 - 使用 Spring Boot 快速集成 RabbitMQ - 每种模式都提供独立的生产者和消费者示例 - 支持多消费者监听同一队列 - 配置清晰,便于扩展和学习