Service construction method, device, electronic device and storage medium

Through the service construction method, service building blocks and call templates are used to analyze the service call process, which solves the problems of heavy workload of rewriting service call codes and unclear boundaries in computer system development, and achieves efficient system development and maintenance.

CN113760226BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011338967.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-25
Publication Date
2024-10-18
Estimated Expiration
2040-11-25

AI Technical Summary

Technical Problem

In the development of existing computer systems, service calls require repeated preparation of different glue codes, resulting in low work efficiency, poor flexibility in the arrangement of each service call, and too much glue code, resulting in unclear boundaries of service business logic units and large amounts of code redundancy. Difficulty in system testing and maintenance.

Method used

Using the service construction method, by receiving service requests, parsing and executing service building blocks, and using call templates to orchestrate the service call process, service templates can be orchestrated, glue codes can be reduced, and the call process can be unified.

Benefits of technology

It improves the efficiency of system development, testing and maintenance, reduces code redundancy, clarifies service boundaries, and simplifies the service calling process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760226B_ABST
    Figure CN113760226B_ABST
Patent Text Reader

Abstract

The present application provides a service construction method, device, electronic device and storage medium, which receives a service request, determines a service building block according to the service request, then parses and executes the service building block to determine the service call result, and finally sends the service call result. Among them, the service building block is a collection of multiple business logic units arranged in a preset logical order. The service building block performs template arrangement for the call of various services from the perspective of business logic as a service, which solves the technical problems of the service call code recompilation workload, unclear service boundaries, large code redundancy and low efficiency, and difficult system development, testing and maintenance caused by the service construction method with code implementation as the core logic in the prior art, and realizes the modularization of service building blocks and the use of templates to call them, achieving the technical effect of reducing glue code, reducing code redundancy, unifying the call process, and improving the work efficiency of system development, testing and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a service construction method, device, electronic device and storage medium. Background Art

[0002] With the popularization and improvement of computer systems, and the increasing diversification of people's needs for computer systems, the cycle of computer system replacement, maintenance and development is getting shorter and shorter, which also brings huge workload to computer program developers.

[0003] At present, when developing a new computer system, due to reasons such as software and hardware architecture and development work distribution, a computer system is generally divided into the bottom layer, middle layer and application layer. Different developers are responsible for implementing each layer. The previous layer designs the corresponding call interface for the next layer to call, and each layer uses "glue" code to glue each call interface into a business module or application module according to the specific application scenario.

[0004] However, in the development and maintenance process of existing computer systems, when calling a service in different systems, modules or architectures, front-end developers need to compile different business glue codes, which results in a lot of duplication of work and low work efficiency. In addition, the flexibility of call arrangement between services is poor, and the code needs to be modified and re-arranged each time, and then re-released online. In addition, due to multiple maintenance or cumulative updates of multiple versions, there are too many glue service codes, resulting in unclear boundaries of business logic units corresponding to the services, increasing redundancy of subsequent program codes, and lower code efficiency. In the long run, it is difficult to test and maintain computer systems. Summary of the invention

[0005] The present application provides a service construction method, device, electronic device and storage medium to solve the technical problems in the prior art that service calls need to repeatedly compile different glue codes, resulting in low work efficiency, poor flexibility in the arrangement of each service call, and unclear boundaries of the business logic units of the service due to excessive glue codes.

[0006] In a first aspect, the present application provides a service construction method, comprising:

[0007] receiving a service request, wherein the service request includes a service building block identifier;

[0008] Determine a service building block according to the service request, the service building block comprising: a calling template and at least one building block for loading the called service, the calling template being used to arrange the building blocks and the preset logical order of the called service;

[0009] Parsing each of the building blocks in the service building block according to the calling template to determine a service calling result;

[0010] The service call result is sent.

[0011] In a possible design, parsing and executing the service building block to determine the service call result includes:

[0012] Parsing each of the building blocks in the service building block according to the calling template to determine the called service in each building block;

[0013] Determine the calling process of each called service according to the calling template,

[0014] The called service is executed according to the calling process to determine the service calling result.

[0015] Optionally, the calling process includes a preset logical order of the called service and parameters required to be passed for executing the called service, and executing the called service according to the calling process to determine the service calling result includes:

[0016] The called service is executed according to the preset logical order and the parameters to determine the service calling result.

[0017] Optionally, the called service is a business logic unit.

[0018] In a possible design, parsing each of the building blocks in the service building block according to the calling template to determine the called service in each building block includes:

[0019] Set the first said building block declared in said calling template as the current building block;

[0020] A: Analyze the attribute value of the current building block to determine the analysis result;

[0021] B: Determine the calling object of the current building block according to the parsing result;

[0022] C: Determine the type of the calling object;

[0023] If the type is service, then find the corresponding called service from the service registration center;

[0024] Continue parsing the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

[0025] Optionally, the building block is also used to load a sub-building block, and the sub-building block has the same composition structure as the building block; after determining the type of the calling object, the step C further includes:

[0026] If the type is a sub-block, setting the sub-block as the current block;

[0027] Repeat steps A to C until all the called services in the child building blocks are determined, and return to the parent building block for further parsing. The parent building block is the building block that loads the child building block.

[0028] Optionally, the building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block; after determining the type of the calling object, the step C further includes:

[0029] If the type is a sub-service building block, determining the building block corresponding to the sub-service building block according to the calling template in the sub-service building block;

[0030] Set the first block declared in the calling template of the sub-service block as the current block;

[0031] Repeat steps A to C until all called services called by the sub-service building block are determined;

[0032] Execute all called services called by the sub-service building block to determine the calling result of the sub-service building block;

[0033] The calling result of the sub-service building block is returned to the service building block, and the next building block declared in the calling template is continued to be parsed.

[0034] In a possible design, the building block includes a result wrapper, and the result wrapper is used to indicate the data type of the call result returned by the building block to the call template, and the executing the called service according to the call process to determine the service call result includes:

[0035] Obtaining the calling result of the called service by using the result wrapper;

[0036] The data type of the call result returned by the result wrapper is determined according to the setting parameters for the result wrapper in the call process.

[0037] Optionally, the data types include: result value, result graph, and custom result;

[0038] The result value is the call result of the last sub-unit in the building block, and the sub-unit includes: the called service, the sub-building block and the sub-service building block, and the sub-service building block has the same composition structure as the service building block;

[0039] The result graph is the calling result of each sub-unit in the building block;

[0040] The custom result is a service call result indicated by another result wrapper.

[0041] In a possible design, the property value of the building block includes a decision maker, and the decision maker is used to indicate whether the subunit of the building block needs to be called, and A: parsing the property value of the current building block to determine the parsing result includes:

[0042] Determining whether to continue parsing the current building block according to the decision maker of the current building block;

[0043] If the decision result of the decision maker is not to make any decision, then continue parsing;

[0044] If the judgment result is a custom decision maker, continue parsing the subunit specified by the custom decision maker.

[0045] Optionally, the attribute value of the building block includes a service call execution mode, and the execution mode includes: serial call and parallel call;

[0046] The serial call means calling all or part of the sub-units in sequence according to the declaration order in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit;

[0047] The parallel calling means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units;

[0048] A: parsing the attribute value of the current building block to determine the parsing result, including:

[0049] The calling mode of the subunit is determined according to the service calling execution mode of the current building block.

