Files

80 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# rabbitmq-template
## 📋 项目概述
本项目是一个 Spring Boot 3 集成 RabbitMQ 的模板项目,包含了消息队列开发中的常见场景实现,可作为学习和开发的参考模板。
## 🚀 快速开始
### 环境要求
- JDK 21
- Spring Boot 3.2.2
- RabbitMQ Server
### 安装配置
1. 克隆项目
```bash
git clone [repository-url]
cd rabbitmq-template
```
2. 配置 RabbitMQ
在 `application.yml` 中配置你的 RabbitMQ 连接信息:
```yaml
spring:
rabbitmq:
host: localhost
port: 5672
username: your-username
password: your-password
virtual-host: /template
```
3. 运行项目
```bash
mvn spring-boot:run
```
## 📁 项目结构
```
rabbitmq-template/
├── src/main/java/cn/hezhaohui/rabbitmq/
│ ├── Application.java # 主程序入口
│ ├── Message.java # 消息实体类
│ ├── MessageProducer.java # 消息生产者
│ ├── MessageConsumer.java # 消息消费者
│ └── RabbitmqConfig.java # RabbitMQ 配置类
└── src/test/java/
└── RabbitMQTest.java # 测试类
```
## 🎯 核心功能
### 1. 消息发送与接收
- 支持邮件消息队列
- 支持短信消息队列
- 使用 Topic 交换机实现消息路由
### 2. 消息配置
- 自定义消息转换器(JSON)
- 队列持久化配置
- 交换机配置
### 3. 测试用例
- 邮件消息发送测试
- 短信消息发送测试
## 🛠️ 技术栈
- Spring Boot 3.2.2
- Spring AMQP
- RabbitMQ
- Lombok
- Jackson