0


RabbitMQ交换机类型

RabbitMQ交换机类型

1、RabbitMQ工作模型

  • broker 相当于mysql服务器;
  • virtual host相当于数据库(可以有多个数据库);
  • queue相当于表;
  • 消息相当于记录。

在这里插入图片描述

消息队列有三个核心要素: 消息生产者、消息队列、消息消费者;
生产者(Producer):发送消息的应用;(java程序,也可能是别的语言写的程序)
消费者(Consumer):接收消息的应用;(java程序,也可能是别的语言写的程序)
代理(Broker):就是消息服务器,RabbitMQ Server就是Message Broker;
连接(Connection):连接RabbitMQ服务器的TCP长连接;
信道(Channel):连接中的一个虚拟通道,消息队列发送或者接收消息时,都是通过信道进行的;
虚拟主机(Virtual host):一个虚拟分组,在代码中就是一个字符串,当多个不同的用户使用同一个RabbitMQ服务时,可以划分出多个Virtual host,每个用户在自己的Virtual host创建exchange/queue等;(分类比较清晰、相互隔离)
交换机(Exchange):交换机负责从生产者接收消息,并根据交换机类型分发到对应的消息队列中,起到一个路由的作用;
路由键(Routing Key):交换机根据路由键来决定消息分发到哪个队列,路由键是消息的目的地址;
绑定(Binding):绑定是队列和交换机的一个关联连接(关联关系);
队列(Queue):存储消息的缓存;
消息(Message):由生产者通过RabbitMQ发送给消费者的信息;(消息可以任何数据,字符串、user对象,json串等等)

2、RabbitMQ交换机类型

Exchange(X) 可翻译成交换机/交换器/路由器

  • Fanout Exchange(扇形)
  • Direct Exchange(直连)
  • Topic Exchange(主题)
  • Headers Exchange(头部)

2.1、Fanout Exchange(扇形)

2.1.1、介绍

Fanout 扇形的,散开的; 扇形交换机
投递到所有绑定的队列,不需要路由键,不需要进行路由键的匹配,相当于广播、群发;
在这里插入图片描述

2.1.2、示例

在这里插入图片描述

2.1.2.1、生产者

1、配置类

  1. packagecom.power.config;importorg.springframework.amqp.core.Binding;importorg.springframework.amqp.core.BindingBuilder;importorg.springframework.amqp.core.FanoutExchange;importorg.springframework.amqp.core.Queue;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;@ConfigurationpublicclassRabbitConfig{//rabbitmq三部曲//1、定义交换机@BeanpublicFanoutExchangefanoutExchange(){returnnewFanoutExchange("exchange.fanout");}//2、定义队列@BeanpublicQueuequeueA(){returnnewQueue("queue.fanout.a");}@BeanpublicQueuequeueB(){returnnewQueue("queue.fanout.b");}//3、绑定交换机何队列@BeanpublicBindingbingingA(FanoutExchange fanoutExchange,Queue queueA){//将队列A绑定到扇形交换机returnBindingBuilder.bind(queueA).to(fanoutExchange);}@BeanpublicBindingbingingB(FanoutExchange fanoutExchange,Queue queueB){//将队列B绑定到扇形交换机returnBindingBuilder.bind(queueB).to(fanoutExchange);}}

2、生产者

  1. packagecom.power.service;importlombok.extern.slf4j.Slf4j;importorg.springframework.amqp.core.Message;importorg.springframework.amqp.rabbit.core.RabbitTemplate;importorg.springframework.stereotype.Component;importjavax.annotation.Resource;importjava.util.Date;@Component@Slf4jpublicclassMessageService{@ResourceprivateRabbitTemplate rabbitTemplate;publicvoidsendMsg(){//定义要发送的消息String msg ="hello world";Message message =newMessage(msg.getBytes());
  2. rabbitTemplate.convertAndSend("exchange.fanout","", message);
  3. log.info("消息发送完毕,发送时间为:"+newDate());}}

2、启动类

  1. packagecom.power;importcom.power.service.MessageService;importorg.springframework.boot.ApplicationArguments;importorg.springframework.boot.ApplicationRunner;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;importjavax.annotation.Resource;@SpringBootApplicationpublicclassFanoutApplicationimplementsApplicationRunner{@ResourceprivateMessageService messageService;publicstaticvoidmain(String[] args){SpringApplication.run(FanoutApplication.class,args);}/**
  2. * 程序一启动就运行该方法
  3. *
  4. * @param args
  5. * @throws Exception
  6. */@Overridepublicvoidrun(ApplicationArguments args)throwsException{
  7. messageService.sendMsg();}}

4、配置文件application.yml

  1. server:
  2. port:8080
  3. spring:
  4. application:
  5. name: fanout-learn
  6. rabbitmq:
  7. host: 你的RabbitMQ服务器主机IP #rabbitmq的主机
  8. port:5672
  9. username: 登录账号
  10. password: 登录密码
  11. virtual-host: power #虚拟主机

5、项目配置文件pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.power</groupId><artifactId>rabbit_01_fanout</artifactId><version>1.0-SNAPSHOT</version><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target></properties><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version><relativePath/></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.24</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
2.1.2.2、消费者

在这里插入图片描述
1、消费者

  1. packagecom.power.message;importlombok.extern.slf4j.Slf4j;importorg.springframework.amqp.core.Message;importorg.springframework.amqp.rabbit.annotation.RabbitListener;importorg.springframework.stereotype.Component;@Component@Slf4jpublicclassReceiveMessage{//接收两个队列的消息@RabbitListener(queues ={"queue.fanout.a","queue.fanout.b"})publicvoidreceiveMsg(Message message){byte[] body = message.getBody();String msg =newString(body);
  2. log.info("接收到的消息为:"+msg);}}

