RabbitMQ入门教程(精细版二带图)

目录

六 RabbitMQ工作模式

6.1Hello World简单模式

6.1.1 什么是简单模式

6.1.2 RabbitMQ管理界面操作

6.1.3 生产者代码

6.1.4 消费者代码

6.2 Work queues工作队列模式

6.2.1 什么是工作队列模式

6.2.2 RabbitMQ管理界面操作

6.2.3 生产者代码

6.2.4 消费者代码

6.3 三种模式概览

6.4 Publish/Subscribe发布与订阅模式

6.4.1 什么是发布订阅模式

6.4.2 RabbitMQ管理界面操作

6.4.3 生产者代码

6.4.4 消费者代码

6.5 Routing路由模式

6.5.1 什么是路由模式

6.5.2 RabbitMQ管理界面操作

6.5.3 生产者代码

6.5.4 消费者代码

6.6 Topics通配符模式(主题模式)

6.6.1 什么是通配符(主题)模式

6.6.2 RabbitMQ管理界面操作

6.6.3 生产者代码

6.6.4 消费者代码

6.7 模式总结RabbitMQ

6.8 使用代码创建队列和交换机

6.8.1 初始化exchange、queue

6.8.2 发布消息到RabbitMQ

6.8.3 创建消费者监听消息


官方文档  RabbitMQ Documentation | RabbitMQ

 MQ全称为Message Queue,消息队列是应用程序和应用程序之间的通信方法。

RabbitMQ是一个Erlang开发的AMQP(高级消息排队 协议)(英文全称:Advanced Message Queuing Protocol )的开源实现。-------------接上章 

六 RabbitMQ工作模式

6.1Hello World简单模式

6.1.1 什么是简单模式

在上图的模型中,有以下概念:

P:生产者: 也就是要发送消息的程序

C:消费者:消息的接受者,会一直等待消息到来。

queue:消息队列,图中红色部分。类似一个邮箱,可以缓存消息;生产者向其中投递消息,消费者从其中取出消息。

6.1.2 RabbitMQ管理界面操作
  • 创建simple_queue队列用于演示Hello World简单模式

6.1.3 生产者代码
  • rabbitmq_producer项目测试代码如下:

package com.tingyi.test;
​
import com.tingyi.rabbitmq.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
​
/*** @author 听忆*/
@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class TestSimple {@Autowiredprivate RabbitTemplate rabbitTemplate;
​@Testpublic void testSimpleSend() {rabbitTemplate.convertAndSend("simple_queue", "你好哇, 听忆!");}
}

6.1.4 消费者代码
  • rabbitmq_consumer项目创建监听器:

@Component
@RabbitListener(queues = "simple_queue")
public class SimpleListen {
​@RabbitHandlerpublic void onMessage(String message){System.out.println(message);}
}

然后启动ConsumerApplication.java, 就可以接收到RabbitMQ服务器发送来的消息

6.2 Work queues工作队列模式

6.2.1 什么是工作队列模式

Work Queues与入门程序的简单模式相比,多了一个或一些消费端,多个消费端共同消费同一个队列中的消息。应用场景:对于任务过重或任务较多情况使用工作队列可以提高任务处理的速度。

在一个队列中如果有多个消费者,那么消费者之间对于同一个消息的关系是竞争的关系。

6.2.2 RabbitMQ管理界面操作
  • 创建 work_queue 队列用于演示work工作队列模式

6.2.3 生产者代码

rabbitmq_producer项目测试代码如下:

package com.qf.test;
​
import com.tingyi.rabbitmq.ProducerApplication;
import org.junit.Test;99
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
​
/*** @author 听忆*/
@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class TestWork {@Autowiredprivate RabbitTemplate rabbitTemplate;
​@Testpublic void testWorkSend() {for (int i = 0; i < 1000; i++){rabbitTemplate.convertAndSend("work_queue", "你好哇, 听忆" + i);}
​}
}

6.2.4 消费者代码
  • rabbitmq_consumer项目创建监听器1:

package com.tingyi.rabbitmq.work;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "work_queue")
public class WorkListener1 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======WorkListener1接收到的消息为:======" + message);}
}
  • rabbitmq_consumer项目创建监听器2:

package com.tingyi.rabbitmq.work;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "work_queue")
public class WorkListener2 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======WorkListener2接收到的消息为:======" + message);}
}

6.3 三种模式概览

前面2个案例中,只有3个角色:

  • P:生产者,也就是要发送消息的程序

  • C:消费者:消息的接受者,会一直等待消息到 来。

  • queue:消息队列,图中红色部分

