CN116028142A - Aggregation interface data acquisition method and device, storage medium and computer equipment - Google Patents

Aggregation interface data acquisition method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN116028142A
CN116028142A CN202211573810.7A CN202211573810A CN116028142A CN 116028142 A CN116028142 A CN 116028142A CN 202211573810 A CN202211573810 A CN 202211573810A CN 116028142 A CN116028142 A CN 116028142A
Authority
CN
China
Prior art keywords
interface
data
sub
page data
page
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.)
Pending
Application number
CN202211573810.7A
Other languages
Chinese (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.)
Guangzhou Fengwang Information Technology Co ltd
Original Assignee
Guangzhou Fengwang Information Technology 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 Guangzhou Fengwang Information Technology Co ltd filed Critical Guangzhou Fengwang Information Technology Co ltd
Priority to CN202211573810.7A priority Critical patent/CN116028142A/en
Publication of CN116028142A publication Critical patent/CN116028142A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

According to the aggregation interface data acquisition method, device, storage medium and computer equipment, when a page data request initiated by the front end is received, the page data request comprises a plurality of third party sub-interfaces corresponding to the page data to be requested, each third party sub-interface is provided with a corresponding back-end micro-service, the corresponding back-end micro-service can be called in parallel by utilizing each third party sub-interface, so that sub-interface data are acquired, the time for calling the interface data is shortened, then effective fields can be extracted from each sub-interface data, and each section of effective fields are aggregated through logic processing, so that the page data of the front-end request are obtained and returned to the front end. According to the method and the device, the sub-interface data of the back-end micro-service are called in parallel and the aggregation after effective field extraction is carried out, so that front-end page reporting errors caused by the abnormality of any back-end micro-service are avoided, the high-performance and high-availability characteristics of the aggregation interface are reflected, and further the service stability of the back-end and the front-end user experience are improved.

Description