2、配置文件application.yml

  1. server:
  2. port:9090
  3. spring:
  4. application:
  5. name: receive-msg
  6. rabbitmq:
  7. host: 你的RabbitMQ服务器主机IP #rabbitmq的主机
  8. port:5672
  9. username: 登录账号
  10. password: 登录密码
  11. virtual-host: power #虚拟主机

3、配置文件pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.power</groupId><artifactId>rabbit_01_receiveMessage</artifactId><version>1.0-SNAPSHOT</version><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version><relativePath/></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.24</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

4、启动类

  1. packagecom.power;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublicclassReceiveFanoutMsgApplication{publicstaticvoidmain(String[] args){SpringApplication.run(ReceiveFanoutMsgApplication.class,args);}}
2.1.2.3、测试

先启动生产者:

在这里插入图片描述

再启动消费者:

在这里插入图片描述消费者启动会会一直监听

2.2、Direct Exchange(直连)

2.2.1、介绍

根据路由键精确匹配(一模一样)进行路由消息队列;
在这里插入图片描述

2.2.2、示例

在这里插入图片描述

2.2.2.1、生产者

1、配置类

  1. packagecom.power.config;importorg.springframework.amqp.core.*;importorg.springframework.beans.factory.annotation.Value;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;@Configuration//@ConfigurationProperties(prefix = "my")publicclassRabbitConfig{//交换机的名字@Value("${my.exchangeName}")privateString exchangeName;//队列A的名字@Value("${my.queueAName}")privateString queueAName;//队列B的名字@Value("${my.queueBName}")privateString queueBName;//1、定义交换机@BeanpublicDirectExchangedirectExchange(){//使用建造者模式创建returnExchangeBuilder.directExchange(exchangeName).build();}//2、定义队列@BeanpublicQueuequeueA(){returnQueueBuilder.durable(queueAName).build();}@BeanpublicQueuequeueB(){returnQueueBuilder.durable(queueBName).build();}//3、交换机和队列A进行绑定@BeanpublicBindingbindingA(DirectExchange directExchange,Queue queueA){returnBindingBuilder.bind(queueA).to(directExchange).with("error");}//交换机和队列B进行绑定@BeanpublicBindingbindingB1(DirectExchange directExchange,Queue queueB){returnBindingBuilder.bind(queueB).to(directExchange).with("error");}@BeanpublicBindingbindingB2(DirectExchange directExchange,Queue queueB){returnBindingBuilder.bind(queueB).to(directExchange).with("info");}@BeanpublicBindingbindingB3(DirectExchange directExchange,Queue queueB){returnBindingBuilder.bind(queueB).to(directExchange).with("warning");}}

2、发送消息

  1. packagecom.power.service;importlombok.extern.slf4j.Slf4j;importorg.springframework.amqp.core.Message;importorg.springframework.amqp.core.MessageBuilder;importorg.springframework.amqp.rabbit.core.RabbitTemplate;importorg.springframework.context.annotation.Bean;importorg.springframework.stereotype.Service;importjavax.annotation.Resource;importjava.util.Date;@Service@Slf4jpublicclassMessageService{@ResourceprivateRabbitTemplate rabbitTemplate;@BeanpublicvoidsendMsg(){//使用建造者模式创建消息Message message =MessageBuilder.withBody("hello world".getBytes()).build();//参数1:交换机 参数2:路由key 参数3:消息
  2. rabbitTemplate.convertAndSend("exchange.direct","info", message);
  3. log.info("消息发送完毕,发送时间:"+newDate());}}

3、配置文件application.yml

  1. server:
  2. port:8080
  3. spring:
  4. application:
  5. name: receive-msg
  6. rabbitmq:
  7. host:<你的RqaabitMQ服务器IP> #rabbitmq的主机
  8. port:5672
  9. username: 登录名
  10. password: 登录密码
  11. virtual-host: power #虚拟主机
  12. my:
  13. exchangeName: exchange.direct
  14. queueAName: queue.direct.a
  15. queueBName: queue.direct.b

