CN111818182B - 一种基于Spring cloud gateway的微服务编排和数据聚合的方法 - Google Patents

一种基于Spring cloud gateway的微服务编排和数据聚合的方法 Download PDF

Info

Publication number
CN111818182B
CN111818182B CN202010891930.6A CN202010891930A CN111818182B CN 111818182 B CN111818182 B CN 111818182B CN 202010891930 A CN202010891930 A CN 202010891930A CN 111818182 B CN111818182 B CN 111818182B
Authority
CN
China
Prior art keywords
service
data
gateway
request
orchestrator
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010891930.6A
Other languages
English (en)
Other versions
CN111818182A (zh
Inventor
冯宇
罗喜川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan XW Bank Co Ltd
Original Assignee
Sichuan XW Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan XW Bank Co Ltd filed Critical Sichuan XW Bank Co Ltd
Priority to CN202010891930.6A priority Critical patent/CN111818182B/zh
Publication of CN111818182A publication Critical patent/CN111818182A/zh
Application granted granted Critical
Publication of CN111818182B publication Critical patent/CN111818182B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/1607Details of the supervisory signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明一种基于Spring cloud gateway的微服务编排和数据聚合的方法,包括:A.客户端向Spring Cloud Gateway发出请求;B.经前置过滤器Filter过滤后将请求转发到Service Orchestration服务编排器进行处理后将整合的结果应答转发到Data aggregator数据聚合器;C.Data aggregator数据聚合器处理接收到的服务结果后并返回给Service Orchestration服务编排器;D.Service Orchestration服务编排器将Data aggregator数据聚合器处理后的服务结果转发给后置过滤器Filter处理,最后返回给客户端。本发明给客户端和服务器端之间提供一个中间层,由微服务编排和数据聚合引擎来提供安全、性能、监控、服务编排和数据聚合的作用,从而能够提高业务灵活性且不失安全性,能够最大限度地降低微服务间的耦合度。

Description

一种基于Spring cloud gateway的微服务编排和数据聚合的 方法
技术领域
本发明涉及计算机数据处理技术领域,具体涉及一种基于Spring cloud gateway的微服务编排和数据聚合的方法。
背景技术
Spring cloud gateway是spring官方基于Spring 5.0、Spring Boot2.0和Project Reactor等技术开发的网关,Spring Cloud Gateway旨在为微服务架构提供简单、有效和统一的API路由管理方式,Spring Cloud Gateway作为Spring Cloud生态系统中的网关,目标是替代Netflix Zuul,其不仅提供统一的路由方式,并且还基于Filter链的方式提供了网关基本的功能,例如:安全、监控/埋点、限流等。
但是目前的Spring Cloud Gateway没有服务编排和数据聚合的功能,由于微服务架构的出现,不同的微服务一般会有不同的网络地址,而外部客户端可能需要调用多个服务的接口才能完成一个业务需求,如果让客户端直接与各个微服务通信,可能会出现以下问题:客户端会多次请求不同的微服务,增加了客户端的复杂性,同时也增加请求次数,带来网络访问的压力;存在跨域请求,在一定场景下处理相对复杂;认证复杂,每个服务都需要独立认证;难以重构,随着项目的迭代,可能需要重新划分微服务。例如,可能将多个服务合并成一个或者将一个服务拆分成多个。如果客户端直接与微服务通信,那么重构将会很难实施;某些微服务可能使用了防火墙 / 浏览器不友好的协议,直接访问会有一定的困难。
因此如果客户端直接与各个微服务通信会存在以下不足:业务灵活性不强;安全性不高;各个微服务之间耦合度较高。
发明内容
基于以上问题,本发明提供一种基于Spring cloud gateway的微服务编排和数据聚合的方法,通过一个请求来依次调用多个微服务,并对每个服务的返回结果做数据处理,最终整合成一个大的结果返回给前端的服务编排/数据聚合原理来整合Spring CloudGateway的功能。
本发明一种基于Spring cloud gateway的微服务编排和数据聚合的方法,包括:
A.客户端向Spring Cloud Gateway发出请求;
B.经前置过滤器Filter过滤后将请求转发到Service Orchestration服务编排器进行处理后将整合的结果应答转发到Data aggregator数据聚合器;
C.Data aggregator数据聚合器处理接收到的服务结果后并返回给ServiceOrchestration服务编排器;
D.Service Orchestration服务编排器将Data aggregator数据聚合器处理后的服务结果转发给后置过滤器Filter处理,最后返回给客户端。
本发明基于Spring cloud gateway网关实现的微服务编排和数据聚合引擎,给客户端和服务器端之间提供一个中间层,由微服务编排和数据聚合引擎来提供安全、性能、监控、服务编排和数据聚合的作用,从而能够提高业务灵活性且不失安全性,能够最大限度地降低微服务间的耦合度。
进一步的,步骤B包括:
调用前置过滤器Filter过滤后将请求发送到Service Orchestration服务编排器,Service Orchestration服务编排器通过网关路由器来具体确定每个后端服务的路径;其中前置过滤器Filter是发送前执行的逻辑,并且可以做参数校验、流量监控、日志输出和协议转换等,客户端的请求先经过前置过滤器filter,然后将请求转发到具体的业务服务。
网关路由器将请求转发到每个后端服务,并接收后端服务的应答数据后发送到Service Orchestration服务编排器;网关路由器是网关的基础元素,当请求到达网关时,由 Gateway Handler Mapping 通过断言进行路由匹配(Mapping),当断言为真时,匹配到路由。
Service Orchestration服务编排器对每个后端服务返回的应答数据做数据处理最后整合成一个完整的应答数据。Service Orchestration是服务组合的一个过程模型,该过程模型描述如何按一定次序和参与过程进行消息交互以完成组合服务的应用逻辑。通过一个请求来依次调用多个微服务,并对每个服务的返回结果做数据处理,最终整合成一个最后完整的结果返回给调用者。
所述步骤B可以通过一个请求来依次调用多个微服务,并对每个微服务的返回结果做数据处理,最终整合成一个大的结果发送给下一步。
进一步的,步骤C包括:
Service Orchestration服务编排器将整合后的应答数据发送到Dataaggregator数据聚合器进行处理,Data aggregator数据聚合器对接收到的应答数据进行数据的过滤、删除、移动、重命名、拆包、封包和异常处理操作,从而形成完整的返回应答数据发送回Service Orchestration服务编排器。
Data aggregator数据聚合器可以对每个后端服务的返回数据进行数据的过滤、删除、移动、重命名、拆包和封包、异常处理等操作,从而整合成一个最后完整的返回数据。
进一步的,步骤D包括:
Service Orchestration服务编排器将Data aggregator数据聚合器处理后的返回应答数据转发给后置过滤器Filter处理后,由后置过滤器Filter将返回应答数据依次从GateWay Web Hander发送到Gateway Hander Mapping最后返回给客户端。
本发明基于Spring cloud gateway网关实现的微服务编排和数据聚合引擎,给客户端和服务器端之间提供一个中间层,将编排微服务的整个操作放到Spring cloudgateway网关进行,由网关对数据做处理与转换,这样无需对后端服务做改动并且微服务编排和数据聚合引擎能够提供安全、性能、监控、服务编排和数据聚合的作用,从而能够提高业务灵活性且不失安全性,能够最大限度地降低微服务间的耦合度。
附图说明
图1为本发明一种基于Spring cloud gateway的微服务编排和数据聚合的方法的框架图。
具体实施方式
以下结合实施例的具体实施方式,对本发明的上述内容再作进一步的详细说明。但不应将此理解为本发明上述主题的范围仅限于以下的实例。在不脱离本发明上述技术思想情况下,根据本领域普通技术知识和惯用手段做出的各种替换或变更,均应包括在本发明的范围内。
如图1所示本发明一种基于Spring cloud gateway的微服务编排和数据聚合的方法,包括:
1.客户端向Spring Cloud Gateway发出请求;
2. Gateway Hander Mapping接收到请求后,在Gateway Hander Mapping中找到与请求相匹配的路由路径;
3.匹配到路由后再将请求发送到GateWay Web Hander;
4. GateWay Web Hander通过定制的过滤器链将请求发送到实际的服务执行业务逻辑,其中包括前置过滤器和后置过滤器,前置过滤器Filter是发送执行前的逻辑,后置过滤器Filter是发送执行后的逻辑;前置过滤器Filter可以做参数校验、流量监控、日志输出、协议转换等,后置过滤器Filter中可以做响应内容、响应头的修改,日志的输出,流量监控等有着非常重要的作用。GateWay Web Hander将请求发送到前置过滤器Filter;
5.前置过滤器Filter进行过滤后将请求发送到Service Orchestration服务编排器;
6.Service Orchestration服务编排器通过Route网关路由器来具体确定后端服务的路径;
7.Route网关路由器将请求转发到后端实际的服务,并且接收后端服务的应答发送到Service Orchestration服务编排器;
8. Service Orchestration服务编排器接收到返回的后端服务应答后,对每个后端服务的应答数据进行处理,最终整合成一个完整的结果发送给Data aggregator数据聚合器;
9. Data aggregator数据聚合器接收到Service Orchestration服务编排器发送的整合后的应答数据,对整合后的应答数据进行过滤、删除、移动、重命名、拆包、封包、异常处理等操作,从而形成更完整的最后应答数据返回到Service Orchestration 服务编排器;
10. Service Orchestration 服务编排器将最后应答数据转发给后置过滤器Filter进行处理,后置过滤器Filter处理后将最后应答数据依次发送给GateWay WebHander和Gateway Hander Mapping,最终由Gateway Hander Mapping将完整的最后应答数据发送给客户端。
本发明一种基于Spring cloud gateway的微服务编排和数据聚合的方法将编排微服务的整个操作放到Spring cloud gateway网关进行,由网关对数据做处理与转换这样无需对后端服务做改动;所有的外部请求都会先经过微服务编排和数据聚合引擎这一层,给客户端和服务器端之间提供了一个中间层,微服务本身的实现更多的考虑业务逻辑,而安全、性能、监控、服务编排、数据聚合可以由微服务编排和数据聚合引擎来完成,这样既提高业务灵活性又不缺安全性,能够最大限度的降低服务间的耦合度。

Claims (3)

1.一种基于Spring cloud gateway的微服务编排和数据聚合的方法,其特征在于,包括:
A.客户端向Spring Cloud Gateway发出请求;
B.经前置过滤器Filter过滤后将请求转发到Service Orchestration服务编排器进行处理后将整合的结果应答转发到Data aggregator数据聚合器;
C.Data aggregator数据聚合器处理接收到的结果应答后并返回给ServiceOrchestration服务编排器;
D.Service Orchestration服务编排器将Data aggregator数据聚合器处理后的服务结果转发给后置过滤器Filter处理,最后返回给客户端;
步骤B包括:
调用前置过滤器进行过滤后将请求发送到Service Orchestration服务编排器,Service Orchestration服务编排器通过网关路由器来具体确定每个后端服务的路径;
网关路由器将请求转发到每个后端服务,并接收后端服务的应答数据后发送到Service Orchestration服务编排器;
Service Orchestration服务编排器对每个后端服务返回的应答数据做数据处理最后整合成一个完整的应答数据;
步骤C包括:
Service Orchestration服务编排器将整合后的应答数据发送到Data aggregator数据聚合器进行处理,Data aggregator数据聚合器对接收到的应答数据进行数据的过滤、删除、移动、重命名、拆包、封包和异常处理操作,从而形成完整的返回应答数据发送回Service Orchestration服务编排器。
2.如权利要求1所述的一种基于Spring cloud gateway的微服务编排和数据聚合的方法,其特征在于,步骤A包括:
客户端向Spring Cloud Gateway发出请求,经过Gateway Hander Mapping,如果在Gateway Hander Mapping中找到与请求相匹配的路由就将请求发送给GateWay WebHander进行处理;
GateWay Web Hander运行特定的请求过滤器链,其中过滤器链包括前置过滤器和后置过滤器。
3.如权利要求1所述的一种基于Spring cloud gateway的微服务编排和数据聚合的方法,其特征在于,步骤D包括:Service Orchestration服务编排器将Data aggregator数据聚合器处理后的返回应答数据转发给后置过滤器Filter处理后,由后置过滤器Filter将返回应答数据依次从GateWay Web Hander发送到Gateway Hander Mapping最后返回给客户端。
CN202010891930.6A 2020-08-31 2020-08-31 一种基于Spring cloud gateway的微服务编排和数据聚合的方法 Active CN111818182B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010891930.6A CN111818182B (zh) 2020-08-31 2020-08-31 一种基于Spring cloud gateway的微服务编排和数据聚合的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010891930.6A CN111818182B (zh) 2020-08-31 2020-08-31 一种基于Spring cloud gateway的微服务编排和数据聚合的方法

Publications (2)

Publication Number Publication Date
CN111818182A CN111818182A (zh) 2020-10-23
CN111818182B true CN111818182B (zh) 2021-07-13

Family

ID=72860322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010891930.6A Active CN111818182B (zh) 2020-08-31 2020-08-31 一种基于Spring cloud gateway的微服务编排和数据聚合的方法

Country Status (1)

Country Link
CN (1) CN111818182B (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637301B (zh) * 2020-12-16 2022-08-05 华中师范大学 一种基于Project Reactor框架的数据传输方法及系统
CN113220481A (zh) * 2021-04-30 2021-08-06 平安壹钱包电子商务有限公司 请求处理及反馈方法、装置、计算机设备及可读存储介质
CN113794636B (zh) * 2021-08-11 2022-11-18 科大国创云网科技有限公司 一种基于Spring Cloud Gateway实现的动态路由编排方法及系统
CN115242629A (zh) * 2022-06-29 2022-10-25 浪潮通信技术有限公司 基于api网关的数据聚合方法及装置
CN115567442A (zh) * 2022-09-06 2023-01-03 山东浪潮智慧医疗科技有限公司 一种实现Spring Cloud动态路由的方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108011768A (zh) * 2017-12-26 2018-05-08 杭州电子科技大学 一种aop拦截式HBase数据存储微服务架构构建方法
CN108924243A (zh) * 2018-07-20 2018-11-30 珠海宏桥高科技有限公司 基于微服务架构的数据分发及处理方法
US10289538B1 (en) * 2018-07-02 2019-05-14 Capital One Services, Llc Systems and methods for failure detection with orchestration layer
CN110609782A (zh) * 2019-09-19 2019-12-24 四川长虹电器股份有限公司 基于大数据的微服务优化系统及方法
CN111045648A (zh) * 2019-12-11 2020-04-21 盈佳云创科技(深圳)有限公司 一种微服务开发工具
CN111711610A (zh) * 2020-05-21 2020-09-25 深圳竹云科技有限公司 基于微服务架构的认证方法、系统及计算设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10129078B2 (en) * 2014-10-30 2018-11-13 Equinix, Inc. Orchestration engine for real-time configuration and management of interconnections within a cloud-based services exchange
US10678512B2 (en) * 2016-10-25 2020-06-09 Red Hat, Inc. Enabling local development of microservices for hosting in remote orchestration engines

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108011768A (zh) * 2017-12-26 2018-05-08 杭州电子科技大学 一种aop拦截式HBase数据存储微服务架构构建方法
US10289538B1 (en) * 2018-07-02 2019-05-14 Capital One Services, Llc Systems and methods for failure detection with orchestration layer
CN108924243A (zh) * 2018-07-20 2018-11-30 珠海宏桥高科技有限公司 基于微服务架构的数据分发及处理方法
CN110609782A (zh) * 2019-09-19 2019-12-24 四川长虹电器股份有限公司 基于大数据的微服务优化系统及方法
CN111045648A (zh) * 2019-12-11 2020-04-21 盈佳云创科技(深圳)有限公司 一种微服务开发工具
CN111711610A (zh) * 2020-05-21 2020-09-25 深圳竹云科技有限公司 基于微服务架构的认证方法、系统及计算设备

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"spring cloud中gateway存在的意义是什么";悟空问答;《http://share.wukongwenda.cn/question/6770135289529630989/》;20200220;第1页 *
"如何通过网关做服务编排";不会画画的作家;《https://www.jianshu.com/p/b983cc88e275》;20191021;第2页 *
悟空问答."spring cloud中gateway存在的意义是什么".《http://share.wukongwenda.cn/question/6770135289529630989/》.2020, *

Also Published As

Publication number Publication date
CN111818182A (zh) 2020-10-23

Similar Documents

Publication Publication Date Title
CN111818182B (zh) 一种基于Spring cloud gateway的微服务编排和数据聚合的方法
EP2815536B1 (en) Method and system for generating transaction data from network traffic data for an application system
CN110347708B (zh) 一种数据处理方法以及相关设备
CN109450936A (zh) 一种基于Kafka的异构通信协议的适配方法及装置
CN108021710A (zh) 一种动态接口转换方法、装置、终端设备及存储介质
CN102209076A (zh) 服务端与客户端之间的交互方法和交互系统
CN102571947A (zh) 一种代理处理数据的方法、装置和系统
CN104753928A (zh) 一种码流转发方法及系统
CN104978256A (zh) 一种日志输出方法和设备
CN114567650B (zh) 一种数据处理方法及物联网平台系统
CN111083223B (zh) 一种用于资产证券化处理子平台的区块链互联系统及其互联数据通信方法
CN106992940A (zh) 报文处理方法、装置、系统及终端
CN110784517B (zh) 基于区块链的业务应用集成方法、系统、终端及存储介质
WO2020206849A1 (zh) 一种处理带vlan tag的dhcp数据的方法及系统
CA2729314C (en) A method of performing data mediation, and an associated computer program product, data mediation device and information system
CN107864189A (zh) 一种基于dpi的应用层流量负载均衡方法
CN105245588A (zh) 一种web业务端口分离处理的方法
CN111866157B (zh) 云服务网关及云服务内外请求格式转换方法
US20120185871A1 (en) Capturing Provenance Data Within Heterogeneous Distributed Communications Systems
CN110989537A (zh) 生产数据处理方法、设备、介质及系统
CN109525539B (zh) 一种能力调用方法、调用回执方法、信息处理方法及系统
CN116094840B (zh) 一种智能网卡和汇聚分流系统
CN113986955B (zh) 业务链的确定方法、装置、电子设备及介质
US11921602B2 (en) Edge-based data collection system for an observability pipeline system
AU2017100411A4 (en) Content-based w internet channel communication protocol routing algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant