java中使用rabbitmq

文章目录

  • 前言
  • 一、引入和配置
    • 1.引入
    • 2.配置
  • 二、使用
    • 1.队列
    • 2.发布/订阅
      • 2.1 fanout(广播)
      • 2.2 direct(Routing/路由)
      • 2.3 Topics(主题)
      • 2.4 Headers
  • 总结


前言

mq常用于业务解耦、流量削峰和异步通信,rabbitmq是使用范围较广,比较稳定的一款开源产品,接下来我们使用springboot的starter来引入rabbitmq,了解mq的几种使用模式,通过几个简单的案例,让你可以快速地了解到该使用哪种模式来对应业务场景,使用rabbitmq看这一篇就够了,下方附安装链接。


一、引入和配置

1.引入

Spring AMQP高级消息队列协议有两部分组成,spring-amqp是基础抽象,spring-rabbit是RabbitMQ实现。

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

在这里插入图片描述

2.配置

配置参考RabbitProperties.java

spring:
  rabbitmq:
    host: 192.168.137.192
    port: 5672
    username: guest
    password: guest
    virtualHost: /

二、使用

1.队列

在这里插入图片描述
RabbitConfiguration

package com.student.rabbit.queue;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.amqp.core.Queue;
/**
 * Create by zjg on 2024/3/9
 */
@Configuration
public class RabbitConfiguration {
    protected final String queueName = "queue";
    @Bean
    public Queue queue() {
        return new Queue(this.queueName);
    }
}

Producer

package rabbit.queue;

import com.student.SpringbootStart;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.Queue;
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;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Create by zjg on 2024/3/9
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootStart.class)
public class Producer {
    @Autowired
    private RabbitTemplate template;
    @Autowired
    private Queue queue;