4、启动类

  1. packagecom.power;importcom.power.service.MessageService;importorg.springframework.amqp.core.MessageBuilder;importorg.springframework.boot.ApplicationArguments;importorg.springframework.boot.ApplicationRunner;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;importjavax.annotation.Resource;@SpringBootApplicationpublicclassDirectApplicationimplementsApplicationRunner{@ResourceprivateMessageService messageService;publicstaticvoidmain(String[] args){SpringApplication.run(DirectApplication.class, args);}@Overridepublicvoidrun(ApplicationArguments args)throwsException{
  2. messageService.sendMsg();}}

5、配置文件pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.power</groupId><artifactId>rabbit_02_direct</artifactId><version>1.0-SNAPSHOT</version><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version><relativePath/></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.24</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
2.2.2.2、测试

运行启动类。
登录服务器查看Exchange:
在这里插入图片描述

登录服务器查Queues:
在这里插入图片描述

2.3、Topic Exchange(主题交换机)

2.3.1 介绍

  1. 通配符匹配,相当于模糊匹配;
  2. # 匹配多个单词,用来表示任意数量(零个或多个)单词
  3. * 匹配一个单词(必须有一个,而且只有一个),用.隔开的为一个单词:
  4. beijing.# == beijing.queue.abc, beijing.queue.xyz.xxx
  5. beijing.* == beijing.queue, beijing.xyz

在这里插入图片描述
案例:发送时指定的路由键:lazy.orange.rabbit,可以进入上图的那个队列
:可以进入Q1和Q2队列,其中Q2队列只能进入一条消息

2.3.2 示例

在这里插入图片描述

2.3.2.1 配置文件appication.yml
  1. server:
  2. port:8080
  3. spring:
  4. application:
  5. name: topic-exchange
  6. rabbitmq:
  7. host: 你的主机IP
  8. port:5672
  9. username: 你的管理员账号
  10. password: 你的管理员密码
  11. virtual-host: power
  12. my:
  13. exchangeName: exchange.topic
  14. queueAName: queue.topic.a
  15. queueBName: queue.topic.b
2.3.2.2 配置类RabbitConfig
  1. packagecom.power.config;importorg.springframework.amqp.core.*;importorg.springframework.beans.factory.annotation.Value;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;@ConfigurationpublicclassRabbitConfig{//交换机的名字@Value("${my.exchangeName}")privateString exchangeName;//队列A的名字@Value("${my.queueAName}")privateString queueAName;//队列B的名字@Value("${my.queueBName}")privateString queueBName;//创建交换机@BeanpublicTopicExchangetopicExchange(){returnExchangeBuilder.topicExchange(exchangeName).build();}//创建队列@BeanpublicQueuequeueA(){returnQueueBuilder.durable(queueAName).build();}@BeanpublicQueuequeueB(){returnQueueBuilder.durable(queueBName).build();}//创建绑定@BeanpublicBindingbindingA(TopicExchange topicExchange,Queue queueA){returnBindingBuilder.bind(queueA).to(topicExchange).with("*.orange.*");}@BeanpublicBindingbindingB1(TopicExchange topicExchange,Queue queueB){returnBindingBuilder.bind(queueB).to(topicExchange).with("*.*.rabbit");}@BeanpublicBindingbindingB2(TopicExchange topicExchange,Queue queueB){returnBindingBuilder.bind(queueB).to(topicExchange).with("lazy.#");}}
2.3.2.3 发送消息MessageService
  1. packagecom.power.service;importorg.springframework.amqp.core.AmqpTemplate;importorg.springframework.amqp.core.Message;importorg.springframework.amqp.core.MessageBuilder;importorg.springframework.stereotype.Service;importjavax.annotation.Resource;@ServicepublicclassMessageService{@ResourceprivateAmqpTemplate amqpTemplate;publicvoidsendMsg(){Message message =MessageBuilder.withBody("hello world".getBytes()).build();//参数1:交换机,参数2:发送路由key,参数3:消息
  2. amqpTemplate.convertAndSend("exchange.topic","hello.world",message);}}
2.3.2.4 启动类Application
  1. packagecom.power;importcom.power.service.MessageService;importorg.springframework.boot.ApplicationArguments;importorg.springframework.boot.ApplicationRunner;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;importjavax.annotation.Resource;@SpringBootApplicationpublicclassApplicationimplementsApplicationRunner{@ResourceprivateMessageService messageService;publicstaticvoidmain(String[] args){SpringApplication.run(Application.class);}@Overridepublicvoidrun(ApplicationArguments args)throwsException{
  2. messageService.sendMsg();}}
2.3.2.5 pom.xml配置文件
  1. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.power</groupId><artifactId>rabbit_03_topic</artifactId><version>1.0-SNAPSHOT</version><name>rabbit_03_topic</name><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version><relativePath/></parent><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.24</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
2.3.2.6 测试

在这里插入图片描述

2.4、Headers Exchange(头部交换机)

2.4.1、介绍

基于消息内容中的headers属性进行匹配;
在这里插入图片描述

2.4.2、示例

2.4.2.1 配置文件appication.yml
  1. server:
  2. port:8080
  3. spring:
  4. application:
  5. name: topic-exchange
  6. rabbitmq:
  7. host: 你的服务器IP
  8. port:5672
  9. username: 你的账号
  10. password: 你的密码
  11. virtual-host: power
  12. my:
  13. exchangeName: exchange.headers
  14. queueAName: queue.headers.a
  15. queueBName: queue.headers.b
2.4.2.2 配置类RabbitConfig
  1. packagecom.power.config;importorg.springframework.amqp.core.*;importorg.springframework.beans.factory.annotation.Value;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;importjava.util.HashMap;importjava.util.Map;@ConfigurationpublicclassRabbitConfig{//交换机的名字@Value("${my.exchangeName}")privateString exchangeName;//队列A的名字@Value("${my.queueAName}")privateString queueAName;//队列B的名字@Value("${my.queueBName}")privateString queueBName;//创建交换机@BeanpublicHeadersExchangeheadersExchange(){returnExchangeBuilder.headersExchange(exchangeName).build();}//创建队列@BeanpublicQueuequeueA(){returnQueueBuilder.durable(queueAName).build();}@BeanpublicQueuequeueB(){returnQueueBuilder.durable(queueBName).build();}//创建绑定@BeanpublicBindingbindingA(HeadersExchange headersExchange,Queue queueA){Map<String,Object> headerValues =newHashMap<>();
  2. headerValues.put("type","m");
  3. headerValues.put("status",1);returnBindingBuilder.bind(queueA).to(headersExchange).whereAll(headerValues).match();}@BeanpublicBindingbindingB(HeadersExchange headersExchange,Queue queueB){Map<String,Object> headerValues =newHashMap<>();
  4. headerValues.put("type","s");
  5. headerValues.put("status",0);returnBindingBuilder.bind(queueB).to(headersExchange).whereAll(headerValues).match();}}
