Data packaging method and device and storage medium
By receiving data requests and obtaining the topology structure of the target service microservices, and calling the packaging services of each service microservice in turn, the problem of packaging code and runtime environment coupling of different service microservices in the prior art is solved, and stable data packaging services are achieved and service stability is improved.
Patent Information
- Application Number
- CN202311093746.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, the packaging code coupling and the running-time environment coupling of different business microservices lead to the inability to stably implement data packaging services.
By receiving data requests, the target data source is determined and the topological structure of the target service microservices to which it belongs, and the packaging services of each service microservice are called in turn, thereby obtaining and packaging the target data and sending it to the data requester. Packaging services of different business microservices are isolated from each other, realizing the isolation of code and operation.
It provides a unified access point, so that the data requester can obtain the required data without connecting to different service microservices, improves service stability and avoids the coupling problem between packaged code and the operating environment.
Smart Images

Figure CN119537363A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer and network communication technology, and in particular, to a data packaging method, device, and storage medium. Background Art
[0002] In the prior art, packaging logic for different data sources is usually written and stored in a code repository. The packaging logic of the requested data source is executed according to the data request and returned to the upstream data requester. However, the prior art has the problem of coupling the packaging code and runtime environment of different business microservices, which makes it impossible to stably implement data packaging services. Summary of the invention
[0003] The embodiments of the present disclosure provide a data packaging method, device, and storage medium to solve the problems of packaging code coupling and runtime environment coupling of different business microservices.
[0004] In a first aspect, an embodiment of the present disclosure provides a data packaging method, including:
[0005] receiving a data request sent by a data requester, and determining a plurality of target data sources according to the data request;
[0006] Determine the target business microservices to which the multiple target data sources belong respectively, and obtain the topological structure between the target business microservices;
[0007] According to the topological structure, the packaging services corresponding to the target business microservices are called in sequence to obtain target data from the target business microservices, and the target data are packaged into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other;
[0008] The target data structure is sent to the data requester.
[0009] In a second aspect, an embodiment of the present disclosure provides a data packaging device, including:
[0010] A receiving unit, used for receiving a data request sent by a data requester;
[0011] A parsing unit, configured to determine a plurality of target data sources according to the data request; respectively determine the target business microservices to which the plurality of target data sources belong, and obtain a topological structure between the target business microservices;
[0012] A scheduling unit is used to sequentially call the packaging services corresponding to the target business microservices according to the topological structure to obtain target data from the target business microservices, and package the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other;
[0013] A sending unit is used to send the target data structure to the data requester.
[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;
[0015] The memory stores computer-executable instructions;
[0016] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the data packaging method described in the first aspect and various possible designs of the first aspect.
[0017] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the data packaging method described in the first aspect and various possible designs of the first aspect is implemented.
[0018] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including computer execution instructions. When a processor executes the computer execution instructions, it implements the data packaging method described in the first aspect and various possible designs of the first aspect.
[0019] The data packaging method, device and storage medium provided by the disclosed embodiment receive a data request sent by a data requester, determine multiple target data sources according to the data request; respectively determine the target business microservices to which the multiple target data sources belong, and obtain the topological structure between the target business microservices; according to the topological structure, sequentially call the packaging service corresponding to the target business microservice, obtain the target data from the target business microservice through the packaging service corresponding to the target business microservice, and package the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other; and send the target data structure to the data requester. Provide a unified access point for data request for different business microservices, and the data requester can obtain the required data without connecting to different business microservices; and each packaging service can independently execute the packaging logic through the packaging services corresponding to different business microservices, and each packaging service can be independently developed and independently operated, which solves the problem of packaging code coupling and runtime environment coupling of different business microservices, and is conducive to improving service stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0021] Figure 1 An example diagram of a device framework of a data packaging method provided by an embodiment of the present disclosure;
[0022] Figure 2 A schematic diagram of a data packaging method flow chart provided in an embodiment of the present disclosure;
[0023] Figure 3 A schematic diagram of constructing a topological structure between target business microservices provided in an embodiment of the present disclosure;
[0024] Figure 4 A schematic diagram of a target data structure provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of a packaging service execution state change provided by an embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of data format conversion provided by an embodiment of the present disclosure;
[0027] Figure 7 A structural block diagram of a data packaging device provided by an embodiment of the present disclosure;
[0028] Figure 8 A schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0030] In the prior art, packaging logic for different data sources is usually written and stored in a code repository. The packaging logic of the requested data source is executed according to the data request and returned to the upstream data requester. However, the prior art has the problem of coupling the packaging code and runtime environment of different business microservices, which makes it impossible to stably implement data packaging services.
[0031] However, since the packaging logic of different data sources is stored in a code repository, at the code implementation level, the data source packaging logic code is coupled, and all packaging logics share a set of code repositories, there is a possibility of accidental modification, misuse, or accidental deletion of code, resulting in inaccurate data packaging; at the service operation level, the data source packaging logic is not deployed and isolated, and the runtime environments of the packaging logic related to the data of different business microservices are coupled. If the packaging logic related to any business microservice crashes at runtime, the packaging of related businesses will fail.
[0032] In order to solve the above technical problems, the present invention provides a data packaging method, which receives a data request sent by a data requester, determines multiple target data sources according to the data request; respectively determines the target business microservices to which the multiple target data sources belong, and obtains the topological structure between the target business microservices; according to the topological structure, sequentially calls the packaging service corresponding to the target business microservice, obtains the target data from the target business microservice through the packaging service corresponding to the target business microservice, and packages the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other; and sends the target data structure to the data requester. Provide a unified access point for data request for different business microservices, and the data requester can obtain the required data without connecting to different business microservices; and the packaging services corresponding to different business microservices independently execute the packaging logic, and each packaging service can be independently developed and independently operated to achieve code isolation and operation isolation, solve the problems of packaging code coupling and runtime environment coupling of different business microservices, and improve service stability.
[0033] The data packaging method provided by the present disclosure can be applied to electronic devices such as servers, such as Figure 1 As shown, the device may include a base service module and packaging service modules corresponding to different business microservices, the packaging service modules corresponding to different business microservices are isolated from each other, and may also include a management service module and a format conversion service module. Optionally, the base service module, the packaging service modules corresponding to different business microservices, the management service module, and the format conversion service module may be implemented using a microservice architecture.
[0034] Among them, the base service module can receive a data request sent by a data requester, determine multiple target data sources according to the data request, respectively determine the target business microservices to which the multiple target data sources belong, and obtain the topological structure between the target business microservices, and call the packaging service corresponding to the target business microservice in sequence according to the topological structure, obtain the target data from the target business microservice through the packaging service corresponding to the target business microservice, and package the target data into a target data structure. Furthermore, the format conversion service module can convert the target data structure into a preset data format, and then send the converted target data structure to the data requester.
[0035] The management service module can configure and manage the configuration information of the candidate business microservices and / or the configuration information of the candidate data source, which may include operations such as adding, deleting, and modifying. The management service module may include a management submodule and a database. The management submodule may be used to configure and manage the configuration information of the candidate business microservices and the configuration information of the candidate data source. The database may be used to store the configuration information of the candidate business microservices and the configuration information of the candidate data source.
[0036] The base service module may specifically include a verification service submodule, a parsing service submodule and a scheduling service submodule.
[0037] Among them, the verification service submodule can be used to perform parameter verification on the data request after receiving the data request sent by the data requester.
[0038] The parsing service submodule can be used to determine the target business microservices to which multiple target data sources belong, and obtain the topological structure between the target business microservices. In an optional embodiment, a preset data source dependency tree can be constructed based on the configuration information of the alternative data source, the dependency relationship between multiple target data sources can be obtained based on the preset data source dependency tree, the dependency relationship between the target business microservices can be determined based on the dependency relationship between the target data sources, and the topological structure between the target business microservices can be constructed based on the dependency relationship between the target business microservices. In another optional embodiment, a preset business microservice dependency tree can be constructed based on the configuration information of the alternative business microservices and the configuration information of the alternative data source, and the topological structure between the target data sources can be obtained based on the preset business microservice dependency tree.
[0039] The scheduling service submodule can be used to call the packaged service corresponding to the target business microservice in sequence according to the topology structure. Among them, the scheduling service submodule and the packaged service corresponding to the target business microservice can communicate and transmit data through UDS (Unix Domain Sockets, Unix domain sockets, which enables two or more processes on the same machine to communicate data) without going through the network.
[0040] It should be noted that the user information and data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0041] The data packaging method disclosed in the present invention will be described in detail below in conjunction with specific embodiments.
[0042] refer to Figure 2 , Figure 2A flowchart of a data packaging method provided by an embodiment of the present disclosure. The method of this embodiment can be applied to electronic devices such as servers, and the data packaging method includes:
[0043] S201: Receive a data request sent by a data requester, and determine multiple target data sources according to the data request.
[0044] In this embodiment, when a data requester needs to access or load certain target data, the data requester may send a data request to the server, and the server may parse the data request and determine multiple target data sources corresponding to the target data according to the data request.
[0045] Optionally, the data request may directly include information of multiple target data sources, and the server may directly obtain the multiple target data sources from the data request; alternatively, multiple alternative scenes may be preset, and different alternative scenes may be associated with different data sources. The data request may include target scene information, and then, based on the target scene information, multiple preset data sources associated with the target scene information may be obtained as target data sources.
[0046] In addition, the data request also includes an identifier of the target data, which is used to obtain the target data from the target data source according to the identifier, wherein multiple target data can be associated with the same identifier, for example, the identifier can be a unique identifier of the data requester; or different target data can be associated with different identifiers.
[0047] Optionally, after receiving the data request sent by the data requester, the data requester may be verified to determine whether the data requester has the authority to access the target data source; and / or, the data request may be parameter verified, for example, to determine whether a field in the data request (such as the target data source or target scene information field) exists. If not, the verification fails. After the verification of the data requester and the parameter verification of the data request pass, multiple target data sources may be determined according to the data request to proceed to the subsequent steps.
[0048] S202: Determine the target business microservices to which the multiple target data sources belong respectively, and obtain the topological structure between the target business microservices.
[0049] In this embodiment, different data sources may belong to different business microservices, or some data sources may belong to the same business microservice. In this embodiment, data can be obtained simultaneously from different target data sources belonging to the same target business microservice. In addition, there may be dependencies between data sources, and data from different target data sources can be obtained in sequence based on the dependencies.
[0050] Therefore, in this embodiment, the target business microservices to which multiple target data sources belong can be determined respectively, and through the parsing process, the topological structure between the target business microservices can be obtained. The topological structure is used to characterize the dependency relationship between the target business microservices, and then based on the topological structure, the data of the target data sources included in each target business microservice can be obtained in sequence, and different target data sources belonging to the same target business microservice can obtain data at the same time. The method for obtaining the topological structure can adopt any feasible method, which is not limited here.
[0051] S203. According to the topological structure, the packaging services corresponding to the target business microservices are called in sequence to obtain target data from the target business microservices, and the target data are packaged into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other.
[0052] In this embodiment, corresponding packaging services are configured for different business microservices, and the packaging services corresponding to different business microservices are isolated from each other, that is, the packaging services corresponding to different business microservices independently execute the packaging logic and are not affected by each other, thereby realizing the independent development and operation, code and operation isolation of the packaging services corresponding to different business microservices, and solving the problem of coupling of packaging codes and runtime environments of different business microservices. The packaging logic of the packaging services corresponding to different business microservices can be implemented according to business needs, which will not be elaborated here.
[0053] In this embodiment, based on the topological structure, the packaging services corresponding to the target business microservices can be called in sequence to obtain the target data from the target business microservices, and then the target data can be packaged into a target data structure, wherein the specific form of the target data structure can be pre-set, such as a specific data template, and then the acquired target data can be added to the corresponding position in the target data structure to finally form the target data structure.
[0054] S204: Send the target data structure to the data requester.
[0055] In this embodiment, after obtaining the target data structure, the target data structure can be sent to the data requester, thereby satisfying the data requester's data request, so that the data requester does not need to connect to different business microservices, avoiding the complexity of different business microservices.
[0056] Optionally, before sending the target data structure to the data requester, the target data structure can be converted into a preset data format, such as PB, Json, Thrift format, etc., and then the converted target data structure can be sent to the data requester. Optionally, a conversion function can be configured for each data source, and the format conversion of each target data in the target data structure can be realized through the conversion function. Optionally, for some simple basic data sources, such as some simple basic fields, automatic format conversion can be realized by background configuration injection.
[0057] The data packaging method provided in this embodiment receives a data request sent by a data requester, determines multiple target data sources according to the data request; determines the target business microservices to which the multiple target data sources belong respectively, and obtains the topological structure between the target business microservices; according to the topological structure, sequentially calls the packaging services corresponding to the target business microservices to obtain target data from the target business microservices, and packages the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other; and sends the target data structure to the data requester. Provide a unified access point for data request for different business microservices, and the data requester can obtain the required data without connecting to different business microservices; and each packaging service can independently execute the packaging logic through the packaging services corresponding to different business microservices, and each packaging service can be independently developed and operated, which solves the problem of packaging code coupling and runtime environment coupling of different business microservices.
[0058] Based on any of the above embodiments, Figure 3 As shown, the step of obtaining the topological structure between the target business microservices in S202 includes:
[0059] S2021, determining the dependency relationship between the plurality of target data sources;
[0060] S2022. Determine the dependency relationship between the target business microservices according to the dependency relationship between the plurality of target data sources;
[0061] S2023. Construct a topology structure between the target business microservices based on the dependency relationships between the target business microservices.
[0062] In this embodiment, after determining multiple target data sources according to the data request, the dependency relationship between the multiple target data sources can be determined. For example, the multiple target data sources include target data sources 1 to 4, target data source 1 belongs to the target business microservice A, target data sources 2 and 3 belong to the target business microservice B, and target data source 4 belongs to the target business microservice C. The dependency relationship between the multiple target data sources is: target data source 2 depends on target data source 1, and target data source 4 depends on target data source 1; the dependency relationship between the target business microservices is determined according to the dependency relationship between the multiple target data sources. Taking the above example, target data source 2 depends on target data source 1. Since target data source 1 belongs to target business microservice A, target data sources 2 and 3 belong to target business microservice B, it can be known that the dependency relationship between the target business microservices is: target business microservice B depends on target business microservice A. It can also be known that target business microservice C depends on target business microservice A. Therefore, according to the dependency relationship between the target business microservices, the topological structure between the target business microservices is constructed, such as Figure 3 The topology shown in .
[0063] Optionally, the dependency relationship between different data sources may be pre-configured, and then the dependency relationship between multiple target data sources may be determined based on the pre-configured dependency relationship between different data sources; or, the dependency relationship between multiple target data sources may be determined by the following process:
[0064] Obtain a preset data source dependency tree; perform a deep traversal of the preset data source dependency tree according to the multiple target data sources to obtain dependency relationships between the multiple target data sources.
[0065] In this embodiment, the preset data source dependency tree represents the dependency relationship between different data sources through a tree structure, and then a deep traversal algorithm (such as a DFS algorithm) can be used to deeply traverse the preset data source dependency tree according to multiple target data sources, so that multiple target data sources can be quickly found in the preset data source dependency tree, and then the dependency relationship between the multiple target data sources can be determined based on the positions of the multiple target data sources in the preset data source dependency tree.
[0066] Optionally, the preset data source dependency tree can be obtained as follows:
[0067] The configuration information of multiple candidate data sources is obtained, wherein the configuration information includes the business microservices to which the candidate data sources belong, and the dependency relationship between the candidate data sources and other data sources; and the preset data source dependency tree is constructed according to the configuration information of the multiple candidate data sources.
[0068] In this embodiment, the configuration information of any alternative data source may specifically include, but is not limited to: a data source identifier (e.g., a data source name), a data source type (used to parse the results of data source packaging), the business microservice to which the data source belongs, data source dependencies, data source descriptions, etc. In this embodiment, the server may provide management services for configuring and managing alternative data sources, including but not limited to operations such as adding, deleting, and modifying the configuration information of the alternative data sources. Furthermore, a preset data source dependency tree may be constructed based on the configuration information of the alternative data sources, especially the data source dependencies in the configuration information. The process of constructing the preset data source dependency tree may adopt any method for constructing a tree structure, which is not limited here.
[0069] It should be noted that since the configuration information of the alternative data sources may be added, deleted, modified, etc. at any time, the configuration information of multiple alternative data sources can be periodically obtained, and a preset data source dependency tree can be constructed based on the configuration information of multiple alternative data sources so that the preset data source dependency tree can be kept updated.
[0070] In another optional embodiment, obtaining the topological structure between the target business microservices in S202 may include:
[0071] Obtain a preset business microservice dependency tree; perform a deep traversal of the preset business microservice dependency tree according to the target business microservice to obtain a topological structure between the target data sources.
[0072] In this embodiment, a preset business microservice dependency tree can be constructed in advance, and the dependency relationship between different business microservices can be represented by a tree structure. Then, a deep traversal algorithm (such as a DFS algorithm) can be used to deeply traverse the preset business microservice dependency tree according to multiple target business microservices, and multiple target business microservices can be quickly found in the preset business microservice dependency tree, and then the dependency relationship between multiple target business microservices can be determined based on the positions of the multiple target business microservices in the preset business microservice dependency tree.
[0073] Optionally, the preset business microservice dependency tree can be obtained in the following ways:
[0074] Obtain configuration information of multiple alternative business microservices and configuration information of multiple alternative data sources, wherein the configuration information of the alternative business microservices includes a list of data sources included in the alternative business microservices, and the configuration information of the alternative data source includes the business microservice to which the alternative data source belongs, and the dependency relationship between the alternative data source and other data sources; construct the preset business microservice dependency tree according to the configuration information of the multiple alternative business microservices and the configuration information of the multiple alternative data sources.
[0075] In this embodiment, the configuration information of any candidate business microservice may specifically include, but is not limited to: business identifier (e.g., business name), business microservice name, business microservice method name, data source list included in the business microservice (for data source verification), business code repository identifier (for code repository isolation), business microservice cluster name (for cluster scheduling), business description, etc. The configuration information of any candidate data source may specifically include, but is not limited to: data source identifier (e.g., data source name), data source type (for parsing the result of data source packaging), business microservice to which the data source belongs, data source dependency, data source description, etc. In this embodiment, the server may provide management services for configuring and managing candidate business microservices and candidate data sources, including but not limited to operations such as adding, deleting, and modifying the configuration information of the candidate business microservices and the configuration information of the candidate data source.
[0076] Furthermore, a preset business microservice dependency tree can be constructed based on the configuration information of the candidate business microservice and the configuration information of the candidate data source, and the dependency relationship between the candidate services can be determined based on the dependency relationship between the candidate data sources and the candidate business microservices to which each candidate data source belongs, thereby constructing a preset business microservice dependency tree. The process of constructing the preset business microservice dependency tree can adopt any method of constructing a tree structure, which is not limited here.
[0077] It should be noted that since the configuration information of the alternative business microservices and the configuration information of the alternative data sources may be added, deleted, modified, etc. at any time, the configuration information of the alternative business microservices and the configuration information of the alternative data sources can be periodically obtained, and the preset business microservice dependency tree can be built based on the configuration information of the alternative business microservices and the configuration information of the alternative data sources, so that the preset business microservice dependency tree can be kept updated.
[0078] On the basis of any of the above embodiments, in S203, according to the topology structure, sequentially calling the packaging service corresponding to the target business microservice to obtain target data from the target business microservice, and packaging the target data into a target data structure may specifically include:
[0079] S2031. When calling a packaged service corresponding to any first target business microservice, construct first input data of the first target business microservice according to second output data of a second target business microservice upstream of the first target business microservice in the topology structure;
[0080] S2032: Call the packaging service corresponding to the first target business microservice to input the first input data into the first target business microservice, and obtain first output data output by the first target business microservice;
[0081] S2033. Fill the first output data into a corresponding position of the target data structure.
[0082] In this embodiment, for target business microservices with upstream and downstream dependencies, the input data of the downstream target business microservice needs to rely on the output data of the upstream target business microservice. For example, the first target business microservice relies on the upstream second target business microservice. Therefore, when calling the packaged service corresponding to the first target business microservice, it is necessary to construct the input data (recorded as the first input data) of the first target business microservice based on the output data (recorded as the second output data) of the second target business microservice. Then, the first target business microservice inputs the first input data into the first target business microservice (for example, through remote procedure call RPC), obtains the output data (recorded as the first output data) output by the first target business microservice, and then fills the first output data into the corresponding position of the target data structure. If the first target business microservice includes multiple target data sources, the corresponding multiple first output data are obtained accordingly and filled into the corresponding positions of the target data structure respectively. Among them, when constructing the input data, it can be constructed based on the identifier of the target data in the data request.
[0083] Optionally, a schematic diagram of the target data structure may be as follows Figure 4 As shown, the target data structure is pre-configured with data locations from different data sources, and after any target business microservice obtains the target data from the target data source, it can be filled into the corresponding location of the target data structure. Optionally, different data structures can be configured for different scenarios.
[0084] In this embodiment, the packaged services corresponding to the first target business microservice are called sequentially based on the topological structure, wherein the corresponding packaged services can be called in parallel for target business microservices without dependencies, for example Figure 3 The target business microservice B and the target business microservice C in the above example can call the corresponding packaged services in parallel. Optionally, during the calling process, the execution status of the packaged services corresponding to each target business microservice can be marked in the topology structure, such as running, waiting, running completed, etc., to facilitate call management. Figure 5 shown.
[0085] Based on any of the above embodiments, before sending the target data structure to the data requester, the target data structure may be converted into a preset data format, for example Figure 6As shown, taking the conversion of data format DTO (data transfer object) into data format Pb or Json as an example, a conversion function can be configured for each data source and stored in the database. When performing data conversion, the conversion function corresponding to each data source is called, and the format conversion of each data in the target data structure is realized through the conversion function (only the data conversion of data sources 5 to 8 is shown in the figure).
[0086] Corresponding to the data packaging method of the above embodiment, Figure 7 This is a structural block diagram of a data packaging device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 7 The data packaging device 700 includes: a receiving unit 701, a parsing unit 702, a scheduling unit 703, and a sending unit 704.
[0087] The receiving unit 701 is used to receive a data request sent by a data requester;
[0088] The parsing unit 702 is used to determine multiple target data sources according to the data request; respectively determine the target business microservices to which the multiple target data sources belong, and obtain the topological structure between the target business microservices;
[0089] The scheduling unit 703 is used to call the packaging service corresponding to the target business microservice in sequence according to the topology structure, obtain target data from the target business microservice through the packaging service corresponding to the target business microservice, and package the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other;
[0090] The sending unit 704 is configured to send the target data structure to the data requester.
[0091] In one or more embodiments of the present disclosure, when acquiring the topological structure between the target business microservices, the parsing unit 702 is used to:
[0092] Determining dependencies between the plurality of target data sources;
[0093] Determine the dependency relationship between the target business microservices according to the dependency relationship between the multiple target data sources;
[0094] According to the dependency relationship between the target business microservices, a topology structure between the target business microservices is constructed.
[0095] In one or more embodiments of the present disclosure, when determining the dependency relationship between the plurality of target data sources, the parsing unit 702 is configured to:
[0096] Get the preset data source dependency tree;
[0097] The preset data source dependency tree is deeply traversed according to the multiple target data sources to obtain dependency relationships between the multiple target data sources.
[0098] In one or more embodiments of the present disclosure, when acquiring the preset data source dependency tree, the parsing unit 702 is used to:
[0099] Obtain configuration information of multiple candidate data sources, wherein the configuration information includes the business microservices to which the candidate data sources belong, and the dependency relationship between the candidate data sources and other data sources;
[0100] The preset data source dependency tree is constructed according to the configuration information of the multiple candidate data sources.
[0101] In one or more embodiments of the present disclosure, when acquiring the topological structure between the target business microservices, the parsing unit 702 is used to:
[0102] Get the preset business microservice dependency tree;
[0103] The preset business microservice dependency tree is deeply traversed according to the target business microservice to obtain the topological structure between the target data sources.
[0104] In one or more embodiments of the present disclosure, when obtaining a preset business microservice dependency tree, the parsing unit 702 is used to:
[0105] Obtain configuration information of multiple candidate business microservices and configuration information of multiple candidate data sources, wherein the configuration information of the candidate business microservices includes a list of data sources included in the candidate business microservices, and the configuration information of the candidate data source includes the business microservice to which the candidate data source belongs, and the dependency relationship between the candidate data source and other data sources;
[0106] The preset business microservice dependency tree is constructed according to the configuration information of multiple candidate business microservices and the configuration information of multiple candidate data sources.
[0107] In one or more embodiments of the present disclosure, the scheduling unit 703, when sequentially calling the packaging service corresponding to the target business microservice according to the topology structure to obtain target data from the target business microservice and packaging the target data into a target data structure, is used to:
[0108] When calling a packaged service corresponding to any first target business microservice, constructing first input data of the first target business microservice according to second output data of a second target business microservice upstream of the first target business microservice in the topology structure;
[0109] Calling a packaging service corresponding to the first target business microservice to input the first input data into the first target business microservice, and obtaining first output data output by the first target business microservice;
[0110] Fill the first output data into the corresponding position of the target data structure.
[0111] In one or more embodiments of the present disclosure, when the sending unit 704 sends the target data structure to the data requester, it is used to:
[0112] After the target data structure is converted into a preset data format, the converted target data structure is sent to the data requester.
[0113] In one or more embodiments of the present disclosure, the data request includes target scene information, and the parsing unit 702, when determining multiple target data sources according to the data request, is used to:
[0114] According to the target scene information, multiple preset data sources associated with the target scene information are obtained and determined as the multiple target data sources.
[0115] The data packaging device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar, and this embodiment will not be repeated here.
[0116] refer to Figure 8 , which shows a schematic diagram of the structure of an electronic device 800 suitable for implementing the embodiment of the present disclosure, and the electronic device 800 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0117] like Figure 8As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0118] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0119] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0120] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0121] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0122] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0123] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0124] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0125] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0126] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0127] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0128] In a first aspect, according to one or more embodiments of the present disclosure, a data packaging method is provided, comprising:
[0129] receiving a data request sent by a data requester, and determining a plurality of target data sources according to the data request;
[0130] Determine the target business microservices to which the multiple target data sources belong respectively, and obtain the topological structure between the target business microservices;
[0131] According to the topological structure, the packaging services corresponding to the target business microservices are called in sequence, the target data is obtained from the target business microservices through the packaging services corresponding to the target business microservices, and the target data is packaged into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other;
[0132] The target data structure is sent to the data requester.
[0133] According to one or more embodiments of the present disclosure, obtaining the topological structure between the target business microservices includes:
[0134] Determining dependencies between the plurality of target data sources;
[0135] Determine the dependency relationship between the target business microservices according to the dependency relationship between the multiple target data sources;
[0136] According to the dependency relationship between the target business microservices, a topology structure between the target business microservices is constructed.
[0137] According to one or more embodiments of the present disclosure, determining the dependency relationship between the plurality of target data sources includes:
[0138] Get the preset data source dependency tree;
[0139] The preset data source dependency tree is deeply traversed according to the multiple target data sources to obtain dependency relationships between the multiple target data sources.
[0140] According to one or more embodiments of the present disclosure, obtaining a preset data source dependency tree includes:
[0141] Obtain configuration information of multiple candidate data sources, wherein the configuration information includes the business microservices to which the candidate data sources belong, and the dependency relationship between the candidate data sources and other data sources;
[0142] The preset data source dependency tree is constructed according to the configuration information of the multiple candidate data sources.
[0143] According to one or more embodiments of the present disclosure, obtaining the topological structure between the target business microservices includes:
[0144] Get the preset business microservice dependency tree;
[0145] The preset business microservice dependency tree is deeply traversed according to the target business microservice to obtain the topological structure between the target data sources.
[0146] According to one or more embodiments of the present disclosure, obtaining a preset business microservice dependency tree includes:
[0147] Obtain configuration information of multiple candidate business microservices and configuration information of multiple candidate data sources, wherein the configuration information of the candidate business microservices includes a list of data sources included in the candidate business microservices, and the configuration information of the candidate data source includes the business microservice to which the candidate data source belongs, and the dependency relationship between the candidate data source and other data sources;
[0148] The preset business microservice dependency tree is constructed according to the configuration information of multiple candidate business microservices and the configuration information of multiple candidate data sources.
[0149] According to one or more embodiments of the present disclosure, the method of sequentially calling the packaging service corresponding to the target business microservice to obtain target data from the target business microservice according to the topology structure, and packaging the target data into a target data structure includes:
[0150] When calling a packaged service corresponding to any first target business microservice, constructing first input data of the first target business microservice according to second output data of a second target business microservice upstream of the first target business microservice in the topology structure;
[0151] Calling a packaging service corresponding to the first target business microservice to input the first input data into the first target business microservice, and obtaining first output data output by the first target business microservice;
[0152] Fill the first output data into the corresponding position of the target data structure.
[0153] According to one or more embodiments of the present disclosure, sending the target data structure to the data requester includes:
[0154] After the target data structure is converted into a preset data format, the converted target data structure is sent to the data requester.
[0155] According to one or more embodiments of the present disclosure, the data request includes target scene information, and determining multiple target data sources according to the data request includes:
[0156] According to the target scene information, multiple preset data sources associated with the target scene information are obtained and determined as the multiple target data sources.
[0157] In a second aspect, according to one or more embodiments of the present disclosure, a data packaging device is provided, including:
[0158] A receiving unit, used for receiving a data request sent by a data requester;
[0159] A parsing unit, configured to determine a plurality of target data sources according to the data request; respectively determine the target business microservices to which the plurality of target data sources belong, and obtain a topological structure between the target business microservices;
[0160] A scheduling unit, configured to sequentially call the packaging services corresponding to the target business microservices according to the topological structure, obtain target data from the target business microservices through the packaging services corresponding to the target business microservices, and package the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other;
[0161] A sending unit is used to send the target data structure to the data requester.
[0162] According to one or more embodiments of the present disclosure, when acquiring the topological structure between the target business microservices, the parsing unit is used to:
[0163] Determining dependencies between the plurality of target data sources;
[0164] Determine the dependency relationship between the target business microservices according to the dependency relationship between the multiple target data sources;
[0165] According to the dependency relationship between the target business microservices, a topology structure between the target business microservices is constructed.
[0166] According to one or more embodiments of the present disclosure, when determining the dependency relationship between the plurality of target data sources, the parsing unit is used to:
[0167] Get the preset data source dependency tree;
[0168] The preset data source dependency tree is deeply traversed according to the multiple target data sources to obtain dependency relationships between the multiple target data sources.
[0169] According to one or more embodiments of the present disclosure, when acquiring a preset data source dependency tree, the parsing unit is used to:
[0170] Obtain configuration information of multiple candidate data sources, wherein the configuration information includes the business microservices to which the candidate data sources belong, and the dependency relationship between the candidate data sources and other data sources;
[0171] The preset data source dependency tree is constructed according to the configuration information of the multiple candidate data sources.
[0172] According to one or more embodiments of the present disclosure, when acquiring the topological structure between the target business microservices, the parsing unit is used to:
[0173] Get the preset business microservice dependency tree;
[0174] The preset business microservice dependency tree is deeply traversed according to the target business microservice to obtain the topological structure between the target data sources.
[0175] According to one or more embodiments of the present disclosure, when obtaining a preset business microservice dependency tree, the parsing unit is used to:
[0176] Obtain configuration information of multiple candidate business microservices and configuration information of multiple candidate data sources, wherein the configuration information of the candidate business microservices includes a list of data sources included in the candidate business microservices, and the configuration information of the candidate data source includes the business microservice to which the candidate data source belongs, and the dependency relationship between the candidate data source and other data sources;
[0177] The preset business microservice dependency tree is constructed according to the configuration information of multiple candidate business microservices and the configuration information of multiple candidate data sources.
[0178] According to one or more embodiments of the present disclosure, when the scheduling unit sequentially calls the packaging service corresponding to the target business microservice according to the topology structure to obtain target data from the target business microservice and packages the target data into a target data structure, it is used to:
[0179] When calling a packaged service corresponding to any first target business microservice, constructing first input data of the first target business microservice according to second output data of a second target business microservice upstream of the first target business microservice in the topology structure;
[0180] Calling a packaging service corresponding to the first target business microservice to input the first input data into the first target business microservice, and obtaining first output data output by the first target business microservice;
[0181] Fill the first output data into the corresponding position of the target data structure.
[0182] According to one or more embodiments of the present disclosure, when the sending unit sends the target data structure to the data requester, it is used to:
[0183] After the target data structure is converted into a preset data format, the converted target data structure is sent to the data requester.
[0184] According to one or more embodiments of the present disclosure, the data request includes target scene information, and the parsing unit, when determining multiple target data sources according to the data request, is used to:
[0185] According to the target scene information, multiple preset data sources associated with the target scene information are obtained and determined as the multiple target data sources.
[0186] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0187] The memory stores computer-executable instructions;
[0188] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the data packaging method described in the first aspect and various possible designs of the first aspect.
[0189] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the data packaging method described in the first aspect and various possible designs of the first aspect is implemented.
[0190] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising computer execution instructions. When a processor executes the computer execution instructions, the data packaging method described in the first aspect and various possible designs of the first aspect is implemented.
[0191] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0192] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0193] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A data packaging method, characterized in that: include: receiving a data request sent by a data requester, and determining a plurality of target data sources according to the data request; Determine the target business microservices to which the multiple target data sources belong respectively, and obtain the topological structure between the target business microservices; According to the topological structure, the packaging services corresponding to the target business microservices are called in sequence, the target data is obtained from the target business microservices through the packaging services corresponding to the target business microservices, and the target data is packaged into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other; The target data structure is sent to the data requester.
2. The method according to claim 1, characterized in that The obtaining of the topological structure between the target business microservices includes: Determining dependencies between the plurality of target data sources; Determine the dependency relationship between the target business microservices according to the dependency relationship between the multiple target data sources; According to the dependency relationship between the target business microservices, a topology structure between the target business microservices is constructed.
3. The method according to claim 2, characterized in that The determining the dependency relationship between the plurality of target data sources comprises: Get the preset data source dependency tree; The preset data source dependency tree is deeply traversed according to the multiple target data sources to obtain dependency relationships between the multiple target data sources.
4. The method according to claim 3, characterized in that The step of obtaining a preset data source dependency tree includes: Obtain configuration information of multiple candidate data sources, wherein the configuration information includes the business microservices to which the candidate data sources belong, and the dependency relationship between the candidate data sources and other data sources; The preset data source dependency tree is constructed according to the configuration information of the multiple candidate data sources.
5. The method according to claim 1, characterized in that The obtaining of the topological structure between the target business microservices includes: Get the preset business microservice dependency tree; The preset business microservice dependency tree is deeply traversed according to the target business microservice to obtain the topological structure between the target data sources.
6. The method according to claim 5, characterized in that The obtaining of the preset business microservice dependency tree includes: Obtain configuration information of multiple candidate business microservices and configuration information of multiple candidate data sources, wherein the configuration information of the candidate business microservices includes a list of data sources included in the candidate business microservices, and the configuration information of the candidate data source includes the business microservice to which the candidate data source belongs, and the dependency relationship between the candidate data source and other data sources; The preset business microservice dependency tree is constructed according to the configuration information of multiple candidate business microservices and the configuration information of multiple candidate data sources.
7. The method according to any one of claims 1 to 5, characterized in that: The method of sequentially calling the packaging service corresponding to the target business microservice according to the topological structure to obtain target data from the target business microservice and packaging the target data into a target data structure includes: When calling a packaged service corresponding to any first target business microservice, constructing first input data of the first target business microservice according to second output data of a second target business microservice upstream of the first target business microservice in the topology structure; Calling a packaging service corresponding to the first target business microservice to input the first input data into the first target business microservice, and obtaining first output data output by the first target business microservice; Fill the first output data into the corresponding position of the target data structure.
8. The method according to any one of claims 1 to 5, characterized in that: The sending the target data structure to the data requester comprises: After the target data structure is converted into a preset data format, the converted target data structure is sent to the data requester.
9. The method according to any one of claims 1 to 5, characterized in that: The data request includes target scene information, and determining multiple target data sources according to the data request includes: According to the target scene information, multiple preset data sources associated with the target scene information are obtained and determined as the multiple target data sources.
10. A data packaging device, characterized in that: include: A receiving unit, used for receiving a data request sent by a data requester; A parsing unit, configured to determine a plurality of target data sources according to the data request; Determine the target business microservices to which the multiple target data sources belong respectively, and obtain the topological structure between the target business microservices; A scheduling unit is used to sequentially call the packaging services corresponding to the target business microservices according to the topological structure to obtain target data from the target business microservices, and package the target data into a target data structure; wherein the packaging services corresponding to different target business microservices are isolated from each other; A sending unit is used to send the target data structure to the data requester.
11. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that The method comprises computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 9 is implemented.