当前位置: 首页 > news >正文

使用 API Gateway Integrator 在 Quarkus 中实施适用于 AWS Lambda 的 OpenAPI

AWS API Gateway 集成使得使用符合 OpenAPI 标准的 Lambda Function 轻松实现 REST API。

关于开放API

        它是一个 允许以标准方式描述 REST API 的规范。 OpenAPI规范 (OAS) 为 REST API 定义了与编程语言无关的标准接口描述。这使得人类和计算机都可以发现和理解服务的功能,而无需访问源代码、附加文档或检查网络流量。

关于Swagger

        Swagger是一组围绕 OpenAPI 规范构建的开源工具,可以帮助软件专业人员设计、构建、记录和使用 REST API。OpenAPI 处理规范,Swagger 实现规范来描述 REST API 。

OpenAPI规范简介

目的

  • API是使用OpenAPI标准定义的,可以被人类和计算机发现,无需访问源代码、文档或通过网络流量检查即可了解服务的功能。 
  • 如果定义正确,消费者可以使用最少量的实现逻辑来理解远程服务并与之交互。
  • 然后,文档生成工具可以使用 OpenAPI 定义来显示 API,代码生成工具可以使用各种编程语言、测试工具和许多其他用例来生成服务器和客户端。

开放API的主要 概念

OpenAPI文档

定义/描述 API 的文档(或一组文档)。OpenAPI 定义使用并符合 OpenAPI 规范。 

路径模板

路径模板是指使用由大括号 ({}) 分隔的模板表达式,将 URL 路径的一部分标记为可使用路径参数进行替换。

路径中的每个模板表达式必须对应于路径项本身和/或路径项的每个操作中包含的路径参数。

媒体类型

媒体类型定义分布在多个资源中。媒体类型定义应符合RFC6838。

可能的媒体类型定义的一些示例:

  • 应用程序/json
  • 测试/普通;chartset-uff-8

HTTP 状态代码

HTTP 状态代码用于指示已执行操作的状态。可用的状态代码由RFC7231定义,注册的状态代码列在IANA 状态代码注册表中。

AWS Lambda 函数的开放 API 参考实现 

参考架构

 

参考实现由以下组件组成:

  • AWS Lambda函数实现业务需求/逻辑 
  • API 网关将功能公开为 API
  • Amazon API 网关集成器,用于集成开放 API 规范并将 Lambda 函数操作公开为 API

有关每个架构组件的更多详细信息,请参阅后续部分。

关于 AWS Lambda 函数

Lambda 是一种计算服务,允许在不配置或管理服务器的情况下运行代码。Lambda 在高可用性计算基础设施上运行代码,并执行计算资源的所有管理,包括服务器和操作系统维护、容量配置和自动扩展以及日志记录。使用 Lambda,几乎可以为任何类型的应用程序或后端服务运行代码。它所需要的只是以Lambda 支持的语言之一提供代码。
Lambda 仅在需要时运行函数并自动扩展,从每天几个请求到每秒数千个请求。它节省了计算成本,因为只需支付函数在运行时消耗的计算时间——代码不运行时不收费。可以使用 Lambda API 或来自其他 AWS 服务的事件调用 lambda 函数,例如在 S3 存储桶中创建对象时。

关于 AWS API 网关 

Amazon API Gateway 是一项完全托管的服务,使开发人员可以轻松创建、发布、维护、监控和保护任何规模的 API。API 充当应用程序从后端服务访问数据、业务逻辑或功能的“前门”。

关于AWS API集成功能

这种类型的集成允许 API 公开 AWS 服务操作。在AWS集成中,需要配置集成请求和集成响应,并设置从方法请求到集成请求、从集成响应到方法响应的必要数据映射。

它允许指定用于此方法的后端集成的详细信息。此扩展是OpenAPI 操作对象的扩展属性。结果是一个API 网关集成对象。

重要财产

与指定后​​端的集成类型。有效值为:

  • http 或 http_proxy,用于与 HTTP 后端集成。
  • aws_proxy,用于与 AWS Lambda 函数的代理集成 
  • aws,用于与 AWS Lambda 函数自定义集成,或与其他 AWS 服务集成,例如 Amazon DynamoDB、Amazon Simple notification Service 或 Amazon Simple Queue Service。
  • mock,用于与 API Gateway 集成,无需调用任何后端。这种类型的集成允许 API Gateway 返回响应,而无需将请求进一步发送到后端。

Lambda 代理集成支持单个 Lambda 函数的简化集成设置。设置很简单,可以随后端一起发展,而无需拆除已经创建的设置。由于这些原因,强烈建议与 Lambda 函数集成。

相比之下,Lambda 自定义集成允许为具有类似输入和输出数据格式要求的各种集成端点重用已配置的映射模板。该设置涉及较多,推荐用于更高级的应用场景。

x-amazon-apigateway-integrations例子

以下示例使用 OpenAPI 标准定义 HTTP API(一个 GET 和一个 POST),并为每个 API 使用一个 API 网关集成来与 Lambda Function 集成(通过引用函数的 ARN)。它使用 AWS Identity and Access Management (IAM) 角色作为集成凭证。以下格式采用 YAML。 

openapi: 3.0.1
info:description: "This is a definition of Proxy Pattern Service. The service has 2 APIs."version: v1title: "Proxy Pattern Service"
paths:/v1/proxypattern/employee:options:summary: CORS supportdescription: |Enable CORS by returning correct headersconsumes:- application/jsonproduces:- application/jsontags:- CORSsecurity:- NONE: []x-amazon-apigateway-integration:type: mockrequestTemplates:application/json: |{"statusCode" : 200}responses:"default":statusCode: "200"responseParameters:method.response.header.Access-Control-Allow-Headers : "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-apigw-api-id,X-Amz-Security-Token,Cache-Control'"method.response.header.Access-Control-Allow-Methods : "'*'"method.response.header.Access-Control-Allow-Origin : "'*'"responseTemplates:application/json: |{}responses:200:description: Default response for CORS methodheaders:Access-Control-Allow-Headers:type: "string"Access-Control-Allow-Methods:type: "string"Access-Control-Allow-Origin:type: "string"post:summary: "Save Employee"operationId: "saveemployees"tags:- saveemployeesrequestBody:required: truecontent:application/json:schema:$ref: '#/components/schemas/employee'responses:'200':description: "Saved Employee Successfully"headers:Access-Control-Allow-Origin:schema:type: "string"content:application/json:schema:$ref: "#/components/schemas/employee"'400':description: "Application Errors"headers:Access-Control-Allow-Origin:schema:type: "string"content:application/json:schema:$ref: '#/components/schemas/ErrorResponse''500':description: "Other unspecified Errors"headers:Access-Control-Allow-Origin:schema:type: "string"content:application/json:schema:$ref: '#/components/schemas/ErrorResponse'x-amazon-apigateway-integration:credentials:Fn::Sub: arn:aws:iam::${AWS::AccountId}:role/delegate-admin-lambda-proxy-pattern-rolehttpMethod: "POST"uri:Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ProxyPatternService.Arn}:live/invocationsresponses:"default":statusCode: "200"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'""BAD.*":statusCode: "400"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'""INT.*":statusCode: "500"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'"type: "aws_proxy"get:summary: "Get All the Employees"operationId: "getemployees"tags:- getemployeesresponses:'200':description: "All The Employees retrieved successfully"headers:Access-Control-Allow-Origin:schema:type: "string"content:application/json:schema:type: "array"items:$ref: "#/components/schemas/employee"'204':description: "Employees not found"headers:Access-Control-Allow-Origin:schema:type: "string"'500':description: "Other unspecified Errors"headers:Access-Control-Allow-Origin:schema:type: "string"content:application/json:schema:$ref: '#/components/schemas/ErrorResponse'x-amazon-apigateway-integration:credentials:Fn::Sub: arn:aws:iam::${AWS::AccountId}:role/delegate-admin-lambda-proxy-pattern-rolehttpMethod: "POST"uri:Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ProxyPatternService.Arn}:live/invocationsresponses:"default":statusCode: "200"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'""BAD.*":statusCode: "204"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'""INT.*":statusCode: "500"responseParameters:method.response.header.Access-Control-Allow-Origin : "'*'"type: "aws_proxy"components:schemas:Employee:type: objectdescription: EMPLOYEEproperties:employeeId:type: stringdescription: Id of the EmployeeemployeeName:type: stringdescription: Name of the Employeerequired:- employeeIdErrorResponse:type: "object"properties:errorCode:type: stringdescription: |indicates an error in processing.XXXX - Error in saving messageerrorMessage:type: stringdescription: "message description of error."