[0050] In a possible design, the property value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. A: parsing the property value of the current building block to determine the parsing result includes:

[0051] If the service type of the current building block is supply type, the current building block does not receive parameters.

[0052] In a possible design, the step A: parsing the attribute value of the current building block to determine a parsing result further includes:

[0053] If the service type of the current building block is not the supply type, then

[0054] The determining the calling mode of the sub-unit according to the service calling execution mode of the current building block includes:

[0055] If the service call execution mode is a serial call, the result of the previous call is used as the input parameter of the current call;

[0056] If the service call execution mode is parallel call, the parameters defined in the context of the building block are used as the input parameters of the current call.

[0057] In one possible design, the method further includes:

[0058] Drag and drop graphical identifiers of each service through a user interface to determine the preset logical order of the services;

[0059] Defining context transfer parameters of the calling template;

[0060] The calling template is determined according to the service, the preset logical order and the context transfer parameter.

[0061] Optionally, before receiving the service request, the method further includes:

[0062] Use the service registration model to determine the basic business logic unit;

[0063] The business logic unit is determined as a service and registered in a service registration center.

[0064] In a second aspect, the present application provides a service construction device, including:

[0065] A receiving module, used for receiving a service request, wherein the service request includes a service building block identifier;

[0066] A processing module, configured to determine a service building block according to the service request, wherein the service building block includes: a calling template and at least one building block for loading a called service, wherein the calling template is used to arrange a preset logical order of the building block and the called service;

[0067] The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the service calling result;

[0068] The sending module is used to send the service call result.

[0069] In a possible design, the processing module is further used to parse and execute the service building block to determine the service call result, including:

[0070] The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the called service in each building block;

[0071] The processing module is further used to determine the calling process of each of the called services according to the calling template, wherein the calling process includes a preset logical order of the called services and parameters required to be passed for executing the called services;

[0072] The processing module is further used to execute the called service according to the calling process to determine the service calling result.

[0073] Optionally, the calling process includes a preset logical order of the called service and parameters that need to be passed to execute the called service, and the processing module is further used to execute the called service according to the calling process to determine the service calling result, including:

[0074] The processing module is further used to execute the called service according to the preset logical order and the parameters, and determine the service calling result.

[0075] Optionally, the called service is a business logic unit.

[0076] In a possible design, the processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the called service in each building block, including:

[0077] The processing module is further used to set the first building block declared in the calling template as the current building block;

[0078] The processing module is further used for: A: parsing the property value of the current building block to determine the parsing result; B: determining the calling object of the current building block according to the parsing result; C: determining the type of the calling object;

[0079] The processing module is further configured to search for the corresponding called service from a service registration center if the type is service;

[0080] The processing module is further used to continue parsing the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

[0081] Optionally, the building block is also used to load a sub-building block, and the sub-building block has the same composition structure as the building block; the processing module is also used for C: after determining the type of the calling object, it also includes:

[0082] The processing module is further configured to set the sub-building block as the current building block if the type is a sub-building block;

[0083] The processing module is further used to repeat steps A to C until all the called services in the child building blocks are determined, and return to the parent building block for further parsing, wherein the parent building block is the building block that loads the child building blocks.

[0084] Optionally, the building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block; the processing module is also used for C: after determining the type of the calling object, it also includes:

[0085] The processing module is further configured to determine the building block corresponding to the sub-service building block according to the calling template in the sub-service building block if the type is a sub-service building block;

[0086] The processing module is further used to set the first building block declared in the calling template of the sub-service building block as the current building block;

[0087] The processing module is further used to repeat steps A to C until all called services called by the sub-service building block are determined;

[0088] The processing module is further used to execute all called services called by the sub-service building block to determine the calling result of the sub-service building block;

[0089] The processing module is further configured to return the calling result of the sub-service building block to the service building block, and continue parsing the next building block declared in the calling template.

[0090] In a possible design, the building block includes a result wrapper, and the result wrapper is used to indicate the data type of the call result returned by the building block to the call template. The processing module is further used to execute the called service according to the call process to determine the service call result, including:

[0091] The processing module is further used to obtain the calling result of the called service by using the result wrapper;

[0092] The processing module is further used to determine the data type of the calling result returned by the result wrapper according to the setting parameters for the result wrapper in the calling process.

[0093] Optionally, the data types include: result value, result graph, and custom result;

[0094] The result value is the call result of the last sub-unit in the building block, and the sub-unit includes: the called service, the sub-building block and the sub-service building block, and the sub-service building block has the same composition structure as the service building block;

[0095] The result graph is the calling result of each sub-unit in the building block;

[0096] The custom result is a service call result indicated by another result wrapper.

[0097] In a possible design, the property value of the building block includes a decision maker, and the decision maker is used to indicate whether the subunit of the building block needs to be called. The processing module is further used for A: parsing the property value of the current building block to determine the parsing result, including:

[0098] The processing module is further used to determine whether to continue parsing the current building block according to the decision maker of the current building block;

[0099] The processing module is further configured to continue parsing if the decision result of the decision maker is not to make any decision;

[0100] The processing module is further configured to continue parsing the subunit specified by the custom decision maker if the judgment result is a custom decision maker.

[0101] Optionally, the attribute value of the building block includes a service call execution mode, and the execution mode includes: serial call and parallel call;

[0102] The serial call means calling all or part of the sub-units in sequence according to the declaration order in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit;

[0103] The parallel calling means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units;

[0104] The processing module is further used for A: parsing the attribute value of the current building block to determine the parsing result, including:

[0105] The processing module is further configured to determine a calling mode of the subunit according to a service calling execution mode of the current building block.

[0106] In a possible design, the property value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. The processing module is further used for A: parsing the property value of the current building block to determine the parsing result, including:

[0107] The processing module is further configured to: if the service type of the current building block is a supply type, then the current building block does not receive parameters.

[0108] In a possible design, the processing module is further used for A: parsing the attribute value of the current building block to determine the parsing result, and further includes:

[0109] The processing module is further configured to: if the service type of the current building block is not the supply type,

[0110] The processing module is further used to determine the calling mode of the sub-unit according to the service calling execution mode of the current building block, including:

[0111] The processing module is further configured to use the result of the previous call as an input parameter of the current call if the service call execution mode is a serial call;

[0112] The processing module is further configured to use the parameters defined in the context of the building block as the input parameters of the current call if the service call execution mode is a parallel call.

[0113] In one possible design, it also includes:

[0114] The receiving module is further used to obtain the graphical identifier of each service dragged by the user interface,

[0115] The processing module is further used to determine the preset logical order of the services through the graphical identification;

[0116] The processing module is further used to define context transfer parameters of the calling template;

[0117] The processing module is further used to determine the calling template according to the service, the preset logical order and the context transfer parameter.

[0118] Optionally, before the receiving module is used to receive the service request, it also includes:

[0119] The processing module is further used to determine the basic business logic unit using the service registration model;

[0120] The processing module is further used to determine the business logic unit as a service and register it in a service registration center.

[0121] In a third aspect, the present application provides an electronic device, including:

[0122] A memory for storing program instructions;

[0123] The processor is used to call and execute the program instructions in the memory to execute any possible service construction method provided by the first aspect.

[0124] In a fourth aspect, the present application provides a storage medium, wherein the readable storage medium stores a computer program, and the computer program is used to execute any possible service construction method provided in the first aspect.

[0125] The present application provides a service construction method, device, electronic device and storage medium, which receives a service request, determines a service building block according to the service request, then parses and executes the service building block to determine the service call result, and finally sends the service call result. Among them, the service building block is a collection of multiple business logic units arranged in a preset logical order. The service building block performs template arrangement for the call of various services from the perspective of business logic as a service, which solves the technical problems of the service call code recompilation workload, unclear service boundaries, large code redundancy and low efficiency, and difficult system development, testing and maintenance caused by the service construction method with code implementation as the core logic in the prior art, and realizes the modularization of service building blocks and the use of templates to call them, achieving the technical effect of reducing glue code, reducing code redundancy, unifying the call process, and improving the work efficiency of system development, testing and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0126] In order to more clearly illustrate the technical solutions in the present application or 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0127] Figure 1 A schematic diagram of the relationship between service building blocks, building blocks and call templates provided in an embodiment of the present application;

[0128] Figure 2 A flowchart of a service construction method provided for this application;

[0129] Figure 3 A flowchart of another service construction method provided for this application;

[0130] Figure 4 A schematic diagram of the system architecture of a carrier of another service construction method provided by the present application;

[0131] Figure 5 A flowchart of another service construction method provided for this application;

[0132] Figure 6 A schematic diagram of the structure of a service construction device provided for this application;

[0133] Figure 7 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0134] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work, including but not limited to the combination of multiple embodiments, belong to the scope of protection of this application.

[0135] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0136] The following is an explanation and introduction of the professional terms involved in the embodiments of the present application.

[0137] Service: An activity performed to meet a certain need of an object. A service can be divided into multiple functional businesses. The object can be one or a category, and the activity can be one activity or a series of activities. For example, wireless communication is a service, and online shopping is a service. Furthermore, online shopping can be divided into order business, product search business, after-sales business, etc.

[0138] In the field of computer technology, service is the ability of a computer to respond to and process data processing requests. Some basic data processing functions can be used repeatedly by multiple services, or a business function of an application is completed by one or more corresponding services. In this case, the basic logical unit of this business function can be called a service.

[0139] In the embodiments of the present application, a service represents a specific function call process. A service can be loaded by building blocks. The attribute value of a service includes a calling method, which is used to indicate whether the service is searched and called by namespace and ID. The calling methods include: remote calling and local calling, wherein the remote calling is the default calling method when not specifically stated in the attribute value of the service, i.e., the remote calling is the default value of the calling method. A remote calling refers to searching and calling a service from a service registration center. A local calling refers to searching and calling a service from within the current local process.

[0140] It should be noted that services can also be divided into services with smaller logical scopes. Services that cannot be further divided are called atomic services. Services can be loaded by building blocks.

[0141] Building block: A logical process unit in the service calling process, and also a logical container, used to load services, building blocks, and at least one category of service building blocks. Building blocks can be nested with other building blocks. Parallel combination. Nested building blocks, the building block as the basis is called the parent building block, the nested building block is called the child building block, and the building block without a parent building block is called the root building block. Each time the building block is parsed, it is parsed from the root building block. Parallel combination of building blocks, or building blocks with the same parent building block are called brother building blocks. Building blocks are only valid within the parsing process of the building block engine. Their life cycle starts when they are parsed by the engine and ends when they are destroyed by the process.

[0142] The property values ​​of the building blocks include:

[0143] a) ID|RefId: Define a locally unique code|reference an existing locally unique code to refer to the building block.

[0144] b) Root: The root block identifier. The root block is used to load other blocks or services or service blocks. It is the entry point for service calls. There is only one root block.

[0145] c)Type: service type.

[0146] function: Functional type, receives parameters defined in the context, and has a return value. It is the default value of the service type.

[0147] predicate: a judgment type that receives parameters defined in the context and has a boolean return value.

[0148] consumer: consumption type, receives parameters defined by the context, and has no return value.

[0149] supplier: supply type, does not receive parameters, and has a return value.

[0150] callback: callback type, receives the parameters defined by the context, and returns a callback after execution is completed.

[0151] d) Action: Service call execution method.

[0152] Chain: Sequential call or serial call, the nested sub-blocks or services of the block are called in the order of declaration, and the output of the previous sub-unit is used as the input of the next sub-unit. It is the default value of the service call execution mode.

[0153] parallel: parallel call, the sub-units of the building block (including sub-building blocks, services, and sub-service building blocks) are called in parallel, and the parallel call results are collected.

[0154] e) Decision: The service calls the decider to determine whether it is necessary to call the sub-units of the building block (i.e., all or part of the sub-building blocks, services, and sub-service building blocks).

[0155] None: is the default value of the decider. It does not make any decision and is called directly.

[0156] customize: To customize, you need to implement a decision maker to determine whether to call the subunit of the block. The input parameters of the decision maker are the input parameters of the block. The so-called input parameters are the input parameters of the program.

[0157] f) Wrapper: Service call result wrapper. It will be triggered only when the service type is not equal to consumer and callback.

[0158] result: result value, which is the default value of the result wrapper. The result of calling the last subunit of the building block is taken as the result.

[0159] map: result map, takes the call results of each sub-unit of the building block and packages the results with map.

[0160] customize: To customize the result, you need to implement a wrapper to wrap the service call result. The input parameter of the wrapper is the call result of the building block.

[0161] The building block also includes call input parameters. When the building block has a parent building block, the building block's call input parameters are passed by the parent building block. When the building block has no parent building block, its call input parameters are dynamically passed in by the engine, and the parameters are the input parameters defined in the context when the template is parsed and executed.

[0162] Service building blocks: Arrange the building blocks in a preset logical order, and declare and define the parameters and return data passed between the building blocks. This method is called templated arrangement of building blocks. The ordered collection of arranged building blocks is called a service building block. The arrangement structure and parameters of the service building block, that is, the fragment generated by the template language after arranging a complete service call process, is called a call template.

[0163] The attribute values ​​of the service building block include:

[0164] a) ID: unique code, must be combined with the Namespace namespace. Different namespaces, but

[0165] Yes, the IDs can be the same, but they cannot be the same in the same namespace.

[0166] b) RefId: references an existing service building block. For example, the reference format is:

[0167] Namespace::ID.

[0168] c)Namespace: Namespace.

[0169] Template: Template, a fragment generated by the template language after arranging a complete service call process.

[0170] Calling parameters of service blocks: The calling parameters of service blocks are dynamically passed in when the engine parses and executes the template.

[0171] The inventive concept of this application is introduced below.

[0172] In the prior art, the development of computer systems or computer software, or the development, testing and maintenance of mobile applications, due to the inertial thinking of developers, are all viewed from the perspective of code construction logic. The realization of many functions, because code is a carrier, will make developers pay more attention to function calls, object construction and other coding methods. However, when planning the architecture of the entire application or computer system, the architecture is generally divided into three layers: bottom layer, middle layer, and application layer. In specific work, developers generally rarely do cross-layer work, and they all call the interface code output by the previous layer, process call code, etc. to carry out the next step of work.

[0173] At present, due to the shorter and shorter system update cycle, or the increasing demand for developing distributed services by deriving a series of applications based on one application, the same service may be used in different application scenarios, and the original code cannot be completely copied due to the differences between application scenarios. This leads to the need for developers to constantly update the call code of various basic business modules, namely the glue code, and with the increase in the number of updates and maintenance, the turnover of developers, changes in application scenarios, etc., the redundancy of the glue code continues to increase, and the service boundaries of the original basic business modules become unclear, that is, it is difficult to distinguish which part of the code segment actually plays a practical role, which brings great inconvenience to the subsequent streamlining, testing, and maintenance of the entire program.

[0174] When faced with the above problems, the inventor of the present application jumped out of the conventional coding thinking logic, and instead planned the calls from the overall service, solidified the basic business function modules into a "service", and then configured standard tools for the service calls, namely service building blocks. If the implementation process of a service in program development is regarded as building a car, the service building blocks are the engine, body, chassis and other parts of the car, and the service can be realized through the combination and configuration of service building blocks. How the specific basic types of services are placed in the service building blocks depends on the calling templates and building blocks of the service building blocks. The relationship between the three can be described by Figure 1 To express.

[0175] Figure 1 A schematic diagram of the relationship between the service building blocks, building blocks and call templates provided in the embodiment of the present application. Figure 1 As shown, the service building block 10 is obtained by arranging various building blocks, such as building block 101, building block 102, sub-service building block 11, etc. according to the preset position, order and structure, and the arrangement method of each service building block is to call the template. Because a service building block can complete one or more business functions, namely service contents, and after these service contents are fixed by templates, the call and implementation of the service will no longer be troubled by glue code. Each time, as long as the relevant declaration is made in the call template, the call requirements of different application scenarios can be met without the need to recompile the glue code for bonding or calling. To modify the service building block, you only need to update the call template, because the call template has already arranged which building blocks are to be used in the service building block.

[0176] It should be noted that a building block can also contain sub-units, including building blocks, services, and service building blocks. When a sub-unit is a service building block, the building block is a sub-service building block. Figure 1The sub-service building block 11 in the sub-service building block 11 contains sub-building blocks 111 and sub-building blocks 112. The service building block is a set of building blocks nested together to form a certain organizational structure, and the smallest logical unit is a service, which corresponds to a specific functional module or a functional code segment.

[0177] In order to solve the technical problems in the prior art of repeatedly compiling glue code for service calls, resulting in a large amount of repeated work, unclear service boundaries due to the glue code, high redundancy of subsequent program codes, low code efficiency, etc., the present application proposes a service construction method, which is described in detail below in conjunction with specific embodiments.

[0178] Figure 2 A flow chart of a service construction method provided in this application. Figure 2 As shown, the service construction method provided in the embodiment of the present application comprises the following specific steps:

[0179] S201: Receive a service request.

[0180] In this step, the service request includes a service building block identifier.

[0181] The service consumption device sends the service demand to the service providing device through the service request. Each service demand has a mapping relationship table with the service building block. Therefore, the service request contains the required service building block identifier, and the corresponding service building block can be found through the service building block identifier.

[0182] S202: Determine a service building block according to the service request.

[0183] In this step, the service building block is a set of multiple business logic units arranged in a preset logical order. The service building block includes: a calling template and at least one building block for loading the called service, and the calling template is used to arrange the building blocks and the preset logical order of the called service.

[0184] The service building block engine searches for the corresponding service building block identifier according to the received service request to determine the service building block to be used.

[0185] S203: Parse and execute the service building block to determine the service call result.

[0186] In this step, parsing and executing the service building block includes: parsing each of the building blocks in the service building block according to the calling template.

[0187] The service building block engine analyzes the building blocks needed in the service building blocks, the parameter transmission relationship between the building blocks, and the return value of the called service in each building block. These are planned by the call template in the service building block. The call template actually arranges the entire service call process. After determining the specific called service, the execution order of each called service, and the return value according to the analysis results, the called service is called from the service registration center or the local process, and after execution, the service call result is obtained.

[0188] S204: Send the service call result.

[0189] In this step, after the services called by the service building blocks are executed and the corresponding call results are returned, the service providing server sends the service call results to the service consuming device.

[0190] This embodiment provides a service construction method, which receives a service request, determines a service building block according to the service request, and then parses and executes the service building block to determine the service call result, and finally sends the service call result. Among them, the service building block is a collection of multiple business logic units arranged in a preset logical order. The service building block performs template arrangement for the call of various services from the perspective of business logic as a service, which solves the technical problems of the service call code recompilation workload, unclear service boundaries, large code redundancy and low efficiency, and difficult system development, testing and maintenance caused by the service construction method with code implementation as the core logic in the prior art, and realizes the modularization of service building blocks and the use of templates to call, achieving the technical effect of reducing glue code, reducing code redundancy, unifying the call process, and improving the work efficiency of system development, testing and maintenance.

[0191] Figure 3 A flowchart of another service construction method provided for this application. Figure 3 As shown, the specific steps of the service construction method include:

[0192] S301: Receive a service request and determine a service building block according to the service request.

[0193] The principle of this step is similar to that of S201-S202. Please refer to the above for the specific content, principle and explanation of terms, which will not be repeated here.

[0194] S302: parse each building block in the service building block according to the calling template to determine the called service in each building block.

[0195] In this step, the specific steps include:

[0196] S3021, setting the first building block declared in the calling template as the current building block;

[0197] S3022, parsing the property value of the current building block to determine the parsing result;

[0198] In this embodiment, the attribute value of the building block includes the execution mode of the service call, and the execution modes include: serial call and parallel call. Serial call means calling all or part of the sub-units in the order of declaration in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit; parallel call means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units. It should be noted that since the building block can be regarded as a container, the sub-units may include: service, building block, service building block. The building block loaded by the current building block is the sub-building block, and the service building block loaded by the current building block is the sub-service building block.

[0199] Then, in this step, specifically, the calling mode of the subunit is determined according to the service calling execution mode of the current building block to determine whether the subsequently called service is executed in serial or parallel mode, or part of it is called in serial mode and the other part is called in parallel mode.

[0200] In a possible implementation, the attribute value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. Then this step further includes:

[0201] If the service type of the current block is supply type, the current block does not receive parameters;

[0202] If the service type of the current building block is not the supply type, determining the calling mode of the subunit according to the service calling execution mode of the current building block includes:

[0203] If the service call execution mode is serial call, the result of the previous call is used as the input parameter of the current call;

[0204] If the service call execution mode is parallel call, the parameters defined in the context of the building block are used as the input parameters of the current call.

[0205] It should be noted that the calling method can make the arrangement of the called services in the service building block more flexible and diverse, thereby meeting the different needs of various service calling application scenarios and making the arrangement of the calling template more reasonable and diverse.

[0206] S3023, determining the calling object of the current building block according to the parsing result;

[0207] S3024. Determine the type of the calling object. If the type is service, find the corresponding called service from the service registration center.

[0208] In a possible design, it also includes determining whether the called service is a local service or a remote service. If it is a local service, the corresponding called service is searched from the local process; if it is a remote service, the corresponding called service is searched from the service registration center.

[0209] After parsing a building block, determine whether the parsing of the current building block is complete. If not, continue to repeat S3021-S3024. If the parsing of the current building block is complete, continue to repeat S3021-S3024 to parse the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

[0210] In a possible design, building blocks are also used to load sub-building blocks. Sub-building blocks have the same composition structure as building blocks and can also be used as a container, similar to the role of parent classes and child classes in code languages. Sub-building blocks can inherit some properties of parent building blocks or have their own separate property values.

[0211] Then S3024 also includes: if the type is a child block, setting the child block as the current block, repeating S3021-S3024 until all called services in the child block are determined, and returning to the parent block to continue parsing. It should be noted that the parent block is the block that loads the child block.

[0212] In a possible design, the building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block.

[0213] Then S3024 also includes: if the type is a sub-service building block, determining a building block corresponding to the sub-service building block according to a call template in the sub-service building block;

[0214] Set the first block declared in the call template of the sub-service block as the current block;

[0215] Repeat S3021-S3024 until the called service called by the sub-service building block is determined;

[0216] Execute all called services called by the sub-service building block to determine the calling result of the sub-service building block;

[0217] Return the call result of the sub-service block to the service block, and continue to parse the next block declared in the call template.

[0218] S303: Determine the calling process of each called service according to the calling template.

[0219] In this step, the calling process includes the preset logical order of the called services and the parameters that need to be passed to execute the called services.

[0220] The call template gives the execution order of each called service as well as the passed parameters and returned data.

[0221] S304: Execute the called service according to the calling process to determine the service calling result.

[0222] In this step, the service building block operation center executes each called service according to the calling template to obtain the service calling result.

[0223] It should be noted that the call result can be based on the service in the attribute value of the building block.

[0224] S305: Send the service call result.

[0225] In this step, after the services called by the service building blocks are executed and the corresponding call results are returned, the service providing server sends the service call results to the service consuming device.

[0226] This embodiment provides a service construction method, which receives a service request, determines a service building block according to the service request, and then parses and executes the service building block to determine the service call result, and finally sends the service call result. Among them, the service building block is a collection of multiple business logic units arranged in a preset logical order. The service building block performs template arrangement for the call of various services from the perspective of business logic as a service, which solves the technical problems of the service call code recompilation workload, unclear service boundaries, large code redundancy and low efficiency, and difficult system development, testing and maintenance caused by the service construction method with code implementation as the core logic in the prior art, and realizes the modularization of service building blocks and the use of templates to call, achieving the technical effect of reducing glue code, reducing code redundancy, unifying the call process, and improving the work efficiency of system development, testing and maintenance.

[0227] Figure 4 A schematic diagram of the system architecture of another carrier of a service construction method provided in this application. Figure 4 As shown, in this embodiment, the orchestration of the called service by the calling template is realized through the template metadata. The system is an architecture planning for the calling of services between two service activity objects on the application layer, namely, the service consumer and the service provider.

[0228] Service consumers can call service blocks to obtain services provided by service providers or service registration centers. Service consumers can also implement local service calls. The so-called local service calls are calls to services in the process that the current service consumer is processing. Service consumers can also package the call results of service blocks, i.e., "package call results", to perform other processing on the call results.

[0229] The service provider can return the call result according to the call instruction of the template metadata, or register the services it can provide in the service registration center. The service consumer can directly search for services from the service registration center to make local service calls.

[0230] The service building block engine is used to analyze the service requests made by service consumers and find the corresponding building blocks. Figure 4 The building blocks described in the description include: building blocks and service building blocks, because when a building block is only used to load a sub-service building block, its essence is a service building block. The service building block engine sends the required building blocks or service building blocks to the service building block configuration operation center to find the corresponding building blocks or service building blocks, and obtains the template metadata according to the call template associated with the building block or service building block, and downloads and caches it. Finally, the service building block engine parses and executes the service provided by the service provider according to the target metadata, and obtains the service call result and returns it to the service consumer.

[0231] The specific service calling process of this system is as follows Figure 5 shown.

[0232] Figure 5 A flowchart of another service construction method provided by this application. Figure 5 As shown, the specific steps of the service construction method include:

[0233] S501: Receive a service request.

[0234] In this step, the service consumer initiates a service call through a service request.

[0235] Specifically include:

[0236] The service consumer establishes communication with the service building block engine to send service requests;

[0237] Use the service building block engine to pre-process the call metadata in the service request.

[0238] S502: Determine a service building block according to the service request.

[0239] In this step, the specific implementation method is: using the service building block engine and the service building block operation center to search for the service building block, the specific steps include:

[0240] Use the service building block engine to search the called service building block in the local cache;

[0241] Communicate with the service block operation center and find the called service block.

[0242] S503: parse and execute the service building block to determine the service call result.

[0243] In this step, this step can be subdivided into S5031-S5033, as follows:

[0244] S5031. Obtain a service building block calling template using a service building block engine and a service building block operation center.

[0245] S5032: Utilize the service building block engine to parse the template metadata and execute the call.

[0246] In this step, the specific implementation is as follows:

[0247] (1) Use the service building block engine to parse the parent-child and brother building block relationships in the service building blocks.

[0248] (2) Set the first block declared in the service block as the current block.

[0249] It should be noted that the first building block is the root building block, and parsing starts from the root building block.

[0250] (3) Use the service building block engine to parse the calling strategy of the service call decider Decision of the current building block.

[0251] (4) Determine whether to continue parsing the current block based on the calling strategy. If it is none, continue parsing; if it is customize, call the custom decision maker to determine whether to continue parsing.

[0252] (5) Use the service block engine to parse the service call execution method Action of the current block.

[0253] (6) Determine the order in which the parsing is to be performed based on the Action. If it is a chain, then the parsing is performed in the order in which it is declared; if it is a parallel, then the parsing is performed according to the definition of the parallel call.

[0254] (7) Use the service block engine to parse the service type Type of the current block.

[0255] (8) Determine whether to receive parameters and how to receive parameters based on Type.

[0256] If Type is supplier, no parameters are accepted;

[0257] If Type is not supplier, the service call method Action is used to determine the service. If Action is chain, the result of the previous call is used as the call parameter.

[0258] If it is parallel, the input parameters defined in the calling context are used as the calling parameters.

[0259] (9) Call the sub-blocks, sub-service blocks, and sub-services of the current block. The so-called sub-service is the called service declared in the current block.

[0260] (10) Determine whether the current call is a service call, a service block call, or a block call.

[0261] (11) If a service is called, the called service is searched from the service registration center, cached, executed, and the call result is obtained; if a service block is called, the template metadata of the service block, i.e., the calling template, is obtained and parsing is continued; if a block is called, the block is set as the current block and parsing is continued from step (2).

[0262] (12) Get the call type Type of the current block. If it is a consumer type or a callback type, continue to parse the next sub-block (or sub-service block or sub-service) of the current block. If not, return the call result of the current block.

[0263] (13) Determine whether the current block has been parsed. If not, continue parsing its sub-blocks, sub-service blocks, and sub-services from step (9); if parsed, obtain the service call result wrapper of the current block.

[0264] (14) Take the call result of the current block as the input parameter and call Wrapper to obtain the final call result.

[0265] (15) Return the final call result of the current block to the parent block.

[0266] S5033. Obtain the service block calling result.

[0267] In this step, when the parsing and calling of the root block are all completed, the calling result is obtained from the root block, and this result is the calling result of the service block.

[0268] S504: Send the service block call result to the service consumer.

[0269] This embodiment provides a service construction method, which receives a service request, determines a service building block according to the service request, and then parses and executes the service building block to determine the service call result, and finally sends the service call result. Among them, the service building block is a collection of multiple business logic units arranged in a preset logical order. The service building block performs template arrangement for the call of various services from the perspective of business logic as a service, which solves the technical problems of the service call code recompilation workload, unclear service boundaries, large code redundancy and low efficiency, and difficult system development, testing and maintenance caused by the service construction method with code implementation as the core logic in the prior art, and realizes the modularization of service building blocks and the use of templates to call, achieving the technical effect of reducing glue code, reducing code redundancy, unifying the call process, and improving the work efficiency of system development, testing and maintenance.

[0270] In a possible design, before step S501, that is, before receiving the service request, the process further includes:

[0271] Use the service registration model to determine the basic business logic unit;

[0272] Identify the business logic unit as a service and register it in the service registration center.

[0273] Since the service construction method provided in this application requires the reallocation and management of the business logic units of the existing service calls in order to facilitate the loading of service building blocks, it is necessary to use the service registration model to Figure 4 The services of the service provider shown are divided to determine the basic business logic units, and these basic business logic units are solidified into the services in this application, and then registered in the service registration center to facilitate the above-mentioned calls.

[0274] In a possible design, call templates can be managed. The so-called management includes establishing and modifying call templates. Since call templates are specific arrangements of called services, for different application scenarios, it is only necessary to modify existing call templates or create new call templates to implement service calls suitable for different application scenarios. This reduces the workload of program developers in compiling glue code. In order to more intuitively and easily modify and create new call templates, a special call template interface can be set up for graphical modification or creation. The specific steps include:

[0275] Drag and drop the graphical icons of each service through the user interface to determine the preset logical order of the services;

[0276] Define the context passing parameters for calling template;

[0277] Determine the call template based on the service, preset logical order, and context passing parameters.

[0278] In this way, the modification and creation of call templates can be easily realized through the user interface, which greatly reduces the workload of program developers in compiling glue code for service calls in different application scenarios.

[0279] Figure 6 This is a schematic diagram of the structure of a service construction device provided by the present application. The service construction device 600 can be implemented by software, hardware or a combination of both.

[0280] like Figure 6 As shown, the service construction device 600 includes:

[0281] The receiving module 601 is used to receive a service request, wherein the service request includes a service building block identifier;

[0282] The processing module 602 is used to determine a service building block according to the service request, wherein the service building block is a set of multiple business logic units arranged in a preset logical order, and the service building block includes: a calling template and at least one building block for loading a called service, wherein the calling template is used to arrange the building block and the preset logical order of the called service;

[0283] The processing module 602 is further used to parse and execute the service building blocks to determine the service call result, including: parsing each of the building blocks in the service building blocks according to the call template to determine the service call result;

[0284] The sending module 603 is used to send the service calling result.

[0285] In a possible design, the service building block includes: the processing module 602 is further used to parse and execute the service building block to determine the service call result, including:

[0286] The processing module 602 is further configured to parse each of the service building blocks according to the calling template to determine the called service in each building block;

[0287] The processing module 602 is further used to determine the calling process of each called service according to the calling template;

[0288] The processing module 602 is further configured to execute the called service according to the calling process to determine the service calling result.

[0289] Optionally, the calling process includes a preset logical order of the called service and parameters that need to be passed to execute the called service. The processing module 602 is further used to execute the called service according to the calling process to determine the service calling result, including:

[0290] The processing module 602 is further configured to execute the called service according to the preset logical order and the parameters, and determine the service calling result.

[0291] Optionally, the called service is the business logic unit.

[0292] In a possible design, the processing module 602 is further configured to parse each of the building blocks in the service building block according to the calling template to determine the called service in each building block, including:

[0293] The processing module 602 is further configured to set the first building block declared in the calling template as the current building block;

[0294] The processing module 602 is further used for A: parsing the property value of the current building block to determine the parsing result; B: determining the calling object of the current building block according to the parsing result; C: determining the type of the calling object;

[0295] The processing module 602 is further configured to search for the corresponding called service from a service registration center if the type is service;

[0296] The processing module 602 is further configured to continue parsing the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

[0297] Optionally, the building block is also used to load a sub-building block, and the sub-building block has the same composition structure as the building block; the processing module 602 is also used for C: after determining the type of the calling object, it also includes:

[0298] The processing module 602 is further configured to set the sub-building block as the current building block if the type is a sub-building block;

[0299] The processing module 602 is further used to repeat steps A to C until all the called services in the child building blocks are determined, and return to the parent building block for further parsing, where the parent building block is the building block that loads the child building blocks.

[0300] Optionally, the building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block; the processing module 602 is also used for C: after determining the type of the calling object, it also includes:

[0301] The processing module 602 is further configured to determine a building block corresponding to the sub-service building block according to a calling template in the sub-service building block if the type is a sub-service building block;

[0302] The processing module 602 is further configured to set the first building block declared in the calling template of the sub-service building block as the current building block;

[0303] The processing module 602 is further used to repeat steps A to C until all called services called by the sub-service building block are determined;

[0304] The processing module 602 is further configured to execute all called services called by the sub-service building block to determine the calling result of the sub-service building block;

[0305] The processing module 602 is further configured to return the calling result of the sub-service building block to the service building block, and continue parsing the next building block declared in the calling template.

[0306] In a possible design, the building block includes a result wrapper, and the result wrapper is used to indicate the data type of the call result returned by the building block to the call template. The processing module 602 is further used to execute the called service according to the call process to determine the service call result, including:

[0307] The processing module 602 is further used to obtain the calling result of the called service by using the result wrapper;

[0308] The processing module 602 is further configured to determine the data type of the call result returned by the result wrapper according to the setting parameters for the result wrapper in the call process.

[0309] Optionally, the data types include: result value, result graph, and custom result;

[0310] The result value is the call result of the last sub-unit in the building block, and the sub-unit includes: the called service, the sub-building block and the sub-service building block, and the sub-service building block has the same composition structure as the service building block;

[0311] The result graph is the calling result of each sub-unit in the building block;

[0312] The custom result is a service call result indicated by another result wrapper.

[0313] In a possible design, the property value of the building block includes a decision maker, and the decision maker is used to indicate whether the subunit of the building block needs to be called. The processing module 602 is further used for A: parsing the property value of the current building block to determine a parsing result, including:

[0314] The processing module 602 is further configured to determine whether to continue parsing the current building block according to the decision maker of the current building block;

[0315] The processing module 602 is further configured to continue parsing if the decision result of the decision maker is not to make any decision;

[0316] The processing module 602 is further configured to continue parsing the subunit specified by the custom decision maker if the judgment result is a custom decision maker.

[0317] Optionally, the attribute value of the building block includes a service call execution mode, and the execution mode includes: serial call and parallel call;

[0318] The serial call means calling all or part of the sub-units in sequence according to the declaration order in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit;

[0319] The parallel calling means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units;

[0320] The processing module 602 is further used for A: parsing the attribute value of the current building block to determine the parsing result, including:

[0321] The processing module 602 is further configured to determine the calling mode of the subunit according to the service calling execution mode of the current building block.

[0322] In a possible design, the property value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. The processing module 602 is further used for A: parsing the property value of the current building block to determine the parsing result, including:

[0323] The processing module 602 is further configured to: if the service type of the current building block is a supply type, then the current building block does not receive parameters.

[0324] In a possible design, the processing module 602 is further used for A: parsing the attribute value of the current building block to determine the parsing result, and further includes:

[0325] The processing module 602 is further configured to: if the service type of the current building block is not the supply type,

[0326] The processing module 602 is further used to determine the calling mode of the sub-unit according to the service calling execution mode of the current building block, including:

[0327] The processing module 602 is further configured to use the result of the previous call as an input parameter of the current call if the service call execution mode is a serial call;

[0328] The processing module 602 is further configured to use the parameters defined in the context of the building block as the input parameters of the current call if the service call execution mode is a parallel call.

[0329] In one possible design, it also includes:

[0330] The receiving module is further used to obtain the graphical identifier of each service dragged by the user interface,

[0331] The processing module 602 is further configured to determine the preset logical order of the services through the graphical identification;

[0332] The processing module 602 is also used to define the context transfer parameters of the calling template;

[0333] The processing module 602 is further configured to determine the calling template according to the service, the preset logical order and the context transfer parameter.

[0334] Optionally, before the receiving module is used to receive the service request, it also includes:

[0335] The processing module 602 is also used to determine the basic business logic unit using the service registration model;

[0336] The processing module 602 is further used to determine the business logic unit as a service and register it in a service registration center.

[0337] It is worth mentioning that Figure 6 The service construction device provided in the illustrated embodiment can execute the method provided in any of the above-mentioned method embodiments. Its specific implementation principles, technical features, professional terminology explanations and technical effects are similar and will not be repeated here.

[0338] Figure 7 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 7 As shown, the electronic device 700 may include: at least one processor 701 and a memory 702 . Figure 7 An electronic device is shown using a processor as an example.

[0339] The memory 702 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer operation instructions.

[0340] The memory 702 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0341] The processor 701 is used to execute the computer-executable instructions stored in the memory 702 to implement the methods described in the above method embodiments.

[0342] The processor 701 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0343] Optionally, the memory 702 may be independent or integrated with the processor 701. When the memory 702 is a device independent of the processor 701, the electronic device 700 may further include:

[0344] The bus 703 is used to connect the processor 701 and the memory 702. The bus may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.

[0345] Optionally, in a specific implementation, if the memory 702 and the processor 701 are integrated on a chip, the memory 702 and the processor 701 can communicate through an internal interface.

[0346] The present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the methods in the above-mentioned method embodiments.

[0347] The present application also provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the service construction method in each of the above embodiments is implemented.

[0348] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A service construction method, It is characterized in that include: receiving a service request, wherein the service request includes a service building block identifier; Determine a service building block according to the service request, the service building block comprising: a calling template and at least one building block for loading the called service, the calling template being used to arrange the building blocks and the preset logical order of the called service; Parsing each of the building blocks in the service building block according to the calling template to determine a service calling result; Sending the service call result; Among them, the building block is a logical process unit in the service calling process; the service building block is a collection of multiple business logic units arranged in a preset logical order; the calling template is a fragment of the orchestration structure and parameters of the service building block generated by the template language after arranging a complete service calling process.

2. The service construction method according to claim 1, It is characterized in that The step of parsing each of the service building blocks according to the call template to determine a service call result includes: Parsing each of the building blocks in the service building block according to the calling template to determine the called service in each building block; Determine the calling process of each of the called services according to the calling template; The called service is executed according to the calling process to determine the service calling result.

3. The service construction method according to claim 2, It is characterized in that The calling process includes a preset logical order of the called service and parameters required to be passed for executing the called service, and executing the called service according to the calling process to determine the service calling result includes: The called service is executed according to the preset logical order and the parameters to determine the service calling result.

4. The service construction method according to any one of claims 1 to 3, It is characterized in that The called service is a business logic unit.

5. The service construction method according to claim 2 or 3, It is characterized in that The step of parsing each of the service building blocks according to the calling template to determine the called service in each building block includes: Set the first said building block declared in said calling template as the current building block; Parsing the attribute value of the current building block to determine the parsing result; Determine the calling object of the current building block according to the parsing result; Determine the type of the calling object; If the type is service, then find the corresponding called service from the service registration center; Continue parsing the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

6. The service construction method according to claim 5, It is characterized in that The building block is also used to load a sub-building block, and the sub-building block has the same composition structure as the building block; after determining the type of the calling object, it also includes: If the type is a sub-block, setting the sub-block as the current block; Repeat the steps of: parsing the property value of the current block to determine the type of the calling object, until all the called services in the child blocks are determined, and returning to the parent block to continue parsing, the parent block being the block that loads the child blocks.

7. The service construction method according to claim 6, It is characterized in that The building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block; after determining the type of the calling object, it also includes: If the type is a sub-service building block, determining the building block corresponding to the sub-service building block according to the calling template in the sub-service building block; Set the first block declared in the calling template of the sub-service block as the current block; Repeat the steps of: parsing the attribute value of the current building block to determine the type of the calling object, until all the called services called by the sub-service building block are determined; Execute all called services called by the sub-service building block to determine the calling result of the sub-service building block; The calling result of the sub-service building block is returned to the service building block, and the next building block declared in the calling template is continued to be parsed.

8. The service construction method according to claim 7, It is characterized in that The building block includes a result wrapper, and the result wrapper is used to indicate the data type of the call result returned by the building block to the call template. The executing the called service according to the call process to determine the service call result includes: Obtaining the calling result of the called service by using the result wrapper; The data type of the call result returned by the result wrapper is determined according to the setting parameters for the result wrapper in the call process.

9. The service construction method according to claim 8, It is characterized in that The data types include: result value, result graph and custom result; The result value is the call result of the last sub-unit in the building block, and the sub-unit includes: the called service, the sub-building block and the sub-service building block, and the sub-service building block has the same composition structure as the service building block; The result graph is the calling result of each sub-unit in the building block; The custom result is a service call result indicated by another result wrapper.

10. The service construction method according to claim 9, It is characterized in that The property value of the building block includes a decision maker, and the decision maker is used to indicate whether the subunit of the building block needs to be called. The parsing of the property value of the current building block to determine the parsing result includes: Determining whether to continue parsing the current building block according to the decision maker of the current building block; If the decision result of the decision maker is not to make any decision, then continue parsing; If the judgment result is a custom decision maker, continue parsing the subunit specified by the custom decision maker.

11. The service construction method according to claim 10, It is characterized in that The attribute value of the building block includes a service call execution mode, and the execution mode includes: serial call and parallel call; The serial call means calling all or part of the sub-units in sequence according to the declaration order in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit; The parallel calling means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units; The step of parsing the attribute value of the current building block to determine a parsing result includes: The calling mode of the subunit is determined according to the service calling execution mode of the current building block.

12. The service construction method according to claim 11, It is characterized in that The property value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. The parsing of the property value of the current building block to determine the parsing result includes: If the service type of the current building block is supply type, the current building block does not receive parameters.

13. The service construction method according to claim 12, It is characterized in that The step of parsing the property value of the current building block to determine the parsing result further includes: If the service type of the current building block is not the supply type, then The determining the calling mode of the sub-unit according to the service calling execution mode of the current building block includes: If the service call execution mode is a serial call, the result of the previous call is used as the input parameter of the current call; If the service call execution mode is parallel call, the parameters defined in the context of the building block are used as the input parameters of the current call.

14. The service construction method according to any one of claims 1 to 3, It is characterized in that The method further comprises: Drag and drop graphical identifiers of each service through a user interface to determine the preset logical order of the services; Defining context transfer parameters of the calling template; The calling template is determined according to the service, the preset logical order and the context transfer parameter.

15. The service construction method according to any one of claims 1 to 3, It is characterized in that Before receiving the service request, the method further includes: Use the service registration model to determine the basic business logic unit; The business logic unit is determined as a service and registered in a service registration center.

16. A service construction device, It is characterized in that include: A receiving module, used for receiving a service request, wherein the service request includes a service building block identifier; A processing module, configured to determine a service building block according to the service request, wherein the service building block includes: a calling template and at least one building block for loading a called service, wherein the calling template is used to arrange a preset logical order of the building block and the called service; The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the service calling result; A sending module, used for sending the service call result; Among them, the building block is a logical process unit in the service calling process; the service building block is a collection of multiple business logic units arranged in a preset logical order; the calling template is a fragment of the orchestration structure and parameters of the service building block generated by the template language after arranging a complete service calling process.

17. The service construction device according to claim 16, It is characterized in that The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the service calling result, including: The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the called service in each building block; The processing module is further used to determine the calling process of each called service according to the calling template; The processing module is further used to execute the called service according to the calling process to determine the service calling result.

18. The service construction device according to claim 17, It is characterized in that The calling process includes a preset logical order of the called service and parameters that need to be passed to execute the called service. The processing module is further used to execute the called service according to the calling process to determine the service calling result, including: The processing module is further used to execute the called service according to the preset logical order and the parameters, and determine the service calling result.

19. The service construction device according to any one of claims 16 to 18, It is characterized in that The called service is a business logic unit.

20. The service construction device according to claim 17 or 18, It is characterized in that The processing module is further used to parse each of the building blocks in the service building block according to the calling template to determine the called service in each building block, including: The processing module is further used to set the first building block declared in the calling template as the current building block; The processing module is further used to parse the property value of the current building block to determine the parsing result; determine the calling object of the current building block according to the parsing result; and determine the type of the calling object; The processing module is further configured to search for the corresponding called service from a service registration center if the type is service; The processing module is further used to continue parsing the next building block declared in the calling template until all the building blocks declared in the calling template are parsed.

21. The service construction device according to claim 20, It is characterized in that The building block is also used to load a sub-building block, and the sub-building block has the same composition structure as the building block; the processing module is also used to determine the type of the calling object, and further includes: The processing module is further configured to set the sub-building block as the current building block if the type is a sub-building block; The processing module is further used to repeat the steps of: parsing the attribute value of the current building block to determine the type of the calling object, until all the called services in the child building blocks are determined, and returning to the parent building block to continue parsing, wherein the parent building block is the building block that loads the child building block.

22. The service construction device according to claim 21, It is characterized in that The building block is also used to load a sub-service building block, and the sub-service building block has the same composition structure as the service building block; the processing module is also used to determine the type of the calling object, and further includes: The processing module is further configured to determine the building block corresponding to the sub-service building block according to the calling template in the sub-service building block if the type is a sub-service building block; The processing module is further used to set the first building block declared in the calling template of the sub-service building block as the current building block; The processing module is further used to repeat the steps of: parsing the attribute value of the current building block to determine the type of the calling object, until all the called services called by the sub-service building block are determined; The processing module is further used to execute all called services called by the sub-service building block to determine the calling result of the sub-service building block; The processing module is further configured to return the calling result of the sub-service building block to the service building block, and continue parsing the next building block declared in the calling template.

23. The service construction device according to claim 22, It is characterized in that The building block includes a result wrapper, and the result wrapper is used to indicate the data type of the call result returned by the building block to the call template. The processing module is also used to execute the called service according to the call process to determine the service call result, including: The processing module is further used to obtain the calling result of the called service by using the result wrapper; The processing module is further used to determine the data type of the calling result returned by the result wrapper according to the setting parameters for the result wrapper in the calling process.

24. The service construction device according to claim 23, It is characterized in that The data types include: result value, result graph and custom result; The result value is the call result of the last sub-unit in the building block, and the sub-unit includes: the called service, the sub-building block and the sub-service building block, and the sub-service building block has the same composition structure as the service building block; The result graph is the calling result of each sub-unit in the building block; The custom result is a service call result indicated by another result wrapper.

25. The service construction device according to claim 24, It is characterized in that The property value of the building block includes a decision maker, and the decision maker is used to indicate whether the subunit of the building block needs to be called. The processing module is also used to parse the property value of the current building block to determine the parsing result, including: The processing module is further used to determine whether to continue parsing the current building block according to the decision maker of the current building block; The processing module is further configured to continue parsing if the decision result of the decision maker is not to make any decision; The processing module is further configured to continue parsing the subunit specified by the custom decision maker if the judgment result is a custom decision maker.

26. The service construction device according to claim 25, It is characterized in that The attribute value of the building block includes a service call execution mode, and the execution mode includes: serial call and parallel call; The serial call means calling all or part of the sub-units in sequence according to the declaration order in the building block, and the output of the previous sub-unit is used as the input of the next sub-unit; The parallel calling means calling all or part of the sub-units at the same time and obtaining the calling results of the sub-units; The processing module is further used to parse the attribute value of the current building block to determine the parsing result, including: The processing module is further configured to determine a calling mode of the subunit according to a service calling execution mode of the current building block.

27. The service construction device according to claim 26, It is characterized in that The property value of the building block includes a service type, and the service type is used to indicate whether the building block receives parameters and the return value type of the building block. The processing module is also used to parse the property value of the current building block to determine the parsing result, including: The processing module is further configured to: if the service type of the current building block is a supply type, then the current building block does not receive parameters.

28. The service construction device according to claim 27, It is characterized in that The processing module is further used to parse the attribute value of the current building block to determine the parsing result, and further includes: The processing module is further configured to: if the service type of the current building block is not the supply type, The processing module is further used to determine the calling mode of the sub-unit according to the service calling execution mode of the current building block, including: The processing module is further configured to use the result of the previous call as an input parameter of the current call if the service call execution mode is a serial call; The processing module is further configured to use the parameters defined in the context of the building block as the input parameters of the current call if the service call execution mode is a parallel call.

29. The service construction device according to any one of claims 16 to 18, It is characterized in that Also includes: The receiving module is further used to obtain the graphical identifier of each service dragged by the user interface, The processing module is further used to determine the preset logical order of the services through the graphical identification; The processing module is further used to define context transfer parameters of the calling template; The processing module is further used to determine the calling template according to the service, the preset logical order and the context transfer parameter.

30. The service construction device according to any one of claims 16 to 18, It is characterized in that Before the receiving module is used to receive the service request, it also includes: The processing module is further used to determine the basic business logic unit using the service registration model; The processing module is further used to determine the business logic unit as a service and register it in a service registration center.

31. An electronic device, It is characterized in that include: processor; as well as, A memory, configured to store executable instructions of the processor; The processor is configured to execute the service construction method according to any one of claims 1 to 14 by executing the executable instructions.

32. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the service construction method according to any one of claims 1 to 14 is implemented.

33. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the service construction method described in any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Business execution method, device and equipment and storage medium

    CN110780870A