2.4.2.3 发送消息MessageService
  1. packagecom.power.service;importlombok.extern.slf4j.Slf4j;importorg.springframework.amqp.core.Message;importorg.springframework.amqp.core.MessageBuilder;importorg.springframework.amqp.core.MessageProperties;importorg.springframework.amqp.rabbit.core.RabbitTemplate;importorg.springframework.beans.factory.annotation.Value;importorg.springframework.stereotype.Service;importjavax.annotation.Resource;importjava.util.HashMap;importjava.util.Map;@Service@Slf4jpublicclassMessageService{@ResourceprivateRabbitTemplate rabbitTemplate;@Value("${my.exchangeName}")privateString exchangeName;publicvoidsendMsg(){MessageProperties messageProperties =newMessageProperties();Map<String,Object> headers =newHashMap<>();
  2. headers.put("type","s");
  3. headers.put("status",0);//设置消息头
  4. messageProperties.setHeaders(headers);Message message =MessageBuilder.withBody("hello world".getBytes()).andProperties(messageProperties).build();
  5. rabbitTemplate.convertAndSend(exchangeName,"",message);
  6. log.info("消息发送完毕");}}
2.4.2.4 启动类Application
  1. packagecom.power;importcom.power.service.MessageService;importorg.springframework.boot.ApplicationArguments;importorg.springframework.boot.ApplicationRunner;importorg.springframework.boot.SpringApplication;importorg.springframework.boot.autoconfigure.SpringBootApplication;importjavax.annotation.Resource;@SpringBootApplicationpublicclassHeadersExchangeApplicationimplementsApplicationRunner{@ResourceprivateMessageService messageService;publicstaticvoidmain(String[] args){SpringApplication.run(HeadersExchangeApplication.class,args);}@Overridepublicvoidrun(ApplicationArguments args)throwsException{
  2. messageService.sendMsg();}}
2.4.2.5 pom.xml配置文件
  1. <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.power</groupId><artifactId>rabbit_04_headers</artifactId><version>1.0-SNAPSHOT</version><name>rabbit_04_headers</name><!-- FIXME change it tothe project's website --><url>http://www.example.com</url><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version><relativePath/></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.24</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-amqp</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
2.4.2.6 测试

在这里插入图片描述

标签: rabbitmq 分布式

本文转载自: https://blog.csdn.net/qq_46112274/article/details/142621583
版权归原作者 小码哥呀 所有, 如有侵权,请联系我们删除。

“RabbitMQ交换机类型”的评论:

还没有评论