1、引入jar包

2、开启rabbitmq注解

3、配置rabbitmq的yml

4、配置消息发送的内容格式,默认是jdk序列化,改成json序列化。

5、自定义类包装复杂消息,可以自己配置字段。

6、用RabbitTemplate 类发送消息
rabbitTemplate.convertAndSend(exchange, routingKey, message);
exchange: 交换机名
routingKey: 路由键
rmessage: 自定义类

1、1. 引入jar
2. 添加注解
3. 配置yml
4. 序列化配置
5. 自定义类包装复杂消息
6. rabbit template发送消息