Dubbo interface calling method and device, computer equipment and storage medium
By automatically obtaining and configuring the Dubbo interface, and using preset gateways to determine and execute business logic, the security threats faced by enterprises in data interaction are solved, and data interaction efficiency and security are improved.
Patent Information
- Application Number
- CN202411538872.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-07
AI Technical Summary
Enterprises face data security threats when interacting with data. Traditional data interaction methods lack sufficient security measures, resulting in data being easily subject to security threats such as unauthorized access, data leakage, and tampering during transmission and storage.
By automatically obtaining the interface configuration information of the target Dubbo interface, and automatically configure and publishing the target Dubbo interface according to the interface configuration information, the system automatically sends interface call requests to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information.
Ensure the correctness of business logic and the accuracy of execution, and then improve the efficiency of data interaction and sharing through publishing and calling Dubbo interfaces, and enhance the security of data.
Smart Images

Figure CN119576599A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of R&D management technology, and in particular to a method, device, computer equipment and storage medium for calling a Dubbo interface. Background Art
[0002] With the rapid development of Internet technology, data interaction and sharing between enterprises are becoming more and more frequent. In this context, Dubbo interface is the interface for communication between the server that provides the service and the client that calls the service. As an efficient remote service calling framework, it is widely used in service governance and data interaction within and between enterprises. Dubbo interface enables services between different systems to be integrated and communicated quickly and flexibly by providing high-performance remote calling capabilities.
[0003] However, with the increase in data interaction, enterprises are facing huge challenges in data security. Traditional data interaction methods often lack sufficient security measures, which makes data vulnerable to security threats such as unauthorized access, data leakage, and tampering during transmission and storage. In addition, when interacting with data, enterprises also need to consider the confidentiality, integrity, and availability of data to ensure data security and business continuity. In order to solve these problems, enterprises usually need to take a series of complex security measures, such as data encryption, permission control, and access auditing. Although these measures have improved data security to a certain extent, they have also increased the management burden and operating costs of enterprises. At the same time, due to the lack of effective monitoring and alarm mechanisms, enterprises often find it difficult to detect and respond to security incidents in a timely manner, resulting in the accumulation and spread of security risks. Therefore, how to improve the efficiency of data interaction and sharing by publishing and calling Dubbo interfaces has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a Dubbo interface calling method, apparatus, computer equipment and storage medium to improve the efficiency of data interaction and sharing.
[0005] In a first aspect, the present application provides a method for calling a Dubbo interface, the method comprising:
[0006] Obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface according to the interface configuration information, and publishing the target Dubbo interface;
[0007] Send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information;
[0008] According to the feedback information, the execution code of the target Dubbo interface is determined, and the target Dubbo interface is called through the execution code and the interface configuration information.
[0009] In a second aspect, the present application further provides a device for calling a Dubbo interface, the device comprising:
[0010] A target Dubbo interface configuration module, used to obtain interface configuration information of a target Dubbo interface, configure the target Dubbo interface according to the interface configuration information, and publish the target Dubbo interface;
[0011] A feedback information generating module, used to send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information;
[0012] The target Dubbo interface calling module is used to determine the execution code of the target Dubbo interface according to the feedback information, and call the target Dubbo interface through the execution code and the interface configuration information.
[0013] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the Dubbo interface calling method as described above when executing the computer program.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the calling method of the Dubbo interface as described above.
[0015] The present application discloses a method, device, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes obtaining the interface configuration information of the target Dubbo interface, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information; sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic, and generating feedback information; determining the execution code of the target Dubbo interface according to the feedback information, and calling the target Dubbo interface through the execution code and the interface configuration information. In the above manner, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments 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 any creative work.
[0017] Figure 1 is a schematic flow chart of a method for calling a Dubbo interface provided in the first embodiment of the present application;
[0018] Figure 2 is a schematic flow chart of a method for calling a Dubbo interface provided in the second embodiment of the present application;
[0019] Figure 3 is a schematic flow chart of a method for calling a Dubbo interface provided in the third embodiment of the present application;
[0020] Figure 4 A schematic block diagram of a Dubbo interface calling device provided in an embodiment of the present application;
[0021] Figure 5 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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 are within the scope of protection of this application.
[0023] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0024] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0025] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0026] The embodiments of the present application provide a method, device, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface can be applied to a server, and the interface configuration information of the target Dubbo interface is automatically obtained, and the target Dubbo interface is automatically configured and published according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface. The server can be an independent server or a server cluster.
[0027] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0028] See also Figure 1 , Figure 1This is a schematic flow chart of a Dubbo interface calling method provided in the first embodiment of the present application. The Dubbo interface calling method can be applied to a server, and is used to automatically obtain the interface configuration information of the target Dubbo interface, and automatically configure and publish the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0029] like Figure 1 As shown, the calling method of the Dubbo interface specifically includes steps S10 to S30.
[0030] Step S10: Obtain interface configuration information of the target Dubbo interface, configure the target Dubbo interface according to the interface configuration information, and publish the target Dubbo interface;
[0031] Specifically, access or connect to the database or configuration center that stores Dubbo interface configuration information, query and retrieve the interface configuration information of the target Dubbo interface, the interface configuration information includes interface name, version, protocol, registration center address, service provider address, method signature, etc.
[0032] Parse the obtained interface configuration information and configure the relevant parameters of the Dubbo interface according to the configuration information, such as the interface name, version, protocol used, and detailed information of the configuration service provider, such as IP address, port number, etc.
[0033] Step S20: sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic, and generating feedback information;
[0034] Specifically, register the configured Dubbo interface to the service registry to make it visible to consumers. Ensure that the service provider can listen to the corresponding port and is ready to receive requests from service consumers.
[0035] Sending a call request to the target Dubbo interface through the gateway may involve building a request payload, setting necessary header information, etc. After receiving the call request, the Dubbo interface determines the corresponding business logic based on the request content and executes business logic processing, including database operations, calculations, external service calls, etc.
[0036] After the business logic is executed, the corresponding feedback information or results are generated, and the feedback information is encapsulated into a response body and is ready to be returned to the caller.
[0037] Step S30: Determine the execution code of the target Dubbo interface according to the feedback information, and call the target Dubbo interface through the execution code and the interface configuration information.
[0038] In one embodiment, the feedback information is analyzed to determine whether further processing is required or whether a predetermined condition is met, and an execution code is generated or updated to process the feedback information. The updated or generated execution code is used in combination with the interface configuration information to call the target Dubbo interface again.
[0039] The present embodiment discloses a method, device, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information; sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic, and generating feedback information; determining the execution code of the target Dubbo interface according to the feedback information, and calling the target Dubbo interface through the execution code and the interface configuration information. In the above manner, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0040] based on Figure 1 In the embodiment shown, in this embodiment, step S10 includes:
[0041] Accessing a preset configuration information database, and retrieving interface attributes and interface parameters of the target Dubbo interface from the preset configuration information database;
[0042] Specifically, determine the type of configuration information database and configure the database connection parameters, including database address, port, database name, user name and password, and use the appropriate database connection library or framework to establish a database connection in the application.
[0043] Construct an SQL query statement or use the database query builder based on the identification information of the target Dubbo interface (such as interface name, version number, etc.) to ensure that the query statement can retrieve all relevant properties and parameters of the target interface, such as interface address, port, method name, parameter type, return type, etc.
[0044] The interface attributes and the interface parameters are parsed to obtain the interface configuration information.
[0045] In one embodiment, the retrieved data is converted into a readable format, such as JSON, XML, or key-value pairs, and parsed to obtain interface configuration information, including but not limited to interface name and version, service provider address and port, interface method name and parameter list, method return type, any specific serialization or deserialization requirements, security and permission configuration, such as token verification, encryption requirements, etc.
[0046] Check whether the parsed interface configuration information is complete and conforms to the expected format, and verify key information, such as whether the service address and port are reachable, and whether the method parameters are correct.
[0047] In a more preferred embodiment, step S10 includes:
[0048] Parse the interface configuration information to determine the service address information, port information, communication protocol information and parameter information of the target Dubbo interface;
[0049] Configure the target Dubbo interface according to the service address information, the port information, the communication protocol information and the parameter information;
[0050] The configured target Dubbo interface is published to a preset Dubbo registration server, and the target Dubbo interface is published on the public end through the Dubbo registration server.
[0051] In one embodiment, the configuration information of the target Dubbo interface is read from a database or configuration file, and the service address information is extracted from the configuration data, which usually includes the IP address and host name. The port information is extracted, which is the network port that the Dubbo service listens on, and the communication protocol used by the Dubbo interface is determined, such as the Dubbo protocol, HTTP protocol, etc. The parameter information of the interface is extracted, including the parameter name, type, order, etc.
[0052] Use the preset registration server address and port to establish a connection, register the configured Dubbo service instance with the registration server, provide the name of the service, which usually corresponds to the service name in the interface configuration information. If the interface has version management, specify the version of the service, and check whether the service is successfully registered with the registration server, which is usually done by querying the registration information of the registration server.
[0053] Subscribe to the service on the client that needs to call the Dubbo interface. The client discovers available service providers through the registration server and configures the load balancing strategy to decide how to distribute requests among multiple service providers. The client calls the Dubbo interface according to the service address, port and communication protocol.
[0054] The present embodiment discloses a method, apparatus, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes accessing a preset configuration information database, retrieving the interface attributes and interface parameters of the target Dubbo interface in the preset configuration information database; parsing the interface attributes and the interface parameters, obtaining the interface configuration information, parsing the interface configuration information, and determining the service address information, port information, communication protocol information and parameter information of the target Dubbo interface; configuring the target Dubbo interface according to the service address information, the port information, the communication protocol information and the parameter information; publishing the configured target Dubbo interface to a preset Dubbo registration server, and publishing the target Dubbo interface on the public end through the Dubbo registration server; sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic and generating feedback information; determining the execution code of the target Dubbo interface according to the feedback information, and calling the target Dubbo interface through the execution code and the interface configuration information. Through the above method, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0055] See also Figure 2 , Figure 2This is a schematic flow chart of a Dubbo interface calling method provided in the second embodiment of the present application. The Dubbo interface calling method can be applied to the server, and is used to automatically obtain the interface configuration information of the target Dubbo interface, and automatically configure and publish the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0056] based on Figure 1 The embodiment shown, this embodiment Figure 2 As shown, step S20 includes steps S201 to S203.
[0057] Step S201, verifying the built-in token Token of the interface call request;
[0058] Specifically, extract the built-in Token from the header or parameter of the interface call request, and ensure that the system has been configured with a Token verification service that can verify the validity of the Token. Send the extracted Token to the Token verification service for verification, wait for the response from the Token verification service, and check whether the Token is valid. If the Token is invalid or the verification fails, reject the interface call request and return the corresponding error message.
[0059] Step S202: When the built-in Token passes verification, the interface call request is mapped to a Dubbo request parameter of the Dubbo protocol;
[0060] Specifically, analyze the content of the interface call request, extract necessary information such as method name, parameter value, etc., ensure that the rules for mapping the interface call request to Dubbo request parameters are configured, and convert the interface call request to the request parameters of the Dubbo protocol according to the mapping rules. Map the method name of the interface call request to the corresponding method name in the Dubbo service, and map the parameter type and value of the interface call request to the corresponding parameter type and value in the Dubbo service. Use the mapped parameters to construct the request object of the Dubbo protocol.
[0061] Step S203: Determine the Dubbo service instance based on the Dubbo request parameters, and determine the business logic according to the Dubbo service instance.
[0062] In one embodiment, the registration information of the target Dubbo service is queried from the Dubbo registration center, an available service instance is selected from the registered service instances according to the load balancing strategy, and a reference to the selected service instance is obtained for subsequent calls.
[0063] According to the methods and parameters defined in the Dubbo service, they are mapped to specific business logic, and the corresponding service methods are called through the Dubbo service reference to execute the business logic defined in the service method, such as database operations, calculations, external service calls, etc. After the business logic is executed, the corresponding feedback information or results are generated.
[0064] The present embodiment discloses a method, apparatus, computer device and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information; verifying a built-in token Token of the interface call request; if the built-in Token passes the verification, mapping the interface call request to a Dubbo request parameter of the Dubbo protocol; determining a Dubbo service instance based on the Dubbo request parameter, determining the business logic according to the Dubbo service instance, executing the business logic and generating feedback information; determining an execution code of the target Dubbo interface according to the feedback information, and calling the target Dubbo interface through the execution code and the interface configuration information. Through the above method, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0065] based on Figure 2 In the embodiment shown, in this embodiment, step S20 further includes:
[0066] Execute the business logic and record the external response log;
[0067] The feedback information is generated according to the external response log.
[0068] In one embodiment, any exception is captured during the interface call request processing, and detailed information of the exception is recorded, including the exception type, occurrence time, affected requests, etc., and a corresponding error response is returned to the caller according to the exception type.
[0069] See also Figure 3 , Figure 3 This is a schematic flow chart of a method for calling a Dubbo interface provided in the third embodiment of the present application. The method for calling the Dubbo interface can be applied to a server, and is used to automatically obtain the interface configuration information of the target Dubbo interface, and automatically configure and publish the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0070] based on Figure 1 The embodiment shown, this embodiment Figure 3 As shown, step S30 includes steps S30 to S303.
[0071] Step S301: extracting interface call result information and exception information from the feedback information when the feedback information is verified to be valid;
[0072] Specifically, get feedback information from the Dubbo service call, verify whether the feedback information contains all necessary data, such as call results, exception information, etc., confirm that the feedback information has not been tampered with and is received within the expected time.
[0073] Step S302: Determine a code template according to the interface call result information;
[0074] Specifically, analyze the structure of the feedback information, extract the result data of the interface call and any exception information, record the result information of the interface call for subsequent processing, and if there is exception information, record it and determine the type of exception and specific error message.
[0075] Select an appropriate code template based on the interface call result information. The code template is a predefined code framework used to quickly generate execution code. Configure the parameters in the code template based on the result information, such as variable name, method name, logical structure, etc.
[0076] Step S303: Generate the execution code according to the exception information and the code template.
[0077] In one embodiment, if there is exception information, it is applied to the code template to handle the exception. This may include exception capture, error logging, or backup logic. The interface call result information is used to fill in the relevant parts of the code template, generate specific execution code, and optimize the generated code to ensure the readability and performance of the code.
[0078] The present embodiment discloses a method, apparatus, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information; sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic, and generating feedback information; extracting interface call result information and exception information from the feedback information when verifying that the feedback information is valid; determining a code template according to the interface call result information; generating the execution code according to the exception information and the code template, and calling the target Dubbo interface through the execution code and the interface configuration information. Through the above method, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0079] based on Figure 3 In the embodiment shown, in this embodiment, step S30 further includes:
[0080] According to the interface configuration information and the remote calling mechanism of the preset Dubbo framework, the interface calling request is sent to the target Dubbo interface;
[0081] Verify the interface call request through the target Dubbo interface;
[0082] In the case where the interface call request passes the verification, the target Dubbo interface is called according to the interface call request.
[0083] In one embodiment, a request object is created according to the interface configuration information, including necessary header information and request parameters, and the parameters in the request object are set according to the interface definition, ensuring that the parameter type and order are correct. Ensure that the Dubbo client has been configured, including the registration center address, service interface class, service version, etc., and obtain a reference to the target Dubbo service through the Dubbo client.
[0084] Use Dubbo service reference, according to the configured remote call mechanism (such as synchronous call, asynchronous call, etc.), send interface call request to the target Dubbo service, and capture and handle possible network exceptions such as connection timeout, disconnection, etc. during the request sending process.
[0085] The target Dubbo interface receives the interface call request and verifies whether the parameters in the request meet expectations, including parameter type, quantity, range, etc., based on the interface definition. It also verifies whether the user or service that initiates the request has the authority to call the interface. It further verifies the request based on business rules, such as the legality of the request, business logic constraints, etc.
[0086] The present embodiment discloses a method, apparatus, computer equipment and storage medium for calling a Dubbo interface. The method for calling the Dubbo interface includes obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information; sending an interface call request to the target Dubbo interface through a preset gateway, determining the business logic of the target Dubbo interface, executing the business logic and generating feedback information; extracting interface call result information and exception information in the feedback information when verifying that the feedback information is valid; determining a code template according to the interface call result information; generating the execution code according to the exception information and the code template; sending the interface call request to the target Dubbo interface according to the interface configuration information and the remote call mechanism of the preset Dubbo framework; verifying the interface call request through the target Dubbo interface; and calling the target Dubbo interface according to the interface call request when the interface call request passes the verification. Through the above method, the present application automatically obtains the interface configuration information of the target Dubbo interface, and automatically configures and publishes the target Dubbo interface according to the interface configuration information. The system automatically sends an interface call request to the target Dubbo interface through a preset gateway, determines the business logic of the target Dubbo interface, and executes the business logic to generate feedback information, thereby ensuring the correctness of the business logic and the accuracy of execution, and then improving the efficiency of data interaction and sharing by publishing and calling the Dubbo interface.
[0087] See also Figure 4 , Figure 4 The embodiment of the present application provides a schematic block diagram of a device for calling a Dubbo interface, wherein the device for calling a Dubbo interface is used to execute the aforementioned method for calling a Dubbo interface, wherein the device for calling a Dubbo interface can be configured on a server.
[0088] like Figure 4As shown, the Dubbo interface calling device 400 includes:
[0089] A target Dubbo interface configuration module 410 is used to obtain interface configuration information of a target Dubbo interface, configure the target Dubbo interface according to the interface configuration information, and publish the target Dubbo interface;
[0090] A feedback information generating module 420 is used to send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information;
[0091] The target Dubbo interface calling module 430 is used to determine the execution code of the target Dubbo interface according to the feedback information, and call the target Dubbo interface through the execution code and the interface configuration information.
[0092] Furthermore, the target Dubbo interface configuration module 410 includes:
[0093] A Dubbo interface retrieval unit, used to access a preset configuration information database, and retrieve interface attributes and interface parameters of the target Dubbo interface from the preset configuration information database;
[0094] The interface configuration information acquisition unit is used to parse the interface attributes and the interface parameters to acquire the interface configuration information.
[0095] Furthermore, the target Dubbo interface configuration module 410 further includes:
[0096] An interface configuration information parsing unit, used to parse the interface configuration information and determine the service address information, port information, communication protocol information and parameter information of the target Dubbo interface;
[0097] A target Dubbo interface configuration unit, configured to configure the target Dubbo interface according to the service address information, the port information, the communication protocol information and the parameter information;
[0098] The target Dubbo interface publishing unit is used to publish the configured target Dubbo interface to a preset Dubbo registration server, and publish the target Dubbo interface on the public end through the Dubbo registration server.
[0099] Furthermore, the feedback information generating module 420 includes:
[0100] A built-in Token verification unit, used to verify the built-in Token of the interface call request;
[0101] A request parameter mapping unit, used for mapping the interface call request into a Dubbo request parameter of the Dubbo protocol when the built-in Token passes the verification;
[0102] The business logic determination unit is used to determine the Dubbo service instance based on the Dubbo request parameters, and determine the business logic according to the Dubbo service instance.
[0103] Furthermore, the feedback information generating module 420 further includes:
[0104] An external response log recording unit, used to execute the business logic and record the external response log;
[0105] A feedback information generating unit is used to generate the feedback information according to the external response log.
[0106] Furthermore, the target Dubbo interface calling module 430 includes:
[0107] An information extraction unit, configured to extract interface call result information and exception information from the feedback information when verifying that the feedback information is valid;
[0108] A code template determining unit, used to determine a code template according to the interface call result information;
[0109] An execution code generating unit is used to generate the execution code according to the exception information and the code template.
[0110] Furthermore, the target Dubbo interface calling module 430 includes:
[0111] An interface call request sending unit, used to send the interface call request to the target Dubbo interface according to the interface configuration information and the remote call mechanism of the preset Dubbo framework;
[0112] An interface call request verification unit, used to verify the interface call request through the target Dubbo interface;
[0113] The target Dubbo interface calling unit is used to call the target Dubbo interface according to the interface calling request when the interface calling request passes the verification.
[0114] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0115] The above-mentioned device can be implemented in the form of a computer program. Figure 5 Runs on the computer device shown.
[0116] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0117] See also Figure 5 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0118] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any Dubbo interface calling method.
[0119] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0120] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any calling method of the Dubbo interface.
[0121] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0122] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0123] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0124] Obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface according to the interface configuration information, and publishing the target Dubbo interface;
[0125] Send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information;
[0126] According to the feedback information, the execution code of the target Dubbo interface is determined, and the target Dubbo interface is called through the execution code and the interface configuration information.
[0127] In one embodiment, according to the interface configuration information of the target Dubbo interface being obtained, it is used to implement:
[0128] Accessing a preset configuration information database, and retrieving interface attributes and interface parameters of the target Dubbo interface from the preset configuration information database;
[0129] The interface attributes and the interface parameters are parsed to obtain the interface configuration information.
[0130] In one embodiment, configuring the target Dubbo interface and publishing the target Dubbo interface according to the interface configuration information is used to achieve:
[0131] Parse the interface configuration information to determine the service address information, port information, communication protocol information and parameter information of the target Dubbo interface;
[0132] Configure the target Dubbo interface according to the service address information, the port information, the communication protocol information and the parameter information;
[0133] The configured target Dubbo interface is published to a preset Dubbo registration server, and the target Dubbo interface is published on the public end through the Dubbo registration server.
[0134] In one embodiment, an interface call request is sent to the target Dubbo interface through a preset gateway to determine the business logic of the target Dubbo interface, so as to achieve:
[0135] A built-in token Token for verifying the interface call request;
[0136] When the built-in Token passes the verification, the interface call request is mapped to the Dubbo request parameter of the Dubbo protocol;
[0137] Based on the Dubbo request parameters, a Dubbo service instance is determined, and the business logic is determined according to the Dubbo service instance.
[0138] In one embodiment, the business logic is executed to generate feedback information for implementing:
[0139] Execute the business logic and record the external response log;
[0140] The feedback information is generated according to the external response log.
[0141] In one embodiment, according to the feedback information, the execution code of the target Dubbo interface is determined to implement:
[0142] When verifying that the feedback information is valid, extracting the interface call result information and the exception information in the feedback information;
[0143] Determine a code template according to the interface call result information;
[0144] The execution code is generated according to the exception information and the code template.
[0145] In one embodiment, the target Dubbo interface is called through the execution code and the interface configuration information to implement:
[0146] According to the interface configuration information and the remote calling mechanism of the preset Dubbo framework, the interface calling request is sent to the target Dubbo interface;
[0147] Verify the interface call request through the target Dubbo interface;
[0148] In the case where the interface call request passes the verification, the target Dubbo interface is called according to the interface call request.
[0149] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any Dubbo interface calling method provided in the embodiment of the present application.
[0150] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Medi a Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc., equipped on the computer device.
[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for calling a Dubbo interface, characterized in that: include: Obtaining interface configuration information of a target Dubbo interface, configuring the target Dubbo interface according to the interface configuration information, and publishing the target Dubbo interface; Send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information; According to the feedback information, the execution code of the target Dubbo interface is determined, and the target Dubbo interface is called through the execution code and the interface configuration information.
2. The method for calling the Dubbo interface according to claim 1, characterized in that: The obtaining the interface configuration information of the target Dubbo interface according to the method includes: Accessing a preset configuration information database, and retrieving interface attributes and interface parameters of the target Dubbo interface from the preset configuration information database; The interface attributes and the interface parameters are parsed to obtain the interface configuration information.
3. The method for calling the Dubbo interface according to claim 2, characterized in that: The configuring the target Dubbo interface according to the interface configuration information and publishing the target Dubbo interface further includes: Parse the interface configuration information to determine the service address information, port information, communication protocol information and parameter information of the target Dubbo interface; Configure the target Dubbo interface according to the service address information, the port information, the communication protocol information and the parameter information; The configured target Dubbo interface is published to a preset Dubbo registration server, and the target Dubbo interface is published on the public end through the Dubbo registration server.
4. The method for calling the Dubbo interface according to claim 1, characterized in that: The sending of the interface call request to the target Dubbo interface through the preset gateway to determine the business logic of the target Dubbo interface includes: A built-in token Token for verifying the interface call request; When the built-in Token passes the verification, the interface call request is mapped to the Dubbo request parameter of the Dubbo protocol; Based on the Dubbo request parameters, a Dubbo service instance is determined, and the business logic is determined according to the Dubbo service instance.
5. The method for calling the Dubbo interface according to claim 4, characterized in that: The executing the business logic and generating feedback information includes: Execute the business logic and record the external response log; The feedback information is generated according to the external response log.
6. The method for calling the Dubbo interface according to claim 1, characterized in that: The step of determining the execution code of the target Dubbo interface according to the feedback information includes: When verifying that the feedback information is valid, extracting the interface call result information and the exception information in the feedback information; Determine a code template according to the interface call result information; The execution code is generated according to the exception information and the code template.
7. The method for calling the Dubbo interface according to claim 6, characterized in that: The calling the target Dubbo interface through the execution code and the interface configuration information includes: According to the interface configuration information and the remote calling mechanism of the preset Dubbo framework, the interface calling request is sent to the target Dubbo interface; Verify the interface call request through the target Dubbo interface; In the case where the interface call request passes the verification, the target Dubbo interface is called according to the interface call request.
8. A device for calling a Dubbo interface, characterized in that: include: A target Dubbo interface configuration module, used to obtain interface configuration information of a target Dubbo interface, configure the target Dubbo interface according to the interface configuration information, and publish the target Dubbo interface; A feedback information generating module, used to send an interface call request to the target Dubbo interface through a preset gateway, determine the business logic of the target Dubbo interface, execute the business logic, and generate feedback information; The target Dubbo interface calling module is used to determine the execution code of the target Dubbo interface according to the feedback information, and call the target Dubbo interface through the execution code and the interface configuration information.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the calling method of the Dubbo interface according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the calling method of the Dubbo interface according to any one of claims 1 to 7.