    AtomicInteger count = new AtomicInteger(0);
    @Test
    public void send() {
        for (int i = 0; i < 10; i++) {
            StringBuilder builder = new StringBuilder("Hello");
            builder.append(" "+count.incrementAndGet());
            String message = builder.toString();
            template.convertAndSend(queue.getName(), message);
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}

Consumer

package com.student.rabbit.queue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Create by zjg on 2024/3/9
 */
@Component
public class Consumer {
    private static final Logger log = LoggerFactory.getLogger(Consumer.class);
    protected final String queueName = "queue";
    @RabbitListener(queues = queueName)
    public void receive1(String message){
        log.debug("receive1:"+message);
    }
    @RabbitListener(queues = queueName)
    public void receive2(String message){
        log.debug("receive2:"+message);
    }
}

每个队列都消费了5条消息
在这里插入图片描述

2.发布/订阅

交换机类型有fanout,direct, topic, headers四种,接下来我们来学习每种方式的使用以及它们的区别。

2.1 fanout(广播)

P(生产者)产生消息给到X(交换机),X分发给绑定的所有队列。

在这里插入图片描述

RabbitFanoutConfiguration
我们定义了AnonymousQueue,它创建了一个具有生成名称的非持久、独占、自动删除队列

package com.student.rabbit.fanout;

import org.springframework.amqp.core.AnonymousQueue;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Create by zjg on 2024/3/10
 */
@Configuration
public class RabbitFanoutConfiguration {
    @Bean
    public FanoutExchange fanout() {
        return new FanoutExchange("sys.fanout");
    }
    private static class ReceiverConfig {
        @Bean
        public Queue fanoutQueue1() {
            return new AnonymousQueue();
        }
        @Bean
        public Queue fanoutQueue2() {
            return new AnonymousQueue();
        }
        @Bean
        public Binding bindingFanout1(FanoutExchange fanout,Queue fanoutQueue1) {
            return BindingBuilder.bind(fanoutQueue1).to(fanout);
        }
        @Bean
        public Binding bindingFanout2(FanoutExchange fanout,Queue fanoutQueue2) {
            return BindingBuilder.bind(fanoutQueue2).to(fanout);
        }
    }
}


FanoutProducer

package rabbit.fanout;

import com.student.SpringbootStart;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.FanoutExchange;
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;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Create by zjg on 2024/3/10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootStart.class)
public class FanoutProducer {
    @Autowired
    private RabbitTemplate template;
    @Autowired
    private FanoutExchange fanout;
    @Test
    public void send() {
        AtomicInteger count = new AtomicInteger(0);
        for (int i = 0; i < 10; i++) {
            StringBuilder builder = new StringBuilder("Hello");
            builder.append(" "+count.incrementAndGet());
            String message = builder.toString();
            template.convertAndSend(fanout.getName(), "", message);
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}

FanoutConsumer

package com.student.rabbit.fanout;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Create by zjg on 2024/3/10
 */
@Component
public class FanoutConsumer {
    private static final Logger log = LoggerFactory.getLogger(FanoutConsumer.class);
    @RabbitListener(queues = "#{fanoutQueue1.name}")
    public void receive1(String message){
        log.debug("receive1:"+message);
    }
    @RabbitListener(queues = "#{fanoutQueue2.name}")
    public void receive2(String message){
        log.debug("receive2:"+message);
    }
}

总共发送10条消息,每个队列都消费了10条
在这里插入图片描述

2.2 direct(Routing/路由)

可以将根据不同的路由规则分发消息,很灵活,消费者需要哪种就订阅哪种消息。

在这里插入图片描述
在这里插入图片描述
RabbitDirectConfiguration

package com.student.rabbit.direct;

import org.springframework.amqp.core.AnonymousQueue;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Create by zjg on 2024/3/10
 */
@Configuration
public class RabbitDirectConfiguration {
    @Bean
    public DirectExchange direct() {
        return new DirectExchange("sys.direct");
    }

    private static class ReceiverConfig {
        @Bean
        public Queue directQueue1() {
            return new AnonymousQueue();
        }
        @Bean
        public Queue directQueue2() {
            return new AnonymousQueue();
        }
        @Bean
        public Binding bindingDirect1a(DirectExchange direct,Queue directQueue1) {
            return BindingBuilder.bind(directQueue1).to(direct).with("orange");
        }
        @Bean
        public Binding bindingDirect1b(DirectExchange direct,Queue directQueue1) {
            return BindingBuilder.bind(directQueue1).to(direct).with("black");
        }
        @Bean
        public Binding bindingDirect2a(DirectExchange direct,Queue directQueue2) {
            return BindingBuilder.bind(directQueue2).to(direct).with("green");
        }
        @Bean
        public Binding bindingDirect2b(DirectExchange direct,Queue directQueue2) {
            return BindingBuilder.bind(directQueue2).to(direct).with("black");
        }
    }
}


DirectProducer

package rabbit.direct;

import com.student.SpringbootStart;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.DirectExchange;
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;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Create by zjg on 2024/3/10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootStart.class)
public class DirectProducer {
    @Autowired
    private RabbitTemplate template;
    @Autowired
    private DirectExchange direct;
    private final String[] keys = {"orange", "black", "green"};
    @Test
    public void send() {
        AtomicInteger count = new AtomicInteger(0);
        for (int i = 0; i < keys.length; i++) {
            StringBuilder builder = new StringBuilder("Hello to ");
            String key = keys[count.getAndIncrement()];
            builder.append(" "+key);
            String message = builder.toString();
            template.convertAndSend(direct.getName(), key, message);
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}

DirectConsumer

package com.student.rabbit.direct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Create by zjg on 2024/3/10
 */
@Component
public class DirectConsumer {
    private static final Logger log = LoggerFactory.getLogger(DirectConsumer.class);
    @RabbitListener(queues = "#{directQueue1.name}")
    public void receive1(String message){
        log.debug("receive1:"+message);
    }
    @RabbitListener(queues = "#{directQueue2.name}")
    public void receive2(String message){
        log.debug("receive2:"+message);
    }
}

共发送了3条消息,有两个队列都绑定了black,所以black的消息消费2次
在这里插入图片描述

2.3 Topics(主题)

主题模式在路由的基础上增加了routingKey的模糊匹配。
*(星)可以代替一个词。
#(hash)可以代替零个或多个单词。

在这里插入图片描述
RabbitTopicConfiguration

package com.student.rabbit.topic;

import org.springframework.amqp.core.AnonymousQueue;
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;

/**
 * Create by zjg on 2024/3/10
 */
@Configuration
public class RabbitTopicConfiguration {
    @Bean
    public TopicExchange topic() {
        return new TopicExchange("sys.topic");
    }

    private static class ReceiverConfig {
        @Bean
        public Queue topicQueue1() {
            return new AnonymousQueue();
        }
        @Bean
        public Queue topicQueue2() {
            return new AnonymousQueue();
        }
        @Bean
        public Binding bindingTopic1a(TopicExchange topic,Queue topicQueue1) {
            return BindingBuilder.bind(topicQueue1).to(topic).with("*.orange.*");
        }
        @Bean
        public Binding bindingTopic1b(TopicExchange topic,Queue topicQueue1) {
            return BindingBuilder.bind(topicQueue1).to(topic).with("*.*.rabbit");
        }
        @Bean
        public Binding bindingTopic2a(TopicExchange topic,Queue topicQueue2) {
            return BindingBuilder.bind(topicQueue2).to(topic).with("lazy.#");
        }
        @Bean
        public Binding bindingTopic2b(TopicExchange topic,Queue topicQueue2) {
            return BindingBuilder.bind(topicQueue2).to(topic).with("quick.brown.*");
        }
    }
}


TopicProducer

package rabbit.topic;

import com.student.SpringbootStart;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.TopicExchange;
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;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Create by zjg on 2024/3/10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootStart.class)
public class TopicProducer {
    @Autowired
    private RabbitTemplate template;
    @Autowired
    private TopicExchange topic;
    private final String[] keys = {"quick.orange.rabbit", "lazy.orange.elephant", "quick.orange.fox",
            "lazy.brown.fox", "lazy.pink.rabbit", "quick.brown.fox"};
    @Test
    public void send() {
        AtomicInteger count = new AtomicInteger(0);
        for (int i = 0; i < keys.length; i++) {
            StringBuilder builder = new StringBuilder("Hello to ");
            String key = keys[count.getAndIncrement()];
            builder.append(" "+key);
            String message = builder.toString();
            template.convertAndSend(topic.getName(), key, message);
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}

TopicConsumer

package com.student.rabbit.topic;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Create by zjg on 2024/3/10
 */
@Component
public class TopicConsumer {
    private static final Logger log = LoggerFactory.getLogger(TopicConsumer.class);
    @RabbitListener(queues = "#{topicQueue1.name}")
    public void receive1(String message){
        log.debug("receive1:"+message);
    }
    @RabbitListener(queues = "#{topicQueue2.name}")
    public void receive2(String message){
        log.debug("receive2:"+message);
    }
}

队列1匹配了中间值为orange和rabbit结尾的消息,队列2匹配了lazy开头和quick.brown开头的消息
在这里插入图片描述

2.4 Headers

关于headers模式,在官方没有找到文档,但包里还有,索性还是写一下吧。

RabbitHeadersConfiguration

package com.student.rabbit.headers;

import org.springframework.amqp.core.AnonymousQueue;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.HeadersExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;

/**
 * Create by zjg on 2024/3/10
 */
@Configuration
public class RabbitHeadersConfiguration {
    @Bean
    public HeadersExchange headers() {
        return new HeadersExchange("sys.headers");
    }

    private static class ReceiverConfig {
        @Bean
        public Queue headersQueue1() {
            return new AnonymousQueue();
        }
        @Bean
        public Queue headersQueue2() {
            return new AnonymousQueue();
        }
        @Bean
        public Queue headersQueue3() {
            return new AnonymousQueue();
        }
        @Bean
        public Binding bindingHeaders1(HeadersExchange headers,Queue headersQueue1) {
            Map<String,Object> headerValue=new HashMap<>();
            headerValue.put("user","sys");
            return BindingBuilder.bind(headersQueue1).to(headers).whereAll(headerValue).match();
        }
        @Bean
        public Binding bindingHeaders2(HeadersExchange headers,Queue headersQueue2) {
            Map<String,Object> headerValue=new HashMap<>();
            headerValue.put("user","admin");
            return BindingBuilder.bind(headersQueue2).to(headers).whereAll(headerValue).match();
        }
        @Bean
        public Binding bindingHeaders3(HeadersExchange headers,Queue headersQueue3) {
            return BindingBuilder.bind(headersQueue3).to(headers).where("user").exists();
        }
    }
}

HeadersProducer

package rabbit.headers;

import com.student.SpringbootStart;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.core.HeadersExchange;
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.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Create by zjg on 2024/3/10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootStart.class)
public class HeadersProducer {
    @Autowired
    private RabbitTemplate template;
    @Autowired
    private HeadersExchange headers;
    private final String[] keys = {"sys", "admin"};
    @Test
    public void send() {
        AtomicInteger count = new AtomicInteger(0);
        for (int i = 0; i < keys.length; i++) {
            StringBuilder builder = new StringBuilder("Hello to ");
            String key = keys[count.getAndIncrement()];
            builder.append(" "+key);
            MessageProperties messageProperties=new MessageProperties();
            messageProperties.setHeader("user",key);
            Message message = MessageBuilder.withBody(builder.toString().getBytes()).andProperties(messageProperties).build();
            template.send(headers.getName(), "", message);
            System.out.println(" [x] Sent '" + message + "'");
        }
    }
}

HeadersConsumer

package com.student.rabbit.headers;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Create by zjg on 2024/3/10
 */
@Component
public class HeadersConsumer {
    private static final Logger log = LoggerFactory.getLogger(HeadersConsumer.class);
    @RabbitListener(queues = "#{headersQueue1.name}")
    public void receive1(Message message){
        log.debug("receive1:"+new String(message.getBody()));
    }
    @RabbitListener(queues = "#{headersQueue2.name}")
    public void receive2(Message message){
        log.debug("receive2:"+new String(message.getBody()));
    }
    @RabbitListener(queues = "#{headersQueue3.name}")
    public void receive3(Message message){
        log.debug("receive3:"+new String(message.getBody()));
    }
}

第一个队列接收sys消息,第二个队列接收admin消息,第三个队列只要包含user头的消息都接收。
在这里插入图片描述


总结

回到顶部
安装看这里
官方文档
官方网站
其他项目,可参考官方案例
路漫漫其修远兮,吾将上下而求索。

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

资料下载-嵌入式 Linux 入门

学习的第一步是去下载资料。 1. 有哪些资料 所有资料分 4 类&#xff1a; ① 开发板配套资料(原理图、虚拟机的映像文件、烧写工具等)&#xff0c;放在百度网盘 ② 录制视频过程中编写的文档、源码、图片&#xff0c;放在 GIT 仓库 ③ u-boot、linux 内核、buildroot 等比较大…

机器学习评价指标(分类、目标检测)

https://zhuanlan.zhihu.com/p/364253497https://zhuanlan.zhihu.com/p/46714763https://blog.csdn.net/u013250861/article/details/123029585 1.1 混淆矩阵 在介绍评价指标之前&#xff0c;我们首先要介绍一下混淆矩阵&#xff08;confusion matrix&#xff09;。混淆矩阵…

C++的类与对象(五):赋值运算符重载与日期类的实现

目录 比较两个日期对象 运算符重载 赋值运算符重载 连续赋值 日期类的实现 Date.h文件 Date.cpp文件 Test.cpp文件 const成员 取地址及const取地址操作符重载 比较两个日期对象 问题描述&#xff1a;内置类型可直接用运算符比较&#xff0c;自定义类型的对象是多个…

《日期类》的模拟实现

目录 前言&#xff1a; 头文件类与函数的定义Date.h 实现函数的Date.cpp 测试Test.cpp 运行结果&#xff1a; 前言&#xff1a; 我们在前面的两章初步学习认识了《类与对象》的概念&#xff0c;接下来我们将实现一个日期类&#xff0c;是我们的知识储备更加牢固。 头文件…

角蜥优化算法 (Horned Lizard Optimization Algorithm ,HLOA)求解无人机路径优化

一、无人机路径规划模型介绍 无人机三维路径规划是指在三维空间中为无人机规划一条合理的飞行路径,使其能够安全、高效地完成任务。路径规划是无人机自主飞行的关键技术之一,它可以通过算法和模型来确定无人机的航迹,以避开障碍物、优化飞行时间和节省能量消耗。 二、算法介…

【JAVA】CSS3:3D、过渡、动画、布局、伸缩盒

1 3D变换 1.1 3D空间与景深 /* 开启3D空间,父元素必须开启 */transform-style: preserve-3d;/* 设置景深&#xff08;你与z0平面的距离 */perspective:50px; 1.2 透视点位置 透视点位置&#xff1a;观察者位置 /* 100px越大&#xff0c;越感觉自己边向右走并看&#xff0c;…

K8S之实现业务的蓝绿部署

如何实现蓝绿部署 什么是蓝绿部署&#xff1f;蓝绿部署的优势和缺点优点缺点 通过k8s实现线上业务的蓝绿部署 什么是蓝绿部署&#xff1f; 部署两套系统&#xff1a;一套是正在提供服务系统&#xff0c;标记为 “绿色” &#xff1b;另一套是准备发布的系统&#xff0c;标记为…

LInux系统架构----Apache与Nginx动静分离

LInux系统架构----Apache与Nginx动静分离 一.动静分离概述 Nginx的静态处理能力比较强&#xff0c;但是动态处理能力不足&#xff0c;因此在企业中常采用动静分离技术在LNMP架构中&#xff0c;静态页面交给Nginx处理&#xff0c;动态页面交给PHP-FPM模块处理。在动静分离技术…

【软件测试面试】银行项目测试面试题+答案(二)

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 面试题&#xff1…

HTTP/2的三大改进:头部压缩、多路复用和服务器推送

&#x1f90d; 前端开发工程师、技术日更博主、已过CET6 &#x1f368; 阿珊和她的猫_CSDN博客专家、23年度博客之星前端领域TOP1 &#x1f560; 牛客高级专题作者、打造专栏《前端面试必备》 、《2024面试高频手撕题》 &#x1f35a; 蓝桥云课签约作者、上架课程《Vue.js 和 E…

CSS 居中对齐 (水平居中 )

水平居中 1.文本居中对齐 内联元素&#xff08;给容器添加样式&#xff09; 限制条件&#xff1a;仅用于内联元素 display:inline 和 display: inline-block; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><…

[c++] 查表 —— 策略模式和职责链模式的核心

查表法在工厂模式、策略模式以及职责链模式中都有使用。以工厂模式为例&#xff0c;表中存储的数据&#xff0c;key 是商品的类型&#xff0c;value 是生产这个商品的工厂。在生产商品的时候&#xff0c;直接根据商品类型从表中获得商品对应的工厂&#xff0c;然后通过工厂生产…

多维时序 | Matlab实现BiTCN双向时间卷积神经网络多变量时间序列预测

多维时序 | Matlab实现BiTCN双向时间卷积神经网络多变量时间序列预测 目录 多维时序 | Matlab实现BiTCN双向时间卷积神经网络多变量时间序列预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 1.Matlab实现BiTCN双向时间卷积神经网络多变量时间序列预测&#xff08;完整…

HTML概念

文章目录 1. HTML 概念1.1. 简介1.2. 思想1.3. 特点1.4. 语法1.4.1. 标签1.4.2. 属性1.4.3. 标签体1.4.4. 注释 2. HTML 实体2.1. 练习 3. HTML 结构3.1. <!DOCTYPE html>声明3.2. html根标签 4. 补充4.1. 管理文件4.2. 配置 VsCode4.2. 配置 VsCode 1. HTML 概念 1.1. 简…

QT画图功能

QT画图功能 每个QWidget都自带的功能&#xff0c;继承了QPainteDevice都可以使用QPainter来进行绘图。 画图需要调用paintEvent绘制事件&#xff0c;paintEvent事件时QWidget类自带的事件。 重写paintEvent事件。&#xff08;重写事件&#xff1a;如果父类有某个方法&#xff…

路由器动态路由配置

本博客为观看湖科大的教书匠系列计算机网络视频的学习笔记。 静态路由选择动态路由选择采用人工配置的方式给路由器添加网络路由、默认路由和特定主机路由等路由条目。路由器通过路由选择协议自动获取路由信息。静态路由选择简单、开销小&#xff0c;但不能及时适应网络状态(流…

【SOFARPC】SOFA入门实战

背景 由于最近交付项目&#xff0c;甲方使用了SOFA这套体系&#xff0c;之前虽然有过一些了解&#xff0c;但是真正实战还是没有那么熟悉&#xff0c;因此搭建一个实战的demo&#xff0c;熟悉一下相关内容。 SOFA SIMALE DEMO 项目搭建 项目目录结构 如上图所示&#xff0…

基于电鳗觅食优化算法(Electric eel foraging optimization,EEFO)的无人机三维路径规划(提供MATLAB代码)

一、无人机路径规划模型介绍 无人机三维路径规划是指在三维空间中为无人机规划一条合理的飞行路径&#xff0c;使其能够安全、高效地完成任务。路径规划是无人机自主飞行的关键技术之一&#xff0c;它可以通过算法和模型来确定无人机的航迹&#xff0c;以避开障碍物、优化飞行…

数据结构小记【Python/C++版】——BST树篇

一&#xff0c;基础概念 BST树&#xff0c;英文全称:Binary Search Tree&#xff0c;被称为二叉查找树或二叉搜索树。 如果一个二叉查找树非空&#xff0c;那么它具有如下性质&#xff1a; 1.左子树上所有节点的值小于根节点的值&#xff0c;节点上的值沿着边的方向递减。 2…

Python+Django+Html网页前后端指纹信息识别

程序示例精选 PythonDjangoHtml网页前后端指纹信息识别 如需安装运行环境或远程调试&#xff0c;见文章底部个人QQ名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 这篇博客针对《PythonDjangoHtml网页前后端指纹信息识别》编写代码&#xff0c;代码整洁&#xff0…
最新文章