Aggregation interface data acquisition method and device, storage medium and computer equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for acquiring aggregated interface data, a storage medium, and a computer device.
Background
With the development of the internet in various aspects such as multi-terminal, multi-platform, multi-service form and the like, the data interaction of the front end and the back end is increasingly complex, the experience requirement of users is also higher, after the micro-service architecture is popular, services which the back end needs to provide are more and thinner, such as commodities, information, articles, comments, videos, user information and the like, belong to different and independent micro-services, and the front end needs to acquire data from a plurality of back-end micro-services through a third party sub-interface when loading pages.
In the internet platform, the functions of the back-end micro-service are stable, and the front-end is changed frequently along with social hotspots, so that when data is requested to the back-end each time, data of a plurality of third-party sub-interfaces needs to be serially called for recoding to obtain page data needed by the front-end, the interface call time is long, and the front-end page serially accesses the plurality of third-party sub-interfaces If one of the back-end micro services is abnormal or down, the whole page of the front-end is misplaced, and the experience of the front-end user is affected.
Disclosure of Invention
The purpose of the present application is to at least solve one of the above technical drawbacks, and in particular, to a technical drawback in the prior art that when an aggregated interface invokes data, one of rear-end micro services is abnormal or down, which may cause the front-end whole page to be misplaced, thereby affecting the front-end user experience.
The application provides an aggregation interface data acquisition method, which comprises the following steps:
receiving a page data request initiated by a front end, wherein the page data request comprises a plurality of third party sub-interfaces corresponding to page data to be requested, and each third party sub-interface is provided with a corresponding back-end micro-service;
calling corresponding back-end micro-services in parallel through each third-party sub-interface, and acquiring sub-interface data returned by each back-end micro-service;
extracting effective fields in each piece of sub-interface data, and aggregating the extracted effective fields to form page data and returning the page data to the front end.
Optionally, the calling the corresponding back-end micro service through each third party sub-interface in parallel, and obtaining sub-interface data returned by each back-end micro service includes:
for each third party sub-interface, initiating a data acquisition request to the third party sub-interface, and judging whether the third party sub-interface responds to the data acquisition request within preset time;
if yes, calling sub-interface data of the corresponding back-end micro service through the third-party sub-interface, and updating the sub-interface data to a sub-interface backup cache corresponding to the third-party sub-interface;
if not, determining a sub-interface backup cache corresponding to the third-party sub-interface, and acquiring sub-interface data from the sub-interface backup cache.
Optionally, the extracting the valid field in each sub-interface data, and aggregating the extracted valid fields to form page data, and returning the page data to the front end, includes:
determining a plurality of data modules contained in the page data according to the page data requested by the front end;
analyzing each data module, and determining sub-interface data corresponding to each data module and a corresponding effective field position in the sub-interface data;
cutting each piece of sub-interface data based on the corresponding effective field position in each piece of sub-interface data to obtain an effective field corresponding to each data module;
and aggregating the effective fields corresponding to each data module according to the logic structure of the page data to form the page data and returning the page data to the front end.
Optionally, the method further comprises:
when the local cache has the page data corresponding to the page data request, determining the cache duration of the page data, and judging whether the cache duration exceeds the preset cache time period;
if not, directly returning the page data corresponding to the local cache to the front end;
if yes, returning to the step of calling the corresponding back-end micro-service through each third-party sub-interface in parallel.
Optionally, the method further comprises:
if the caching duration of the page data exceeds the preset caching duration and an abnormality occurs in the process of calling the data to acquire the page data through the third-party sub-interface, the page data corresponding to the local cache is directly returned to the front end.
Optionally, the method further comprises:
and if the cache time length of the page data in the local cache exceeds the preset deletion time length, clearing the page data from the local cache.
Optionally, the method further comprises:
and caching page data formed by aggregating the effective fields extracted from each sub-interface data into a local cache.
The application also provides an aggregation interface data acquisition device, which comprises:
the request receiving module is used for receiving a page data request initiated by the front end, wherein the page data request comprises a plurality of third party sub-interfaces corresponding to the page data to be requested, and each third party sub-interface is provided with a corresponding back-end micro-service;
the interface calling module is used for calling corresponding back-end micro-services in parallel through each third-party sub-interface and acquiring sub-interface data returned by each back-end micro-service;
and the data aggregation module is used for extracting the effective fields in each sub-interface data, aggregating the extracted effective fields to form page data, and returning the page data to the front end.
The present application also provides a storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the aggregate interface data acquisition method as in any of the above embodiments.
The present application also provides a computer device comprising: one or more processors, and memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the aggregate interface data acquisition method as in any of the above embodiments.
From the above technical solutions, the embodiments of the present application have the following advantages:
according to the aggregation interface data acquisition method, device, storage medium and computer equipment, when a page data request initiated by the front end is received, the page data request comprises a plurality of third party sub-interfaces corresponding to page data to be requested, each third party sub-interface is provided with a corresponding back-end micro-service, the third party sub-interfaces can be used for calling sub-interface data in the back-end micro-service so as to aggregate the page data to obtain the front-end request, then each third party sub-interface can be utilized to call the corresponding back-end micro-service in parallel to obtain the sub-interface data returned by each back-end micro-service, and effective fields are extracted from each third party sub-interface, so that the time for calling interface data is shortened, after the effective fields of each third party sub-interface are extracted, each section of effective field can be aggregated through logic processing, and therefore the page data of the front-end request is obtained, and the page data is returned to the front end. According to the method, sub-interface data of the rear-end micro service are called in parallel through each third-party sub-interface, and the sub-interface data are aggregated after effective field extraction, so that the problem that the whole front-end page is misplaced due to abnormality or downtime of one of the rear-end micro services is avoided, the high-performance and high-availability characteristics of the aggregated interface are reflected, and further the service stability of the rear end and the front-end user experience are improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a flow chart of an aggregate interface data acquisition method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an internal implementation logic of an interface aggregation and clipping service provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of an aggregate interface data acquiring device according to an embodiment of the present application;
fig. 4 is a schematic diagram of an internal structure of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
With the development of the internet in various aspects such as multi-terminal, multi-platform, multi-service form and the like, the data interaction of the front end and the back end is increasingly complex, the experience requirement of users is also higher, after the micro-service architecture is popular, services which the back end needs to provide are more and thinner, such as commodities, information, articles, comments, videos, user information and the like, belong to different and independent micro-services, and the front end needs to acquire data from a plurality of back-end micro-services through a third party sub-interface when loading pages.
In the internet platform, the functions of the back-end micro-service are stable, and the front-end is changed frequently along with social hotspots, so that when data is requested to the back-end each time, data of a plurality of third-party sub-interfaces needs to be serially called for recoding to obtain page data needed by the front-end, the interface call time is long, and the front-end page serially accesses the plurality of third-party sub-interfaces If one of the back-end micro services is abnormal or down, the whole page of the front-end is misplaced, and the experience of the front-end user is affected.
Based on this, the following technical scheme is proposed in the present application, see specifically below:
in one embodiment, as shown in fig. 1, fig. 1 is a flow chart of a method for acquiring aggregated interface data according to an embodiment of the present application; the invention provides a method for acquiring aggregation interface data, which can comprise the following steps:
s110: and receiving a page data request initiated by the front end.
In this step, when a user needs to browse information by acquiring page data through the back end on the internet, the aggregation interface of the front end may be utilized to initiate a page data request to the back end in the form of a page data request, so that the back end returns corresponding page data according to the page data request.
It can be understood that the page data request in the present application includes a plurality of third party sub-interfaces corresponding to the page data to be requested, where each third party sub-interface is provided with a corresponding back end micro service, the back end is formed by a plurality of back end micro services, and each back end micro service is a different and independent data module service, such as goods, information, articles, comments, videos, user information, and the like, which belong to different and independent micro services.
For example, when a user has browsing requirements on an article detail page, the article detail page includes article content, author information, endorsements, comment lists, related article recommendations and the like, and the data of the modules come from different back-end micro services, so that the front end can initiate a corresponding page data request to the back end through an aggregation interface of the article detail page to obtain related data aggregation, and thus the front end returns the article detail page required by the user.
Further, for the service change requirement of the front-end page data, when the front-end initiates a page data request to the rear-end through the aggregation interface, a plurality of third-party sub-interfaces required to be called by the page data and specific data fields required by each third-party sub-interface can be determined first, and then the page data request carrying calling information is sent to the rear-end.
S120: and calling corresponding back-end micro-services in parallel through each third-party sub-interface, and acquiring sub-interface data returned by each back-end micro-service.
In this step, after receiving the page data request initiated by the front end in step S110, if the back end needs to be called to obtain the latest page data, the corresponding back end micro-service can be called by using each third party sub-interface row according to the third party sub-interface corresponding to each data module included in the page data request, so as to obtain the sub-interface data returned by each back end micro-service.
Specifically, when data is called through each third-party sub-interface, each third-party sub-interface can be utilized to initiate a data request to a corresponding back-end micro-service, when the back-end micro-service receives the data request of the third-party sub-interface, corresponding sub-interface data is returned in time, and when the third-party sub-interface calls the data, a parallel calling method can be adopted, so that the time required by the interface call is the calling time of the third-party sub-interface with the longest response time in each third-party sub-interface, the time of the interface request is reduced, and the page data return efficiency is improved.
Further, each third party sub-interface in the application has a corresponding third party interface backup cache, the third party interface backup cache contains sub-interface data corresponding to the back-end micro service, if the call sub-interface data is abnormal, the data can be acquired through the third party interface backup cache, the data of the corresponding back-end micro service can be called in parallel in the mode, the performance of the aggregation interface can be improved, when one of the called back-end micro services is abnormal or down, the failure of data call caused by serial call can be avoided, and the influence of the back-end micro service fault on the back-end service is reduced.
S130: extracting effective fields in each sub-interface data, and aggregating the extracted effective fields to form page data and returning the page data to the front end.
In this step, after the sub-interface data returned by each back-end micro-service is obtained in step S120, the valid fields corresponding to each data module may be extracted from each sub-interface data according to each data module included in the data page request initiated by the front end, then each valid field may be recoded according to the requirement of the data page, and returned to the front end to generate the page data of the front-end request.
Specifically, the obtained sub-interface data are all data contained in the corresponding back-end micro service, so that a corresponding effective field is determined in each sub-interface data according to specific data field information of each third-party sub-interface carried by the page data request, so that the corresponding effective field is cut and extracted from the sub-interface data on the interface aggregation and clipping module.
For example, the data of the author information module is derived from a back-end micro service named as a user system in an article detail page at the front end, so that the aggregation interface corresponding to the article detail page needs to call sub-interface data corresponding to the user system, and the sub-interface data of the article system includes information of other various users besides the author information, at this time, the sub-interface data needs to be cut, and an effective field containing the author information is extracted for aggregating and generating page data to return to the front end.
Furthermore, the front-end page can be changed frequently along with the social hot spot, after the effective fields of each sub-interface data are extracted, each effective field can be recoded according to the latest typesetting of the front-end page, flexible matching is performed, the latest page data of the front-end request are obtained, and the data are returned to the front-end, so that the service change requirement of the front-end page data is met.
In the above embodiment, when a page data request initiated by a front end is received, the page data request includes a plurality of third party sub-interfaces corresponding to the page data to be requested, each of the third party sub-interfaces is provided with a corresponding back end micro service, the third party sub-interfaces may be used to call sub-interface data in the back end micro service so as to aggregate the page data requested by the front end, and then each of the third party sub-interfaces may be used to call the corresponding back end micro service in parallel to obtain sub-interface data returned by each of the back end micro service, and extract an effective field from each of the third party sub-interfaces, thereby reducing the time for calling the interface data. According to the method, sub-interface data of the rear-end micro service are called in parallel through each third-party sub-interface, and the sub-interface data are aggregated after effective field extraction, so that the problem that the whole front-end page is misplaced due to abnormality or downtime of one of the rear-end micro services is avoided, the high-performance and high-availability characteristics of the aggregated interface are reflected, and further the service stability of the rear end and the front-end user experience are improved.
In one embodiment, the step S120 of calling the corresponding back-end micro service through each third party sub-interface in parallel, and obtaining the sub-interface data returned by each back-end micro service may include:
s121: and initiating a data acquisition request to each third-party sub-interface aiming at each third-party sub-interface, and judging whether the third-party sub-interface responds to the data acquisition request within preset time.
S122: if yes, the sub-interface data of the corresponding back-end micro-service is called through the third-party sub-interface, and the sub-interface data is updated to the sub-interface backup cache corresponding to the third-party sub-interface.
S123: if not, determining a sub-interface backup cache corresponding to the third-party sub-interface, and acquiring sub-interface data from the sub-interface backup cache.
In this embodiment, when the data of each third-party sub-interface is called, a data acquisition request may be initiated to each third-party sub-interface, and sub-interface data returned by the third-party sub-interface in response to the data acquisition request may be received within a preset time, so as to determine whether an abnormal call failure occurs in the calling process of the third-party sub-interface, and if the call failure occurs within the preset time, a sub-interface backup cache corresponding to the third-party sub-interface may be determined, and sub-interface data may be acquired from the sub-interface backup cache.
Further, a corresponding sub-interface backup buffer can be set in each third-party sub-interface, so that sub-interface data of the corresponding back-end micro-service can be backed up, when the third-party sub-interface fails, data return can be obtained from the sub-interface backup buffer, error reporting caused by that the front-end page cannot obtain the data is avoided, and because the data in the back-end micro-service is easy to be changed due to real-time operation of a user, the sub-interface data of the corresponding back-end micro-service can be called through the third-party sub-interface each time, the sub-interface data can be updated to the sub-interface backup buffer corresponding to the third-party sub-interface, and the sub-interface data of the sub-interface backup buffer is ensured to be the latest data.
For some relatively stable data modules in the front-end page, the data modules cannot be changed in a large probability after being released, the data can be directly obtained from the sub-interface backup cache when being obtained, the calling of some third-party sub-interfaces is reduced, the operation time of the interfaces is shortened, and therefore the pressure of some third-party systems is reduced, for example, two modules, namely the article content and the author information in the article detail page, cannot be changed after being released, the data of the data modules can be backed up to the sub-interface backup cache according to specific service characteristics when the functions are developed, the caching time can be determined according to specific conditions, and when the data is obtained again, the data can be directly obtained from the sub-interface backup cache by utilizing an algorithm without repeatedly calling the corresponding third-party sub-interfaces.
Furthermore, in the case of an extreme fault, for example, when an abnormality occurs in the third-party subinterface and the corresponding subinterface backup cache has not backed up data yet, degradation processing can be performed on the subinterface service, where the service degradation processing can be performed on the data that should be returned by the third-party subinterface with the extreme fault by default, and the default data is returned, or the data that should be returned by the third-party subinterface with the extreme fault is set to be returned in blank, and a degradation identifier is returned.
For example, when an extreme fault occurs in the third-party sub-interface, the front end may respond according to the importance level of the module data corresponding to the third-party sub-interface, for example, when default data is returned, the front end page displays the default module in the corresponding module, when the degradation identifier is returned, the front end does not display the data in the corresponding module, and at the same time, friendly prompt is given to the user. Other ways of implementing the third party sub-interface data that may return an extreme fault in the present application may be used as the preferred solution of the present application, and are not limited herein.
In one embodiment, extracting the valid field in each sub-interface data in step S130, and aggregating the extracted valid fields to form page data, and returning the page data to the front end, may include:
s131: and determining a plurality of data modules contained in the page data according to the page data requested by the front end.
S132: and analyzing each data module, and determining sub-interface data corresponding to each data module and a corresponding effective field position in the sub-interface data.
S133: and cutting each piece of sub-interface data based on the position of the corresponding effective field in each piece of sub-interface data to obtain the effective field corresponding to each data module.
S134: and aggregating the effective fields corresponding to each data module according to the logic structure of the page data to form the page data and returning the page data to the front end.
In this embodiment, when acquiring the page data requested by the front end, all the data modules included in the data page may be determined first, and each data module may be parsed to obtain the valid field required by each data module, so as to determine the sub-interface data where each valid field is located and the corresponding position in the sub-interface data, so as to cut the corresponding character string from each sub-interface data, extract all the valid fields, and finally aggregate all the valid fields according to the logical structure of the page data, and generate the page data and return to the front end.
For example, a user requests to access an article detail page, a data module of the article detail page includes article content, author information, comment list and related article recommendation, wherein the article content is derived from an article system, the author information is derived from a user system, the endorsement number is derived from an endorsement system, the comment list is derived from a comment system, the related article recommendation is derived from a recommendation system, after all sub-interface data are called from the rear end micro-services, a character string forming a corresponding data module can be queried in each sub-interface data, and cutting can be performed, logic processing is performed on each effective field according to page typesetting of the article detail page, recoding is performed, and then the article detail page requested to be accessed by the user is compiled at the front end.
In one embodiment, the method may further comprise:
s140: when the local cache has the page data corresponding to the page data request, determining the cache duration of the page data, and judging whether the cache duration exceeds the preset cache period.
S150: if not, the corresponding page data in the local cache is directly returned to the front end.
S160: if yes, returning to the step of calling the corresponding back-end micro-service through each third-party sub-interface in parallel.
In this embodiment, when receiving a page data request initiated by a front end, whether the local cache has page data corresponding to the page data request may be checked first, if so, the cache duration of the page data may be further determined, and whether the cache duration exceeds a preset cache age period may be judged, if not, the page data corresponding to the local cache may be directly returned to the front end, if the cache duration exceeds the preset cache age period, the page data is defaulted to expire, and the data needs to be recalled from each third-party sub-interface to obtain the latest page data.
It can be understood that the preset cache expiration period can be flexibly set according to the service change of the front-end page, and can be 10 minutes or 15 minutes, and the time length of the preset cache expiration period is generally set to be shorter.
In one embodiment, the method further comprises:
s170: if the caching duration of the page data exceeds the preset caching duration, and an abnormality occurs in the process of calling the data to acquire the page data through the third-party sub-interface, the corresponding page data in the local cache is directly returned to the front end.
In this embodiment, when the local cache has the page data corresponding to the page data request, and the cache duration of the page data exceeds the preset cache period, the interface aggregation and clipping service is required to call data through the third party sub-interface to obtain the page data, and when an abnormality occurs in the call process and the page data cannot be obtained, the page data exceeding the preset cache time in the local cache can be directly returned to the front end, so that the high availability of the aggregation interface is improved, and the problem that the page data cannot be returned to affect the user experience is avoided.
For example, the preset buffering time is set to 10 minutes, the user backs up the page data to the local buffer memory when accessing for the first time, then initiates the access request again at 15 minutes, when the page data in the local buffer memory has exceeded the preset buffering time period, the default data is not expired and is not returned, the front end can request the interface aggregation and clipping service to acquire the page data again, if the interface aggregation and clipping service does not respond due to the fault in the requesting process, the front end will return to select the page data expired in the local buffer memory for return.
In one embodiment, the method may further comprise:
s180: if the cache duration of the page data in the local cache exceeds the preset deletion duration, the page data is cleared from the local cache.
In this embodiment, when the time of the page data backed up in the local cache is long, the backup value is lost due to the data change caused by the real-time operation of the user on the page data, and in order to avoid the pressure of the local cache, after the cache duration of the page data exceeds the preset deletion duration, the page data may be cleared from the local cache.
It can be understood that the preset deletion time period of the page data in the local cache is set to be longer than the preset cache time period, which can be 1 day or 2 days, and is used as backup data of the interface aggregation and clipping service, a proper buffer time is given to the back end, so that no data in the local cache is returned to the front end when the interface aggregation and clipping service is abnormal, and when the page data exceeds the preset deletion time period, the data in the page data also lose reference value and have no backup meaning, and the page data can be cleared from the local cache at the moment.
In one embodiment, the method further comprises:
s190: and caching page data formed by aggregating the effective fields extracted from each sub-interface data into a local cache.
In the step, the page data is generated after the interface aggregation and clipping service aggregates the effective fields extracted from each sub-interface data, and the page data can be cached to a local cache as a backup of the interface aggregation and clipping service, so that the pressure of a third-party system caused by repeatedly calling the interface when a user repeatedly accesses the same page data in a short time is avoided, and the stability of the back-end service is improved.
Specifically, when the user requests the page data for the first time, the aggregation interface does not have a local cache, the user can request the interface aggregation and clipping service to acquire the page data and back up the page data to the local cache, and when the user requests the page data again and the page data in the local cache exceeds the preset cache aging period, the aggregation interface can update the page data acquired by the interface aggregation and clipping service in the local cache.
For better explanation of the method for acquiring aggregated interface data of the present application, the following is further described with reference to fig. 2, schematically, as shown in fig. 2, fig. 2 is a schematic diagram of internal implementation of the interface aggregation and clipping service provided in the embodiment of the present application.
In fig. 2, after receiving a data page request initiated by a front end, the interface aggregation and clipping service may determine whether a backup exists in a local cache of the requested aggregation interface, if yes, may directly return the cached page data, if no, further parallel acquisition of third-party sub-interface data is required and the finally aggregated page data is cached in the local cache, and if the corresponding third-party sub-interface data is acquired, it is determined whether the data is normally returned within a specified time, if yes, the data is acquired from the third-party sub-interface and cached in the corresponding sub-interface backup cache, and if no, the data may be acquired from the sub-interface backup cache corresponding to the third-party sub-interface.
The aggregate interface data acquiring device provided in the embodiments of the present application will be described below, and the aggregate interface data acquiring device described below and the aggregate interface data acquiring method described above may be referred to correspondingly.
In one embodiment, as shown in fig. 3, fig. 3 is a schematic structural diagram of an aggregate interface data obtaining device according to an embodiment of the present application; the application also provides an aggregate interface data acquisition device, which comprises a request receiving module 210, an interface calling module 220 and a data aggregation module 230, and specifically comprises the following steps:
the request receiving module 210 is configured to receive a page data request initiated by the front end, where the page data request includes a plurality of third party sub-interfaces corresponding to the page data to be requested, and each of the third party sub-interfaces is provided with a corresponding back-end micro service.
The interface calling module 220 is configured to call the corresponding back-end micro services in parallel through each third-party sub-interface, and obtain sub-interface data returned by each back-end micro service.
And the data aggregation module 230 is configured to extract valid fields in each sub-interface data, aggregate the extracted valid fields to form page data, and return the page data to the front end.
In the above embodiment, when a page data request initiated by the front end is received, the page data request includes a plurality of third party sub-interfaces corresponding to the page data to be requested, each of the third party sub-interfaces is provided with a corresponding back end micro service, the third party sub-interfaces can be used for calling sub-interface data in the back end micro service so as to aggregate the page data to obtain the front end request, then each of the third party sub-interfaces can be used for calling the corresponding back end micro service in parallel to obtain sub-interface data returned by each of the back end micro service, and an effective field is extracted from each of the third party sub-interfaces, so that the time for calling the interface data is reduced, after the effective field of each of the third party sub-interfaces is extracted, each section of the effective field can be aggregated through logic processing, so as to obtain the page data requested by the front end, the page data can be returned to the front end, and the method of aggregating the sub-interface data after the sub-interface data is extracted by the back end micro service is called in parallel by each of the third party sub-interfaces, one of the sub-interface data is avoided, the front end micro service is abnormal or the whole front end micro service is caused, and the front end can have high performance and the user interface can be further improved, and the service performance is improved.
In one embodiment, the interface call module 220 may include:
and the request response sub-module is used for initiating a data acquisition request to each third-party sub-interface aiming at each third-party sub-interface and judging whether the third-party sub-interface responds to the data acquisition request within preset time.
And the data calling sub-module is used for calling the sub-interface data of the corresponding back-end micro service through the third-party sub-interface and updating the sub-interface data to the sub-interface backup cache corresponding to the third-party sub-interface.
And the backup acquisition sub-module is used for determining a sub-interface backup cache corresponding to the third-party sub-interface and acquiring sub-interface data from the sub-interface backup cache.
In one embodiment, the data aggregation module 230 may include:
and the module determining submodule is used for determining a plurality of data modules contained in the page data according to the page data requested by the front end.
And the module analysis sub-module is used for analyzing each data module and determining sub-interface data corresponding to each data module and a corresponding effective field position in the sub-interface data.
And the field cutting sub-module is used for cutting each piece of sub-interface data based on the corresponding effective field position in each piece of sub-interface data to obtain the effective field corresponding to each data module.
And the field aggregation sub-module is used for aggregating the effective fields corresponding to each data module according to the logic structure of the page data to form the page data and returning the page data to the front end.
In one embodiment, the apparatus may further include:
the buffer time length judging module is used for determining the buffer time length of the page data when the page data corresponding to the page data request exists in the local buffer, and judging whether the buffer time length exceeds the preset buffer time length or not.
And the page returning module is used for directly returning the page data corresponding to the local cache to the front end.
And the sub-interface calling module is used for returning to the step of calling the corresponding back-end micro-service through each third-party sub-interface in parallel.
In one embodiment, the apparatus may further include:
and the page acquisition module is used for directly returning the page data corresponding to the local cache to the front end if the cache time of the page data exceeds the preset cache time period and an abnormality occurs in the process of calling the data to acquire the page data through the third-party sub-interface.
In one embodiment, the apparatus may further include:
and the data clearing module is used for clearing the page data from the local cache if the cache duration of the page data in the local cache exceeds the preset deletion duration.
In one embodiment, the apparatus may further include:
and the page caching module is used for caching page data formed by aggregating the effective fields extracted from each sub-interface data to a local cache.
In one embodiment, the present application also provides a storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the aggregate interface data acquisition method as set forth in any one of the above embodiments.
In one embodiment, the present application also provides a computer device having stored therein computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the aggregate interface data acquisition method as in any of the above embodiments.
Schematically, as shown in fig. 4, fig. 4 is a schematic internal structure of a computer device according to an embodiment of the present application, where the computer device 300 may be provided as a server. Referring to FIG. 4, computer device 300 includes a processing component 302 that further includes one or more processors, and memory resources represented by memory 301, for storing instructions, such as applications, executable by processing component 302. The application program stored in the memory 301 may include one or more modules each corresponding to a set of instructions. Further, the processing component 302 is configured to execute instructions to perform the aggregate interface data acquisition method of any of the embodiments described above.
The computer device 300 may also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input output (I/O) interface 305. The computer device 300 may operate based on an operating system stored in memory 301, such as Windows Server TM, mac OS XTM, unix TM, linux TM, free BSDTM, or the like.
Those skilled in the art will appreciate that the structures shown in FIG. 4 are block diagrams only and do not constitute a limitation of the computer device on which the present aspects apply, and that a particular computer device may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the present specification, each embodiment is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and may be combined according to needs, and the same similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. An aggregate interface data acquisition method, the method comprising:
receiving a page data request initiated by a front end, wherein the page data request comprises a plurality of third party sub-interfaces corresponding to page data to be requested, and each third party sub-interface is provided with a corresponding back-end micro-service;
calling corresponding back-end micro-services in parallel through each third-party sub-interface, and acquiring sub-interface data returned by each back-end micro-service;
extracting effective fields in each piece of sub-interface data, and aggregating the extracted effective fields to form page data and returning the page data to the front end.
2. The method for acquiring the aggregated interface data according to claim 1, wherein the calling the corresponding back-end micro-service in parallel through each third-party sub-interface and acquiring the sub-interface data returned by each back-end micro-service comprises:
for each third party sub-interface, initiating a data acquisition request to the third party sub-interface, and judging whether the third party sub-interface responds to the data acquisition request within preset time;
if yes, calling sub-interface data of the corresponding back-end micro service through the third-party sub-interface, and updating the sub-interface data to a sub-interface backup cache corresponding to the third-party sub-interface;
if not, determining a sub-interface backup cache corresponding to the third-party sub-interface, and acquiring sub-interface data from the sub-interface backup cache.
3. The method for acquiring aggregated interface data according to claim 1, wherein extracting valid fields in each sub-interface data, and aggregating the extracted valid fields to form page data, and returning the page data to the front end, comprises:
determining a plurality of data modules contained in the page data according to the page data requested by the front end;
analyzing each data module, and determining sub-interface data corresponding to each data module and a corresponding effective field position in the sub-interface data;
cutting each piece of sub-interface data based on the corresponding effective field position in each piece of sub-interface data to obtain an effective field corresponding to each data module;
and aggregating the effective fields corresponding to each data module according to the logic structure of the page data to form the page data and returning the page data to the front end.
4. The aggregate interface data acquisition method of claim 1, further comprising:
when the local cache has the page data corresponding to the page data request, determining the cache duration of the page data, and judging whether the cache duration exceeds the preset cache time period;
if not, directly returning the page data corresponding to the local cache to the front end;
if yes, returning to the step of calling the corresponding back-end micro-service through each third-party sub-interface in parallel.
5. The aggregate interface data acquisition method of claim 4, further comprising:
if the caching duration of the page data exceeds the preset caching duration and an abnormality occurs in the process of calling the data to acquire the page data through the third-party sub-interface, the page data corresponding to the local cache is directly returned to the front end.
6. The aggregate interface data acquisition method of claim 4, further comprising:
and if the cache time length of the page data in the local cache exceeds the preset deletion time length, clearing the page data from the local cache.
7. The aggregate interface data acquisition method of claim 1, further comprising:
and caching page data formed by aggregating the effective fields extracted from each sub-interface data into a local cache.
8. An aggregate interface data acquisition device, comprising:
the request receiving module is used for receiving a page data request initiated by the front end, wherein the page data request comprises a plurality of third party sub-interfaces corresponding to the page data to be requested, and each third party sub-interface is provided with a corresponding back-end micro-service;
the interface calling module is used for calling corresponding back-end micro-services in parallel through each third-party sub-interface and acquiring sub-interface data returned by each back-end micro-service;
and the data aggregation module is used for extracting the effective fields in each sub-interface data, aggregating the extracted effective fields to form page data, and returning the page data to the front end.
9. A storage medium, characterized by: the storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the aggregate interface data acquisition method of any of claims 1 to 7.
10. A computer device, comprising: one or more processors, and memory;
stored in the memory are computer readable instructions which, when executed by the one or more processors, perform the steps of the aggregate interface data acquisition method of any of claims 1 to 7.
CN202211573810.7A 2022-12-08 2022-12-08 Aggregation interface data acquisition method and device, storage medium and computer equipment Pending CN116028142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211573810.7A CN116028142A (en) 2022-12-08 2022-12-08 Aggregation interface data acquisition method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211573810.7A CN116028142A (en) 2022-12-08 2022-12-08 Aggregation interface data acquisition method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN116028142A true CN116028142A (en) 2023-04-28