而在订阅模型中,多了一个exchange角色,而且过程略有变化:

  • P:生产者,也就是要发送消息的程序,但是不再发送到队列中,而是发给X(交换机)

  • C:消费者,消息的接受者,会一直等待消息到来。

  • Queue:消息队列,接收消息、缓存消息。

  • Exchange:交换机,图中的X。一方面,接收生产者发送的消息。另一方面,知道如何处理消息,例如递交给某个特别队列、递交给所有队列、或是将消息丢弃。到底如何操作,取决于Exchange的类型。

Exchange有常见以下3种类型:

  • Fanout:广播 将消息交给所有绑定到交换机的队列, 不处理路由键。只需要简单的将队列绑定到交换机上。fanout 类型交换机转发消息是最快的。

    • Direct:定向 把消息交给符合指定routing key 的队列. 处理路由键。需要将一个队列绑定到交换机上,要求该消息与一个特定的路由键完全匹配。如果一个队列绑定到该交换机上要求路由键 “dog”,则只有被标记为 “dog” 的消息才被转发,不会转发 dog.puppy,也不会转发 dog.guard,只会转发dog。

    其中,路由模式使用的是 direct 类型的交换机。

    • Topic:主题(通配符) 把消息交给符合routing pattern(路由模式)的队列. 将路由键和某模式进行匹配。此时队列需要绑定要一个模式上。符号 # 匹配一个或多个词,符号*匹配不多不少一个词。因此“audit.#” 能够匹配到“audit.irs.corporate”,但是“audit.*” 只会匹配到 “audit.irs”。

    其中,主题模式(通配符模式)使用的是 topic 类型的交换机。

Exchange(交换机)只负责转发消息,不具备存储消息的能力,因此如果没有任何队列与Exchange绑定,或者没有符合路由规则的队列,那么消息会丢失

6.4 Publish/Subscribe发布与订阅模式

6.4.1 什么是发布订阅模式

发布订阅模式:

​ 1、每个消费者监听自己的队列。

​ 2、生产者将消息发给broker,由交换机将消息转发到绑定此交换机的每个队列,每个绑定交换机的队列都将接收到消息

6.4.2 RabbitMQ管理界面操作
  • 创建两个队列 ps_queue1ps_queue2

  • 创建Exchange交换器 fanout_exchange

  • 将创建的fanout_exchange交换器和 ps_queue1 , ps_queue2 队列绑定

6.4.3 生产者代码
  • rabbitmq_producer项目测试代码如下:

package com.tingyi.test;
​
import com.tingyi.rabbitmq.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
​
/*** @author 听忆*/
@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class TestPubAndSub {@Autowiredprivate RabbitTemplate rabbitTemplate;
​@Testpublic void testPubAndSubSend() {for(int i = 1; i < 100; i++) {rabbitTemplate.convertAndSend("fanout_exchange","" , "你好哇,2024听忆 " + i);}}
}

6.4.4 消费者代码
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.ps;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "ps_queue1")
public class TestListener1 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======ps_queue1接收到的消息为:======" + message);}
}
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.ps;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "ps_queue2")
public class TestListener2 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======ps_queue2接收到的消息为:======" + message);}
}

6.5 Routing路由模式

6.5.1 什么是路由模式

路由模式特点:队列与交换机的绑定,不能是任意绑定了,而是要指定一个RoutingKey(路由key)消息的发送方在向 Exchange发送消息时,也必须指定消息的RoutingKey。Exchange不再把消息交给每一个绑定的队列,而是根据消息的Routing Key进行判断,只有队列的Routingkey与消息的Routing key完全一致,才会接收到消息.

图解:

P:生产者,向Exchange发送消息,发送消息时,会指定一个routing key。

X:Exchange(交换机),接收生产者的消息,然后把消息递交给与routing key完全匹配的队列

C1:消费者,其所在队列指定了需要routing key 为 error 的消息

C2:消费者,其所在队列指定了需要routing key 为 info、error、warning 的消息

6.5.2 RabbitMQ管理界面操作
  • 创建两个队列分别叫做 direct_queue_insertdirect_queue_update 用户演示

  • 创建交换器 direct_exchange , 类型为 direct , 用于演示路由模式

  • 设置绑定: 将创建的交换器 direct_exchangedirect_queue_insert , direct_queue_update 绑定在一起, 路由键Routing Key分别为 insertKeyupdateKey

6.5.3 生产者代码
  • rabbitmq_producer项目测试代码如下:

package com.tingyi.test;
​
import com.tingyi.rabbitmq.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
​
/*** @author 听忆*/
@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class TestRouting {@Autowiredprivate RabbitTemplate rabbitTemplate;
​@Testpublic void testPubAndSubSend() {for(int i = 1; i < 100; i++) {if (i % 2 == 0) {rabbitTemplate.convertAndSend("direct_exchange","insert_key" , "你好, 2024听忆" + i);} else {rabbitTemplate.convertAndSend("direct_exchange","update_key" , "你好, 小崔" + i);}}}
}

6.5.4 消费者代码
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.routing;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "direct_queue_insert")
public class TestInsertListener {@RabbitHandlerpublic void testListener(String message) {System.out.println("======test1_queue接收到的消息为:======" + message);}
}
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.routing;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "direct_queue_update")
public class TestUpdateListener {@RabbitHandlerpublic void testListener(String message) {System.out.println("======test2_queue接收到的消息为:======" + message);}
}

6.6 Topics通配符模式(主题模式)

6.6.1 什么是通配符(主题)模式

Topic类型与Direct相比,都是可以根据RoutingKey把消息路由到不同的队列。只不过Topic类型Exchange可以让队列在绑定Routing key的时候使用通配符!

Routingkey: 一般都是有一个或多个单词组成,多个单词之间以”.”分割,例如:item.insert

通配符规则:

#:匹配一个或多个

*:匹配不多不少恰好1个词

举例:

item.#: 能够匹配item.insert.abc或者item.insert

item.*:只能匹配item.insert item.update

图解:

  • 红色Queue:绑定的是usa.#,因此凡是以usa.开头的routing key都会被匹配到

  • 黄色Queue:绑定的是#.news,因此凡是以.news结尾的routing key都会被匹配

6.6.2 RabbitMQ管理界面操作
  • 创建队列 topic_queue1topic_queue1

  • 创建交换器 topic_exchange , type类型为 topic

  • 设置绑定:

    topic_queue1绑定的Routing Key路由键为item.*

    topic_queue2绑定的Routing Key路由键为item.#

6.6.3 生产者代码
  • rabbitmq_producer项目测试代码如下:

package com.tingyi.test;
​
import com.tingyi.rabbitmq.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
​
/*** @author 听忆*/
@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class TestTopic {@Autowiredprivate RabbitTemplate rabbitTemplate;
​@Testpublic void testTopicSend() {rabbitTemplate.convertAndSend("topic_exchange","item.select" , "你好, 2024听忆");rabbitTemplate.convertAndSend("topic_exchange","item.select.abc" , "你好, 2024小崔");}
}

6.6.4 消费者代码
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.topic;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "topic_queue1")
public class TestTopicListener1 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======topic_queue1接收到的消息为:======" + message);}
}
  • rabbitmq_consumer项目创建监听器:

package com.tingyi.rabbitmq.topic;
​
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
@RabbitListener(queues = "topic_queue2")
public class TestTopicListener2 {@RabbitHandlerpublic void testListener(String message) {System.out.println("======topic_queue2接收到的消息为:======" + message);}
}

6.7 模式总结RabbitMQ

工作模式:

1、简单模式 HelloWorld : 一个生产者、一个消费者,不需要设置交换机(使用默认的交换机)

2、工作队列模式 Work Queue: 一个生产者、多个消费者(竞争关系),不需要设置交换机(使用默认的交换机)

3、发布订阅模式 Publish/subscribe: 需要设置类型为fanout的交换机,并且交换机和队列进行绑定,当发送消息到交换机后,交换机会将消息发送到绑定的队列

4、路由模式 Routing: 需要设置类型为direct的交换机,交换机和队列进行绑定,并且指定routing key,当发送消息到交换机后,交换机会根据routing key将消息发送到对应的队列

5、通配符模式 Topic: 需要设置类型为topic的交换机,交换机和队列进行绑定,并且指定通配符方式的routing key,当发送消息到交换机后,交换机会根据routing key将消息发送到对应的队列

6.8 使用代码创建队列和交换机

6.8.1 初始化exchange、queue
  • 下面初始化队列和交换器类放在消费方和生产方都可以.

package com.tingyi.rabbitmq.config;
​
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
​
/*** @author 听忆*/
@Configuration
public class RabbitMQConfig {
​/*** 1. 创建exchange - topic* 第一个参数: 交换器名称* 第二个参数: 交换器是否持久化, 也就是服务器重启交换器是否自动删除* 第三个参数: 如果没有消费者, 交换器是否自动删除*/@Beanpublic TopicExchange getTopicExchange(){return new TopicExchange("boot-topic-exchange",true,false);}
​/*** 2. 创建queue* 第一个参数: 队列名称* 第二个参数: 队列是否持久化, 也就是服务器重启队列是否自动删除* 第三个参数: 是否排外的,有两个作用,*          1.当连接关闭时该队列是否会自动删除;*          2.该队列是否是私有的private,如果不是排外的,*              可以使用两个消费者都访问同一个队列,没有任何问题,如果是排外的,*              会对当前队列加锁,其他通道channel是不能访问的* 第四个参数: 队列是否自动删除, 也就是当没有消费者时, 队列是否自动删除* 第五个参数: 队列参数, 比如是否设置为延时队列等参数.*/@Beanpublic Queue getQueue(){return new Queue("boot-queue",true,false,false,null);}
​/*** 3. 队列和交换器绑定在一起*/@Beanpublic Binding getBinding(TopicExchange topicExchange,Queue queue){return BindingBuilder.bind(queue).to(topicExchange).with("*.red.*");}
}
6.8.2 发布消息到RabbitMQ
@Autowired
private RabbitTemplate rabbitTemplate;
​
@Test
public void testContextLoads() {rabbitTemplate.convertAndSend("boot-topic-exchange","slow.red.dog","听忆哇!!");
}
6.8.3 创建消费者监听消息
package com.tingyi.rabbitmq.topic;
​
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
​
/*** @author 听忆*/
@Component
public class Consumer {
​@RabbitListener(queues = "boot-queue")public void getMessage(Object message){System.out.println("接收到消息:" + message);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/39604.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

清理测试数据用truncate还是delete

truncate和delete的区别&#xff0c;我相信大家都清楚。 truncate会清空表的全部数据&#xff0c;且自增主键会重置&#xff1b;而delete可以按条件删除&#xff0c;且自增主键不会重置。 我们日常测试过程中经常要删除掉测试数据&#xff0c;那么应该用truncate删&#xff0c…

Java中继承接口和实现接口的区别、接口和抽象类的区别、并理解关键字interface、implements

初学者容易把继承接口和实现接口搞混&#xff0c;专门整理一下&#xff0c;顺便简单介绍一下interface、implements关键字。 继承接口和实现接口的区别、接口的特点 继承接口是说的只有接口才可以继承接口&#xff0c;是接口与接口间的。实现接口是说的接口与类之间&#xff…

Eclipse导入工程提示“No projects are found to import”

如果发现导入工程的时候出现"No projects are found to import" 的提示&#xff0c;首先查看项目目录中是否有隐藏文件.project&#xff0c;还有目录结构也还要有一个隐藏文件.classpath&#xff0c; 如果没有的解决办法。 方法1&#xff1a;可以把其它项目的.proje…

面试题--SpirngCloud

SpringCloud 有哪些核心组件?(必会)  Eureka: 注册中心, 服务注册和发现  Ribbon: 负载均衡, 实现服务调用的负载均衡  Hystrix: 熔断器  Feign: 远程调用  Zuul: 网关  Spring Cloud Config: 配置中心 (1)Eureka 提供服务注册和发现, 是注册中心. 有两个组…

【最新】App Inventor 2 学习平台和AI2伴侣使用

1、AppInventor2服务器&#xff1a; 官方服务器&#xff1a;http://ai2.appinventor.edu/ 官方备用服务器&#xff1a;http://code.appinventor.mit.edu/ 国内同步更新服务器&#xff1a;https://www.fun123.cn 国内访问速度很快&#xff0c;很稳定&#xff0c;文档是中文的…

Android11 系统/framework层禁止三方应用开机自启动。

背景介绍&#xff1a;客户给了定制的launcher&#xff0c;要求在设备上启动他们的launcher&#xff0c;实现过程中出现的问题是 开机引导还没走完&#xff0c;launcher就会自己弹出来打断开机引导&#xff0c;按道理来说launcher是在开机引导结束后&#xff0c;由开机引导通过i…

偏微分方程笔记(驻定与非驻定问题)

椭圆方程可以看成抛物方程 t → ∞ t\rightarrow\infty t→∞的情况。 抛物&#xff1a; 双曲&#xff1a;

什么是deep supervision?

Deep supervision 是深度学习中的一种技术&#xff0c;通常用于改进模型训练的效果&#xff0c;尤其是在训练深度神经网络时。它通过在模型的多个中间层添加辅助监督信号&#xff08;即额外的损失函数&#xff09;来实现。这种方法有助于缓解梯度消失问题&#xff0c;加速收敛&…

DolphinDB 蝉联 Gartner 中国实时数据管理代表厂商

报&#xff01;DolphinDB 又上榜啦&#xff01;&#xff01;&#xff01; 上月&#xff0c;全球知名信息技术研究公司 Gartner 发布了 Hype Cycle for Data, Analytics and AI in China, 2024 报告&#xff0c;以技术成熟度曲线&#xff08;Hype Cycle&#xff09;和优先级矩阵…

【NLP学习笔记】load_dataset加载数据

除了常见的load_dataset(<hf上的dataset名>)这种方式加载HF上的所有数据外&#xff0c;还有其他custom的选项。 加载HF上部分数据 from datasets import load_dataset c4_subset load_dataset("allenai/c4", data_files"en/c4-train.0000*-of-01024.js…

Spring Boot集成多数据源的最佳实践

Spring Boot集成多数据源的最佳实践 大家好&#xff0c;我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01; 为什么需要多数据源&#xff1f; 在实际的应用开发中&#xff0c;有时候…

【C++ Primer Plus学习记录】函数和C-风格字符串

将字符串作为参数时意味着传递的是地址&#xff0c;但可以使用const来禁止对字符串参数进行修改。 假设要将字符串作为参数传递给函数&#xff0c;则表示字符串的方式有三种&#xff1a; &#xff08;1&#xff09;char数组 &#xff08;2&#xff09;用引号括起来的字符串常…

航空数据管控系统-②项目分析与设计:任务1:需求分析-项目场景引入

任务描述 知识点&#xff1a;需求分析 重 点&#xff1a;原型设计工具&#xff0c;用例图&#xff0c;流程图绘制工具 难 点&#xff1a;功能点的梳理 内 容&#xff1a;完成本次实训项目的需求分析 先共同讨论处本项目的主要功能模块&#xff0c;并确定每个模块的负责…

通过卷防水上限,解锁手机的新玩法?IP68之间亦有不同

当手机的日常防水已经成了基本功&#xff0c;防水能力的上限便成了新的赛道。 毕竟再谨慎的人&#xff0c;也可能会有手滑的时候。这个时候&#xff0c;一台有着IP68级防水的手机&#xff0c;就能给你提供一份安心。 【IP68是标准上限&#xff0c;不是手机防水上限】 IP68是…

JAVA学习笔记2

一、加号使用 二、数据类型 bit&#xff1a;计算机中的最小存储单位 byte(字节):计算机中基本存储单元&#xff0c;1byte8bit 浮点数符号位指数位尾数位 浮点数默认为double类型

2024亚太杯中文赛B题全保姆教程

B题 洪水灾害的数据分析与预测 问题 1. 请分析附件 train.csv 中的数据&#xff0c;分析并可视化上述 20 个指标中&#xff0c;哪 些指标与洪水的发生有着密切的关联&#xff1f;哪些指标与洪水发生的相关性不大&#xff1f;并 分析可能的原因&#xff0c;然后针对洪水的提前预…

Teamviewer删除可信任设备

目前基本上主流的远程连接软件都有限制&#xff0c;要么收费&#xff1b; Teamviewer可信任设备有限&#xff0c;超出限制就会提示错误&#xff0c;需要删除多余的设备才能登陆账号&#xff01; 需要登陆这个网站 Teamviewer Management console&#xff0c;才能修改&#xff…

基于 STM32 的智能睡眠呼吸监测系统设计

本设计的硬件构成&#xff1a; STM32F103C8T6单片机最小系统板&#xff08;包含3.3V稳压电路时钟晶振电路复位电路&#xff08;上电自复位&#xff0c;手动复位&#xff09;&#xff09;&#xff0c;心率传感器、气压传感器、液晶显示、按键、蜂鸣器、LED灯、蓝牙模块组合而成…

【C++/STL深度剖析】priority_queue 最全解析(什么是priority_queue? priority_queue的常用接口有哪些?)

目录 一、前言 二、如何区分【优先级队列】与【队列】&#xff1f; 三、priority_queue的介绍 四、priority_queue 的构造 五、priority_queue 的常用接口 &#x1f4a7;push &#x1f4a7;pop &#x1f4a7;size &#x1f4a7;top &#x1f4a7;empty &…

YOLOv5改进 | 损失函数 | EIoU、SIoU、WIoU、DIoU、FocuSIoU等多种损失函数

秋招面试专栏推荐 &#xff1a;深度学习算法工程师面试问题总结【百面算法工程师】——点击即可跳转 &#x1f4a1;&#x1f4a1;&#x1f4a1;本专栏所有程序均经过测试&#xff0c;可成功执行&#x1f4a1;&#x1f4a1;&#x1f4a1; 专栏目录&#xff1a; 《YOLOv5入门 …