以下是 AWS Lambda 函数的云形成模板,该模板将通过 AWS API Gateway 公开。格式为 YAML。此处,已引用OpenAPI定义/openapi-apigateway-PxyPtrnSvc.yaml文件 ( ),以便API Gateway了解通过 OpenAPI 定义文件定义的集成点。

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS Serverless Quarkus HTTP - Proxy Pattern Poc Service
Globals:Api:EndpointConfiguration:Type: PRIVATEAuth:ResourcePolicy:CustomStatements: {Effect: 'Allow',Action: 'execute-api:Invoke',Resource: ['execute-api:/*/*/*'],Principal: '*'}
Resources:ProxyPatternServiceAWSApiGateway:Type: AWS::Serverless::ApiProperties:TracingEnabled: trueName: ProxyPatternServiceSvcApiGatewayStageName: devDefinitionBody:'Fn::Transform':Name: 'AWS::Include'Parameters:Location: './openapi-apigateway-PxyPtrnSvc.yaml'ProxyPatternServiceLogGroup:Type: AWS::Logs::LogGroupProperties:LogGroupName: '/aws/lambda/ProxyPatternService'RetentionInDays: 30ProxyPatternService:Type: AWS::Serverless::FunctionProperties:Handler: not.used.in.provided.runtimeRuntime: providedCodeUri: component1/function.zipMemorySize: 512Timeout: 900FunctionName: ProxyPatternServiceEnvironment:Variables:LOG_LEVEL: INFODISABLE_SIGNAL_HANDLERS: trueRole: !Sub "arn:aws:iam::${AWS::AccountId}:role/delegate-admin-lambda-proxy-pattern-role"Tracing: Active
Outputs:ProxyPatternServiceAWSApiGateway:Description: 'API Gateway endpoint URL for dev stage for Proxy Pattern Service Template'Value: !Sub 'https://${ProxyPatternServiceAWSApiGateway}.execute-api.${AWS::Region}.amazonaws.com/dev/'ProxyPatternServiceAWSApiGatewayRestApiId:Description: 'API Gateway ARN for Basic AWS API Gateway'Value: !Ref ProxyPatternServiceAWSApiGatewayExport:Name: ProxyPatternServiceAWSApiGateway-RestApiIdProxyPatternServiceAWSApiGatewayRootResourceId:Value: !GetAtt ProxyPatternServiceAWSApiGateway.RootResourceIdExport:Name: ProxyPatternServiceAWSApiGateway-RootResourceId

示例 API 定义可以与以下使用 Java 的 Controller 接口相关,并且可以在 Java Quarkus 中实现:

package com.example.proxypattern.controller;import com.example.proxypattern.exception.model.ErrorResponse;
import com.example.proxypattern.model.Employee;import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.media.Content;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;@Path("v1/proxypattern/")
public interface IProxyPatternController {@GET@Path("/employee")@Produces(MediaType.APPLICATION_JSON)@Operation(summary = "Get All the Employees", description = "getEmployees")@APIResponses(value = {@APIResponse(responseCode = "204", description = "Employees not found"),@APIResponse(responseCode = "200", description = "All The Employees retrieved successfully", content = @Content(schema = @Schema(implementation = Employee.class))),@APIResponse(responseCode = "500", description = "Other unspecified Errors", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })public Response getAllEmployee();@POST@Path("/employee")@Consumes(MediaType.APPLICATION_JSON)@Produces(MediaType.APPLICATION_JSON)@Operation(summary = "Save Employee", description = "saveEmployees")@APIResponses(value = {@APIResponse(responseCode = "400", description = "Application Errors", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),@APIResponse(responseCode = "200", description = "Saved Employee Successfully", content = @Content(schema = @Schema(implementation = Employee.class))),@APIResponse(responseCode = "500", description = "Other unspecified Errors", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })public Response saveEmployee(Employee employee);
}

实现语言可能有所不同。如果技术决策是使用Java作为编码语言,则可以选择Java Quarkus作为Lambda函数的实现语言。Lambda 支持自定义运行时,因此可以本地构建 Quarkus 代码来解决与 Lambda 冷启动相关的响应时间问题。

控制器实现代码如下所示。这里,业务逻辑已通过业务服务类进行抽象:

package com.example.proxypattern.controller.impl;import com.example.proxypattern.controller.IProxyPatternController;
import com.example.proxypattern.model.Employee;
import com.example.proxypattern.service.impl.EmployeeServiceImpl;import lombok.extern.slf4j.Slf4j;
import org.eclipse.microprofile.opentracing.Traced;import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.Response;import java.util.List;@Slf4j
@Traced
@Singleton
public class ProxyPatternControllerImpl implements IProxyPatternController {@InjectEmployeeServiceImpl employeeService;@Overridepublic Response getAllEmployee() {Response.Status status = Response.Status.OK;//The business logic is abstracted here in Service codeList<Employee> listOfEmployee = employeeService.getAllEmployee();if(listOfEmployee.isEmpty()){status = Response.Status.NO_CONTENT;}log.info("Sending employee {}", listOfEmployee);return Response.status(status).entity(listOfEmployee).build();}@Overridepublic Response saveEmployee(Employee employee) {//The business logic is abstracted here in Service codeEmployee employeeResponse = employeeService.saveEmployee(employee);return Response.status(Response.Status.CREATED).entity(employeeResponse).build();}
}

可以使用Maven来构建项目,也可以使用以下依赖来构建项目:


<dependencies><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-resteasy</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-amazon-lambda-rest</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-smallrye-openapi</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-resteasy-jackson</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-logging-json</artifactId></dependency><dependency><groupId>org.jboss.slf4j</groupId><artifactId>slf4j-jboss-logmanager</artifactId></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.2</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-hibernate-validator</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-smallrye-opentracing</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-smallrye-health</artifactId></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-junit5</artifactId><scope>test</scope></dependency><dependency><groupId>io.rest-assured</groupId><artifactId>rest-assured</artifactId><scope>test</scope></dependency><dependency><groupId>io.quarkus</groupId><artifactId>quarkus-junit5-mockito</artifactId><scope>test</scope></dependency><dependency><groupId>org.jacoco</groupId><artifactId>org.jacoco.agent</artifactId><classifier>runtime</classifier><scope>test</scope></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.20</version><scope>provided</scope></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId></dependency></dependencies>

结论

AWS API Gateway 集成可以轻松使用 Lambda Function 实现 REST API,该函数符合 OpenAPI 标准,并且可以轻松与 AWS API Gateway 集成。

相关文章:

使用 API Gateway Integrator 在 Quarkus 中实施适用于 AWS Lambda 的 OpenAPI

AWS API Gateway 集成使得使用符合 OpenAPI 标准的 Lambda Function 轻松实现 REST API。 关于开放API 它是一个 允许以标准方式描述 REST API 的规范。 OpenAPI规范 (OAS) 为 REST API 定义了与编程语言无关的标准接口描述。这使得人类和计算机都可以发现和理解服务的功能&am…...

【JVM】JVM中的分代回收

文章目录 分代收集算法什么是分代分代收集算法-工作机制MinorGC、 Mixed GC 、 FullGC的区别是什么 分代收集算法 什么是分代 在java8时&#xff0c;堆被分为了两份&#xff1a; 新生代和老年代【1&#xff1a;2】 其中&#xff1a; 对于新生代&#xff0c;内部又被分为了三…...

C# Linq源码分析之Take方法

概要 Take方法作为IEnumerable的扩展方法&#xff0c;具体对应两个重载方法。本文主要分析第一个接收整数参数的重载方法。 源码解析 Take方法的基本定义 public static System.Collections.Generic.IEnumerable Take (this System.Collections.Generic.IEnumerable source…...

从后往前读取列表的方法

从后往前读取列表的方法 方法1&#xff1a;使用for循环遍历列表时&#xff0c;可以使用reverse()函数将列表反转&#xff0c;然后再遍历。 # 列表 num [0, 1, 2, 3]# 反向遍历 for i in reversed(num):print(i)输出结果&#xff1a; 3 2 1 0方法2&#xff1a;先计算列表长度…...

数据库--数据类型

数据库相关链接&#xff1a; 数据库基础操作--增删改查&#xff1a;http://t.csdn.cn/189CF 数据库--三大范式、多表查询、函数sql&#xff1a;http://t.csdn.cn/udJSG 数据类型 创建表的时候&#xff0c;我们在类型这里给出了不同的选项&#xff0c;比如有int &#xff0c;…...

小型双轮差速底盘机器人实现红外跟随功能

1. 功能说明 本文示例将实现R023样机小型双轮差速底盘跟随人移动的功能。在小型双轮差速底盘前方按下图所示安装3个 近红外传感器&#xff0c;制作一个红外线发射源&#xff0c;实现当红外发射源在机器人的检测范围内任意放置或移动时&#xff0c;机器人能追踪该发射源。 2. 电…...

TCP协议网络编程 回显服务器,客户端实现

回显服务器表示客户端传来的请求是什么&#xff0c;服务器就回应什么&#xff0c;客户端不用对传来的数据进行处理&#xff0c;主要是为了熟悉TCP协议提供的API的使用 对于代码的解释全作为注释写在了代码上&#xff0c;推荐复制到编程软件中查看 UDP协议实现回显服务器可以看…...

3.4 Spring MVC注解

注解名称 注解说明 RequestMapping 用来处理请求地址映射的注解&#xff0c;可以在接口、类和方法上使用 value属性 表示请求地址&#xff0c;与path属性一致 method属性 表示接收HTTP请求方法&#xff0c;默认接收所有请求方法&#xff0c;请求包括GET、POST、PUT、DEL…...

OpenCV实例(八)车牌字符识别技术(三)汉字识别

车牌字符识别技术&#xff08;三&#xff09;汉字识别 1.代码实例2.遇到问题3.汉字识别代码实例 相较于数字和英文字符的识别&#xff0c;汽车牌照中的汉字字符识别的难度更大&#xff0c;主要原因有以下4个方面&#xff1a; (1)字符笔画因切分误差导致非笔画或笔画流失。 (2…...

运维监控学习笔记2

硬件监控&#xff1a; 1&#xff09;使用IPMI 2&#xff09;机房巡检 路由器和交换机&#xff1a; 使用SNMP&#xff08;简单网络管理协议&#xff09;进行监控。 Linux 安装snmp&#xff1a; yum install -y net-snmp net-snmp-utils 说明&#xff1a;net-snmp是安装在snm…...

【深度学习】遗传算法[选择、交叉、变异、初始化种群、迭代优化、几何规划排序选择、线性交叉、非均匀变异]

目录 一、遗传算法二、遗传算法概述2.1 选择2.2 交叉2.3 变异 三、遗传算法的基本步骤3.1 编码3.2 初始群体的生成3.3 适应度评估3.4 选择3.5 交叉3.6 变异3.7 总结 四、遗传算法工具箱4.1 initializega4.2 ga4.3 normGeomSelect4.4 arithXover4.5 nonUnifMutation 五、遗传算法…...

【小吉带你学Git】讲解GitHub操作,码云操作,GitLab操作

&#x1f38a;专栏【Git】 &#x1f354;喜欢的诗句&#xff1a;更喜岷山千里雪 三军过后尽开颜。 &#x1f386;音乐分享【如愿】 &#x1f33a;欢迎并且感谢大家指出小吉的问题&#x1f970; 文章目录 &#x1f354;GitHub操作⭐安装GitHub插件⭐在idea中设置GitHub账号&…...

nginx基础

nginx 具体就是一个轻量级以及高性能的web服务软件。 nginx特点 1、稳定性高。&#xff08;但不如apache&#xff09; 2、系统资源消耗比较低。&#xff08;处理http请求的并发能力较高&#xff0c;单台处理器可以处理3w-5w的并发请求&#xff09; 注&#xff1a;一般在企…...

【Windows API】获取卷标、卷名

1、卷->卷标 使用FindFirstVolume()和FindNextVolume()函数体系&#xff0c;枚举系统所有卷&#xff08;Volume&#xff09;的例子&#xff0c;然后获取卷标、卷类型。这个方式可以枚举出没有驱动器号&#xff08;卷标&#xff09;的卷。 int TestMode1() {HANDLE hVolume…...

通过MATLAB自动产生Hamming编译码的verilog实现,包含testbench

目录 1.算法运行效果图预览 2.算法运行软件版本 3.部分核心程序 4.算法理论概述 1. 原理 1.1 编码规则 1.2 错误检测和纠正 2. 实现过程 2.1 编码过程 2.2 解码过程 3. 应用领域 3.1 数字通信 3.2 存储系统 3.3 ECC内存 3.4 数据传输 5.算法完整程序工程 1.算法…...

swager web服务无法显示问题

如果指定了扫描其他包 那么web文件夹里面的就扫描不到 需要加上扫描扫描web的 &#xff0c;默认什么也没有就会扫描web文件夹 但是其他模块的扫描不到 指定了扫描其他模块就需要再次指定扫描该web文件夹...

代码随想录训练营day18 二叉树

106. 从中序与后序遍历序列构造二叉树 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 //左根右 左右根/* 第一步&#xff1a;如果数组大小为零的…...

图像的平移变换之c++实现(qt + 不调包)

1.基本原理 设dx为水平偏移量&#xff0c;dy为垂直偏移量&#xff0c;则平移变换的坐标映射关系为下公式&#xff0c;图像平移一般有两种方式。 1.不改变图像大小的平移&#xff08;一旦平移&#xff0c;相应内容被截掉&#xff09; 1&#xff09;当dx > width、dx < -wi…...

云原生K8S------Yaml文件详解

目录 一&#xff1a;K8S支持的文件格式 1&#xff0c;yaml和json的主要区别 2&#xff0c;YAML语言格式 二&#xff1a;yuml 1、查看 api 资源版本标签 2、写一个yaml文件demo 3、创建service服务对外提供访问并测试 4、详解k8s中的port 三&#xff1a;文件生成 1、kubec…...

测试开发环境安装

安装python运行环境 下载地址&#xff1a;链接 http://python.p2hp.com/downloads/windows/index.html 选择合适自己的版&#xff0c;我下载的3.8.10的进行安装 安装码编辑器Pychrom 下载地址&#xff1a;链接 https://www.jetbrains.com/pycharm/ 拉到最下面可以下载社区版…...

vue3 字体颜色设置的多种方式

在Vue 3中设置字体颜色可以通过多种方式实现&#xff0c;这取决于你是想在组件内部直接设置&#xff0c;还是在CSS/SCSS/LESS等样式文件中定义。以下是几种常见的方法&#xff1a; 1. 内联样式 你可以直接在模板中使用style绑定来设置字体颜色。 <template><div :s…...

苍穹外卖--缓存菜品

1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得&#xff0c;如果用户端访问量比较大&#xff0c;数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据&#xff0c;减少数据库查询操作。 缓存逻辑分析&#xff1a; ①每个分类下的菜品保持一份缓存数据…...

高危文件识别的常用算法:原理、应用与企业场景

高危文件识别的常用算法&#xff1a;原理、应用与企业场景 高危文件识别旨在检测可能导致安全威胁的文件&#xff0c;如包含恶意代码、敏感数据或欺诈内容的文档&#xff0c;在企业协同办公环境中&#xff08;如Teams、Google Workspace&#xff09;尤为重要。结合大模型技术&…...

IT供电系统绝缘监测及故障定位解决方案

随着新能源的快速发展&#xff0c;光伏电站、储能系统及充电设备已广泛应用于现代能源网络。在光伏领域&#xff0c;IT供电系统凭借其持续供电性好、安全性高等优势成为光伏首选&#xff0c;但在长期运行中&#xff0c;例如老化、潮湿、隐裂、机械损伤等问题会影响光伏板绝缘层…...

#Uniapp篇:chrome调试unapp适配

chrome调试设备----使用Android模拟机开发调试移动端页面 Chrome://inspect/#devices MuMu模拟器Edge浏览器&#xff1a;Android原生APP嵌入的H5页面元素定位 chrome://inspect/#devices uniapp单位适配 根路径下 postcss.config.js 需要装这些插件 “postcss”: “^8.5.…...

Fabric V2.5 通用溯源系统——增加图片上传与下载功能

fabric-trace项目在发布一年后,部署量已突破1000次,为支持更多场景,现新增支持图片信息上链,本文对图片上传、下载功能代码进行梳理,包含智能合约、后端、前端部分。 一、智能合约修改 为了增加图片信息上链溯源,需要对底层数据结构进行修改,在此对智能合约中的农产品数…...

网站指纹识别

网站指纹识别 网站的最基本组成&#xff1a;服务器&#xff08;操作系统&#xff09;、中间件&#xff08;web容器&#xff09;、脚本语言、数据厍 为什么要了解这些&#xff1f;举个例子&#xff1a;发现了一个文件读取漏洞&#xff0c;我们需要读/etc/passwd&#xff0c;如…...

Caliper 配置文件解析:fisco-bcos.json

config.yaml 文件 config.yaml 是 Caliper 的主配置文件,通常包含以下内容: test:name: fisco-bcos-test # 测试名称description: Performance test of FISCO-BCOS # 测试描述workers:type: local # 工作进程类型number: 5 # 工作进程数量monitor:type: - docker- pro…...

【Kafka】Kafka从入门到实战:构建高吞吐量分布式消息系统

Kafka从入门到实战:构建高吞吐量分布式消息系统 一、Kafka概述 Apache Kafka是一个分布式流处理平台,最初由LinkedIn开发,后成为Apache顶级项目。它被设计用于高吞吐量、低延迟的消息处理,能够处理来自多个生产者的海量数据,并将这些数据实时传递给消费者。 Kafka核心特…...

Vue 3 + WebSocket 实战:公司通知实时推送功能详解

&#x1f4e2; Vue 3 WebSocket 实战&#xff1a;公司通知实时推送功能详解 &#x1f4cc; 收藏 点赞 关注&#xff0c;项目中要用到推送功能时就不怕找不到了&#xff01; 实时通知是企业系统中常见的功能&#xff0c;比如&#xff1a;管理员发布通知后&#xff0c;所有用户…...