RabbitMQ的DLX(Dead-Letter-Exchange 死信交换机,死信交换器,死信邮箱)(重要)
RabbitMQ的DLX
- 1、RabbitMQ死信队列
- 2、代码示例
- 2.1、队列过期
- 2.1.1、配置类RabbitConfig(关键代码)
- 2.1.2、业务类MessageService
- 2.1.3、配置文件application.yml
- 2.1.4、启动类
- 2.1.5、配置文件
- 2.1.6、测试
- 2.2、消息过期
- 2.2.1、配置类RabbitConfig
- 2.2.2、业务类MessageService(关键代码)
- 2.2.3、配置文件application.yml
- 2.2.4、启动类同上
- 2.2.5、配置文件同上
- 2.2.6、测试
- 2.3、队列达到最大长度(先入队的消息会被发送到DLX)
- 2.3.1、配置类RabbitConfig(关键代码)
- 2.3.2、业务类MessageService(关键代码)
- 2.3.3、配置文件application.yml
- 2.3.4、启动类同上
- 2.3.5、配置文件pom.xml同上
- 2.3.6、测试
- 2.4、消费者拒绝消息不进行重新投递
- 2.4.1、生产者
- 2.4.1.1、生产者application.yml
- 2.4.1.2、生产者发送消息
- 2.4.1.3、生产者配置类
- 2.4.2、消费者
- 2.4.2.1、消费者application.yml 启动手动确认
- 关键配置
- 2.4.2.2、消费者接收消息
- 关键代码
- 2.4.3、测试
1、RabbitMQ死信队列
RabbitMQ死信队列也有叫 死信交换机、死信邮箱等说法。
DLX: Dead-Letter-Exchange 死信交换器,死信邮箱。
1-2、生产者发送一个消息到正常交换机
2-4、正常交换机接收到消息发送到正常队列
4、正常队列设置了队列过期时间,超时消息会自动删除
4-6、原本过期自动删除的消息发送到了死信交换机
6-8、死信交换机将消息发送到了死信队列
如上情况下一个消息会进入DLX(Dead Letter Exchange)死信交换机。
2、代码示例
2.1、队列过期
2.1.1、配置类RabbitConfig(关键代码)
package com.power.config;import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;@Configuration
public class RabbitConfig {@Value("${my.exchangeNormalName}")private String exchangeNormalName;@Value("${my.queueNormalName}")private String queueNormalName;@Value("${my.exchangeDlxName}")private String exchangeDlxName;@Value("${my.queueDlxName}")private String queueDlxName;/*** 正常交换机* @return*/@Beanpublic DirectExchange normalExchange(){return ExchangeBuilder.directExchange(exchangeNormalName).build();}/*** 正常队列* @return*/@Beanpublic Queue normalQueue(){Map<String, Object> arguments = new HashMap<>();arguments.put("x-message-ttl",20000);//设置队列的过期时间为20秒//重点:设置这两个参数arguments.put("x-dead-letter-exchange",exchangeDlxName); //设置队列的死信交换机arguments.put("x-dead-letter-routing-key","error");//设置死信路由key,要跟死信交换机和死信队列绑定的路由key一致return QueueBuilder.durable(queueNormalName).withArguments(arguments) //设置队列的过期时间.build();}/*** 正常交换机和正常队列绑定* @param normalExchange* @param normalQueue* @return*/@Beanpublic Binding bingNormal(DirectExchange normalExchange,Queue normalQueue){return BindingBuilder.bind(normalQueue).to(normalExchange).with("order");}/*** 死信交换机* @return*/@Beanpublic DirectExchange dlxExchange(){return ExchangeBuilder.directExchange(exchangeDlxName).build();}/*** 死信队列* @return*/@Beanpublic Queue dlxQueue(){return QueueBuilder.durable(queueDlxName).build();}/*** 死信交换机和死信队列绑定* @param dlxExchange* @param dlxQueue* @return*/@Beanpublic Binding bindDlx(DirectExchange dlxExchange,Queue dlxQueue){return BindingBuilder.bind(dlxQueue).to(dlxExchange).with("error");}
}
2.1.2、业务类MessageService
package com.power.service;import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.Date;@Service
@Slf4j
public class MessageService {@Resourceprivate RabbitTemplate rabbitTemplate;@Beanpublic void sendMsg(){Message message = MessageBuilder.withBody("hello world".getBytes()).build();rabbitTemplate.convertAndSend("exchange.normal.a","order",message);log.info("消息发送完毕,发送时间是:"+new Date());}
}
2.1.3、配置文件application.yml
server:port: 8080
spring:application:name: dlx-test01rabbitmq:host: 你的服务器IPport: 5672username: 你的账号password: 你的密码virtual-host: powermy:exchangeNormalName: exchange.normal.a #正常交换机queueNormalName: queue.normal.a #正常队列,没有消费组,设置过期时间exchangeDlxName: exchange.dlx.a #死信交换机queueDlxName: queue.dlx.a #死信队列
2.1.4、启动类
package com.power;import com.power.service.MessageService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;import javax.annotation.Resource;@SpringBootApplication
public class Application implements ApplicationRunner {@Resourceprivate MessageService messageService;public static void main(String[] args) {SpringApplication.run(Application.class);}@Overridepublic void run(ApplicationArguments args) throws Exception {messageService.sendMsg();}
}
2.1.5、配置文件
<?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"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_06_dlx01</artifactId><version>1.0-SNAPSHOT</version><name>rabbit_06_dlx01</name><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.1.6、测试
启动程序,发送消息:

消息会先被发送到正常队列queue.normal.a中,超时未被消费,
则消息会被发送到死信队列queue.dlx.a 中

2.2、消息过期
2.2.1、配置类RabbitConfig
package com.power.config;import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;@Configuration
public class RabbitConfig {@Value("${my.exchangeNormalName}")private String exchangeNormalName;@Value("${my.queueNormalName}")private String queueNormalName;@Value("${my.exchangeDlxName}")private String exchangeDlxName;@Value("${my.queueDlxName}")private String queueDlxName;/*** 正常交换机* @return*/@Beanpublic DirectExchange normalExchange(){return ExchangeBuilder.directExchange(exchangeNormalName).build();}/*** 正常队列* @return*/@Beanpublic Queue normalQueue(){Map<String, Object> arguments = new HashMap<>();//重点:设置这两个参数//设置队列的死信交换机arguments.put("x-dead-letter-exchange",exchangeDlxName);//设置死信路由key,要跟死信交换机和死信队列绑定的路由key一致arguments.put("x-dead-letter-routing-key","error");return QueueBuilder.durable(queueNormalName).withArguments(arguments) //设置队列的过期时间.build();}/*** 正常交换机和正常队列绑定* @param normalExchange* @param normalQueue* @return*/@Beanpublic Binding bingNormal(DirectExchange normalExchange,Queue normalQueue){return BindingBuilder.bind(normalQueue).to(normalExchange).with("order");}/*** 死信交换机* @return*/@Beanpublic DirectExchange dlxExchange(){return ExchangeBuilder.directExchange(exchangeDlxName).build();}/*** 死信队列* @return*/@Beanpublic Queue dlxQueue(){return QueueBuilder.durable(queueDlxName).build();}/*** 死信交换机和死信队列绑定* @param dlxExchange* @param dlxQueue* @return*/@Beanpublic Binding bindDlx(DirectExchange dlxExchange,Queue dlxQueue){return BindingBuilder.bind(dlxQueue).to(dlxExchange).with("error");}
}
2.2.2、业务类MessageService(关键代码)
package com.power.service;import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.Date;@Service
@Slf4j
public class MessageService {@Resourceprivate RabbitTemplate rabbitTemplate;@Beanpublic void sendMsg(){try {MessageProperties messageProperties = new MessageProperties();//设置单条消息的过期时间,单位为毫秒,数据类型为字符串messageProperties.setExpiration("20000");Message message = MessageBuilder.withBody("hello world".getBytes()).andProperties(messageProperties).build();rabbitTemplate.convertAndSend("exchange.normal.02","order",message);}catch (Exception e){e.printStackTrace();log.info("消息发送失败:"+new Date());}log.info("消息发送完毕,发送时间是:"+new Date());}
}
2.2.3、配置文件application.yml
server:port: 8080
spring:application:name: dlx-test01rabbitmq:host: 你的服务器IPport: 5672username: 你的账号password: 你的密码virtual-host: powermy:exchangeNormalName: exchange.normal.02 #正常交换机queueNormalName: queue.normal.02 #正常队列,没有消费组,设置过期时间exchangeDlxName: exchange.dlx.02 #死信交换机queueDlxName: queue.dlx.02 #死信队列
2.2.4、启动类同上
2.2.5、配置文件同上
2.2.6、测试
启动程序发送消息

登录rabbitmq后台:
消息先进入正常队列queue.normal.02中,超时未消费,
消息超过过期时间,则进入queue.dlx.02死信队列

2.3、队列达到最大长度(先入队的消息会被发送到DLX)
2.3.1、配置类RabbitConfig(关键代码)
package com.power.config;import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;@Configuration
public class RabbitConfig {@Value("${my.exchangeNormalName}")private String exchangeNormalName;@Value("${my.queueNormalName}")private String queueNormalName;@Value("${my.exchangeDlxName}")private String exchangeDlxName;@Value("${my.queueDlxName}")private String queueDlxName;/*** 正常交换机* @return*/@Beanpublic DirectExchange normalExchange(){return ExchangeBuilder.directExchange(exchangeNormalName).build();}/*** 正常队列* @return*/@Beanpublic Queue normalQueue(){Map<String, Object> arguments = new HashMap<>();//设置队列的最大长度arguments.put("x-max-length",5);//重点:设置这两个参数//设置队列的死信交换机arguments.put("x-dead-letter-exchange",exchangeDlxName);//设置死信路由key,要跟死信交换机和死信队列绑定的路由key一致arguments.put("x-dead-letter-routing-key","error");return QueueBuilder.durable(queueNormalName).withArguments(arguments) //设置队列的参数.build();}/*** 正常交换机和正常队列绑定* @param normalExchange* @param normalQueue* @return*/@Beanpublic Binding bingNormal(DirectExchange normalExchange,Queue normalQueue){return BindingBuilder.bind(normalQueue).to(normalExchange).with("order");}/*** 死信交换机* @return*/@Beanpublic DirectExchange dlxExchange(){return ExchangeBuilder.directExchange(exchangeDlxName).build();}/*** 死信队列* @return*/@Beanpublic Queue dlxQueue(){return QueueBuilder.durable(queueDlxName).build();}/*** 死信交换机和死信队列绑定* @param dlxExchange* @param dlxQueue* @return*/@Beanpublic Binding bindDlx(DirectExchange dlxExchange,Queue dlxQueue){return BindingBuilder.bind(dlxQueue).to(dlxExchange).with("error");}
}
2.3.2、业务类MessageService(关键代码)
package com.power.service;import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.Date;@Service
@Slf4j
public class MessageService {@Resourceprivate RabbitTemplate rabbitTemplate;@Beanpublic void sendMsg(){for (int i = 1; i < 8; i++) {String msg = "hello world "+ i;Message message = MessageBuilder.withBody(msg.getBytes()).build();rabbitTemplate.convertAndSend("exchange.normal.03","order",message);log.info("消息发送完毕,发送时间是:"+new Date());}}
}
2.3.3、配置文件application.yml
server:port: 8080
spring:application:name: dlx-test01rabbitmq:host: 你的服务器IPport: 5672username: 你的账号password: 你的密码virtual-host: powermy:exchangeNormalName: exchange.normal.03 #正常交换机queueNormalName: queue.normal.03 #正常队列,没有消费组,设置过期时间exchangeDlxName: exchange.dlx.03 #死信交换机queueDlxName: queue.dlx.03 #死信队列
2.3.4、启动类同上
2.3.5、配置文件pom.xml同上
2.3.6、测试
启动项目,发送消息

登录rabbitmq后台:
两条消息进入死信队列
查看消息发现,是前两条消息进入了死信队列,


2.4、消费者拒绝消息不进行重新投递
消费者从正常的队列接收消息,但是消费者对消息不进行确认,并且不对消息进行重新投递,此时消息就进入死信队列。
2.4.1、生产者

2.4.1.1、生产者application.yml
server:port: 8080
spring:application:name: dlx-test04rabbitmq:host: 你的服务器IPport: 5672username: 你的账号password: 你的密码virtual-host: powermy:exchangeNormalName: exchange.normal.04 #正常交换机queueNormalName: queue.normal.04 #正常队列,没有消费组,设置过期时间exchangeDlxName: exchange.dlx.04 #死信交换机queueDlxName: queue.dlx.04 #死信队列
2.4.1.2、生产者发送消息
package com.power.service;import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.Date;@Service
@Slf4j
public class MessageService {@Resourceprivate RabbitTemplate rabbitTemplate;@Beanpublic void sendMsg(){String msg = "hello world";Message message = MessageBuilder.withBody(msg.getBytes()).build();rabbitTemplate.convertAndSend("exchange.normal.04","order",message);log.info("消息发送完毕,发送时间是:"+new Date());}
}
2.4.1.3、生产者配置类
package com.power.config;import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.util.HashMap;
import java.util.Map;@Configuration
public class RabbitConfig {@Value("${my.exchangeNormalName}")private String exchangeNormalName;@Value("${my.queueNormalName}")private String queueNormalName;@Value("${my.exchangeDlxName}")private String exchangeDlxName;@Value("${my.queueDlxName}")private String queueDlxName;/*** 正常交换机* @return*/@Beanpublic DirectExchange normalExchange(){return ExchangeBuilder.directExchange(exchangeNormalName).build();}/*** 正常队列* @return*/@Beanpublic Queue normalQueue(){Map<String, Object> arguments = new HashMap<>();//重点:设置这两个参数//设置队列的死信交换机arguments.put("x-dead-letter-exchange",exchangeDlxName);//设置死信路由key,要跟死信交换机和死信队列绑定的路由key一致arguments.put("x-dead-letter-routing-key","error");return QueueBuilder.durable(queueNormalName).withArguments(arguments) //设置队列的参数.build();}/*** 正常交换机和正常队列绑定* @param normalExchange* @param normalQueue* @return*/@Beanpublic Binding bingNormal(DirectExchange normalExchange,Queue normalQueue){return BindingBuilder.bind(normalQueue).to(normalExchange).with("order");}/*** 死信交换机* @return*/@Beanpublic DirectExchange dlxExchange(){return ExchangeBuilder.directExchange(exchangeDlxName).build();}/*** 死信队列* @return*/@Beanpublic Queue dlxQueue(){return QueueBuilder.durable(queueDlxName).build();}/*** 死信交换机和死信队列绑定* @param dlxExchange* @param dlxQueue* @return*/@Beanpublic Binding bindDlx(DirectExchange dlxExchange,Queue dlxQueue){return BindingBuilder.bind(dlxQueue).to(dlxExchange).with("error");}
}
2.4.2、消费者

2.4.2.1、消费者application.yml 启动手动确认
server:port: 9090
spring:application:name: dlx04-receiverrabbitmq:host: 你的服务器IPport: 5672username: 你的账号password: 你的密码virtual-host: powerlistener:simple:acknowledge-mode: manual
关键配置

2.4.2.2、消费者接收消息
package com.power.service;import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;import java.io.IOException;
import java.util.Date;@Component
@Slf4j
public class MessageReceive {@RabbitListener(queues={"queue.normal.04"})public void receiveMsg(Message message, Channel channel){//获取消息属性MessageProperties messageProperties = message.getMessageProperties();//获取消息的唯一标识,类似学号和身份证号long deliveryTag = messageProperties.getDeliveryTag();try{byte[] body = message.getBody();String msg = new String(body);log.info("监听到的消息是:"+msg+",接收的时间是:"+new Date());//TODO 业务逻辑处理int a=1/0;//消费者的手动确认,false:只确认当前消息,true:批量确认channel.basicAck(deliveryTag,false);}catch (Exception e){log.error("接收者出现问题:{}",e.getMessage());try {//消费者的手动不确认,参数3:是重新入队//不会进入死信队列
// channel.basicNack(deliveryTag,false,true);//消费者的手动不确认,参数3:false 不重新入队(不重新投递),就会变成死信channel.basicNack(deliveryTag,false,false);}catch (IOException ex){throw new RuntimeException(ex);}}}}
关键代码

2.4.3、测试
启动生产者:发送消息

启动消费者:
因业务代码出错,程序处理异常,消息进入死信队列


相关文章:
RabbitMQ的DLX(Dead-Letter-Exchange 死信交换机,死信交换器,死信邮箱)(重要)
RabbitMQ的DLX 1、RabbitMQ死信队列2、代码示例2.1、队列过期2.1.1、配置类RabbitConfig(关键代码)2.1.2、业务类MessageService2.1.3、配置文件application.yml2.1.4、启动类2.1.5、配置文件2.1.6、测试 2.2、消息过期2.2.1、配置类RabbitConfig2.2.2、…...
【STM32F1】——舵机角度控制与TIM定时器
【STM32F1】——舵机角度控制与TIM定时器 一、简介 本篇主要对舵机DS-S002M模块调试过程进行总结,实现了以下功能: 1)舵机转动角度的控制:利用STM32F103C8T6的TIM定时器产生PWM信号控制舵机DS-S002M转动一定的角度。 二、DS-S002M数字舵机介绍 电压:4.8-6.0V操作角度:…...
想要成为独立游戏作者 :通关!游戏设计之道 2-1 HUD
HUD特指显示屏幕上的信息,在是UI的子集,UI是一个游戏中虽有的交互元素的总称 本文用了大量ai总结 + 个人微调,不喜勿喷,前篇如下想要成为独立游戏作者 :通关!游戏设计之道 1-4 操作篇-C…...
sql专题 之 三大范式
文章目录 背景范式介绍第一范式:属性不可再分第二范式第三范式注意事项 为什么不遵循后续的范式数据库范式在实际应用中会遇到哪些挑战? 背景 数据库的范式(Normal Form)是一组规则,用于设计数据库表结构以 减少数据冗…...
node.js安装和配置教程
软件介绍 Node.js是一个免费的、开源的、跨平台的JavaScript运行时环境,允许开发人员在浏览器之外编写命令行工具和服务器端脚本。 Node.js是一个基于Chrome JavaScript运行时建立的一个平台。 Node.js是一个事件驱动I/O服务端JavaScript环境,基于Goo…...
定时器输入捕获实验配置
首先,第一个时基工作参数配置 HAL_TIM_IC_Init( ) 还是一样的套路,传参是一个句柄,先定义一个结构体 Instance:指向TIM_TypeDef的指针,表示定时器的实例。TIM_TypeDef是一个包含了定时器寄存器的结构体,用…...
【C/C++】memcpy函数的使用
零.导言 当我们学习了strcpy和strncpy函数后,也许会疑惑整形数组要如何拷贝,而今天我将讲解的memcpy函数便可以拷贝整形数组。 一.memcpy函数的使用 memcpy函数是一种C语言内存函数,可以按字节拷贝任意类型的数组,比如整形数组。 …...
spring-security(两种权限控制方式)
案例(写死的用户密码) package com.zking.security.service;import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.User; import org.sp…...
【mongodb】数据库的安装及连接初始化简明手册
NoSQL(NoSQL Not Only SQL ),意即"不仅仅是SQL"。 在现代的计算系统上每天网络上都会产生庞大的数据量。这些数据有很大一部分是由关系数据库管理系统(RDBMS)来处理。 通过应用实践证明,关系模型是非常适合于客户服务器…...
【科普】卷积、卷积核、池化、激活函数、全连接分别是什么?有什么用?
概念定义作用/用途解释举例卷积 (Convolution)是一种数学操作,通过在输入数据(如图片)上滑动卷积核,计算局部区域的加权和。提取数据中的局部特征,例如边缘、角点等。卷积就像在图片上滑动一个小的窗口,计算…...
距离向量路由选择协议和链路状态路由选择协议介绍
距离向量路由选择协议(Distance Vector Routing Protocol)和链路状态路由选择协议(Link-State Routing Protocol)是两种主要的网关协议,它们用于在网络内部选择数据传输的最佳路径。下面分别介绍这两种协议:…...
【AI大模型】大型语言模型LLM基础概览:技术原理、发展历程与未来展望
目录 🍔 大语言模型 (LLM) 背景 🍔 语言模型 (Language Model, LM) 2.1 基于规则和统计的语言模型(N-gram) 2.2 神经网络语言模型 2.3 基于Transformer的预训练语言模型 2.4 大语言模型 🍔 语言模型的评估指标 …...
ubuntu 22.04 server 安装 和 初始化 LTS
ubuntu 22.04 server 安装 和 初始化 下载地址 https://releases.ubuntu.com/jammy/ 使用的镜像是 ubuntu-22.04.5-live-server-amd64.iso usb 启动盘制作工具 https://rufus.ie/zh/ rufus-4.6p.exe 需要主板 支持 UEFI 启动 Ubuntu22.04.4-server安装 流程 https://b…...
大数据机器学习算法与计算机视觉应用03:数据流
Data Stream Streaming ModelExample Streaming QuestionsHeavy HittersAlgorithm 1: For Majority elementMisra Gries AlgorithmApplicationsApproximation of count Streaming Model 数据流模型 数据流就是所有的数据先后到达,而不是同时存储在内存之中。在现…...
【代码随想录day25】【C++复健】491.递增子序列;46.全排列;47.全排列 II;51. N皇后;37. 解数独
491.递增子序列 本题做的时候除了去重逻辑之外,其他的也勉强算是写出来了,不过还是有问题的,总结如下: 1 本题的关键:去重 与其说是不知道用什么去重,更应该说是完全没想到本题需要去重,说明…...
AI智能识物(微信小程序)
AI智能识物,是一款实用的小程序。可以拍照智能识物,可识别地标、车型、花卉、植物、动物、果蔬、货币、红酒、食材等等,AI智能技术识别准确度高。 更新说明: 此源码为1.2.0版本。 主要更新内容:新增security.imgSec…...
游戏引擎学习第三天
视频参考:https://www.bilibili.com/video/BV1XTmqYSEtm/ 之前的程序不能退出,下面写关闭窗体的操作 PostQuitMessage 是 Windows API 中的一个函数,用于向当前线程的消息队列发送一个退出消息。其作用是请求应用程序退出消息循环,通常用于处…...
帝国CMS7.5仿模板堂柒喜模板建站网 素材资源下载站源码
环境要求:phpmysql、支付伪静态 本套模板采用帝国cms7.5版UTF-8开发,一款非常不错的高端建站源码模板, 适用于中小型网络建站工作室源码模板下载站,支持自定义设置会员组。 源码下载:https://download.csdn.net/down…...
聊一聊Spring中的自定义监听器
前言 通过一个简单的自定义的监听器,从源码的角度分一下Spring中监听的整个过程,分析监听的作用。 一、自定义监听案例 1.1定义事件 package com.lazy.snail;import lombok.Getter; import org.springframework.context.ApplicationEvent;/*** Class…...
【王木头】最大似然估计、最大后验估计
目录 一、最大似然估计(MLE) 二、最大后验估计(MAP) 三、MLE 和 MAP 的本质区别 四、当先验是均匀分布时,MLE 和 MAP 等价 五、总结 本文理论参考王木头的视频: 贝叶斯解释“L1和L2正则化”ÿ…...
【Axure高保真原型】引导弹窗
今天和大家中分享引导弹窗的原型模板,载入页面后,会显示引导弹窗,适用于引导用户使用页面,点击完成后,会显示下一个引导弹窗,直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...
【Oracle APEX开发小技巧12】
有如下需求: 有一个问题反馈页面,要实现在apex页面展示能直观看到反馈时间超过7天未处理的数据,方便管理员及时处理反馈。 我的方法:直接将逻辑写在SQL中,这样可以直接在页面展示 完整代码: SELECTSF.FE…...
三维GIS开发cesium智慧地铁教程(5)Cesium相机控制
一、环境搭建 <script src"../cesium1.99/Build/Cesium/Cesium.js"></script> <link rel"stylesheet" href"../cesium1.99/Build/Cesium/Widgets/widgets.css"> 关键配置点: 路径验证:确保相对路径.…...
MySQL 隔离级别:脏读、幻读及不可重复读的原理与示例
一、MySQL 隔离级别 MySQL 提供了四种隔离级别,用于控制事务之间的并发访问以及数据的可见性,不同隔离级别对脏读、幻读、不可重复读这几种并发数据问题有着不同的处理方式,具体如下: 隔离级别脏读不可重复读幻读性能特点及锁机制读未提交(READ UNCOMMITTED)允许出现允许…...
2025年能源电力系统与流体力学国际会议 (EPSFD 2025)
2025年能源电力系统与流体力学国际会议(EPSFD 2025)将于本年度在美丽的杭州盛大召开。作为全球能源、电力系统以及流体力学领域的顶级盛会,EPSFD 2025旨在为来自世界各地的科学家、工程师和研究人员提供一个展示最新研究成果、分享实践经验及…...
【HarmonyOS 5.0】DevEco Testing:鸿蒙应用质量保障的终极武器
——全方位测试解决方案与代码实战 一、工具定位与核心能力 DevEco Testing是HarmonyOS官方推出的一体化测试平台,覆盖应用全生命周期测试需求,主要提供五大核心能力: 测试类型检测目标关键指标功能体验基…...
基于Flask实现的医疗保险欺诈识别监测模型
基于Flask实现的医疗保险欺诈识别监测模型 项目截图 项目简介 社会医疗保险是国家通过立法形式强制实施,由雇主和个人按一定比例缴纳保险费,建立社会医疗保险基金,支付雇员医疗费用的一种医疗保险制度, 它是促进社会文明和进步的…...
学校招生小程序源码介绍
基于ThinkPHPFastAdminUniApp开发的学校招生小程序源码,专为学校招生场景量身打造,功能实用且操作便捷。 从技术架构来看,ThinkPHP提供稳定可靠的后台服务,FastAdmin加速开发流程,UniApp则保障小程序在多端有良好的兼…...
基于Docker Compose部署Java微服务项目
一. 创建根项目 根项目(父项目)主要用于依赖管理 一些需要注意的点: 打包方式需要为 pom<modules>里需要注册子模块不要引入maven的打包插件,否则打包时会出问题 <?xml version"1.0" encoding"UTF-8…...
c#开发AI模型对话
AI模型 前面已经介绍了一般AI模型本地部署,直接调用现成的模型数据。这里主要讲述讲接口集成到我们自己的程序中使用方式。 微软提供了ML.NET来开发和使用AI模型,但是目前国内可能使用不多,至少实践例子很少看见。开发训练模型就不介绍了&am…...