Family

ID=86075126

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211573810.7A Pending CN116028142A (en) 2022-12-08 2022-12-08 Aggregation interface data acquisition method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN116028142A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116109112A (en) * 2023-04-12 2023-05-12 徐工汉云技术股份有限公司 Service data processing method, device, medium and equipment based on aggregation interface

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116109112A (en) * 2023-04-12 2023-05-12 徐工汉云技术股份有限公司 Service data processing method, device, medium and equipment based on aggregation interface

Similar Documents

Publication Publication Date Title
US8544059B2 (en) System and method for determining effective policy profiles in a client-server architecture
US9762670B1 (en) Manipulating objects in hosted storage
US20150012513A1 (en) Providing a query results page
US20160191652A1 (en) Data storage method and apparatus
CN112052247A (en) Index updating system, method and device of search engine, electronic equipment and storage medium
CN110928904A (en) Data query method and device and related components
CN110389859B (en) Method, apparatus and computer program product for copying data blocks
CN111782692B (en) Frequency control method and device
US10642585B1 (en) Enhancing API service schemes
CN116028142A (en) Aggregation interface data acquisition method and device, storage medium and computer equipment
CN110659971A (en) Transaction data processing method and device
CN111935782B (en) Optimization method of client retry mechanism and storage medium
US11243979B1 (en) Asynchronous propagation of database events
CN115470026A (en) Data caching method, data caching system, data caching disaster tolerance method, data caching disaster tolerance system and data caching system
US20210334316A1 (en) Deep pagination system
CN113360815A (en) Request retry method and device
CN116366634A (en) File downloading method, device, terminal, source server and medium
CN114691175A (en) Application updating method, device and system
CN114218471A (en) Data query method, device, system, electronic equipment and storage medium
CN111444184A (en) Data storage method, storage scheduling server, electronic device and storage medium
US11687266B2 (en) Managing deduplication operations based on a likelihood of duplicability
CN110569259A (en) Method and device for processing mass data
CN111291296B (en) Content issuing method and device
CN117539886A (en) User relationship query method, device, computing equipment and storage medium
CN111966937A (en) Search response method and device and computer readable storage medium

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