Method and equipment for supporting integration of single-body application and micro-service application

By building a generic interface and adapter mechanism, the incompatibility between monolithic applications and microservice applications in terms of interface design and communication methods is resolved, enabling seamless integration and switching between the two and optimizing interaction efficiency.

CN120956809APending Publication Date: 2025-11-14THREE GORGES HI TECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511003131.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

The incompatibility between monolithic applications and microservice applications in terms of interface design and communication methods makes seamless integration and switching difficult.

Method used

A generic interface is built to provide a unified abstract service description. The target implementation method is determined based on the configuration information. Client requests are received through the adapter and mapped to the corresponding implementation class. The client requests are executed to access data storage or remote services.

Benefits of technology

It enables seamless integration and switching between monolithic applications and microservice applications, solves compatibility issues in interface design and communication methods, and optimizes interaction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956809A_ABST
    Figure CN120956809A_ABST
Patent Text Reader

Abstract

A method, apparatus and device for supporting integration of a single application and a micro-service application, and a computer readable storage medium, the method comprising: constructing a universal interface for providing a unified abstract service description to support interaction of a single application architecture and a micro-service application architecture; a target implementation mode is determined according to the configuration information, and the target implementation mode comprises local implementation and remote implementation; a client request is received through an adapter, and the adapter maps the client request to a corresponding implementation class according to the target implementation mode; the execution process accesses the corresponding data storage or remote service according to the target implementation mode, so that the technical problem that a single application and a micro-service application are difficult to seamlessly integrate and switch due to the fact that the single application and the micro-service application use different interface designs and communication modes in related technologies is solved; and integration and switching between the single application architecture and the micro-service application architecture are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and specifically to a method, apparatus, device, and computer-readable storage medium that supports the integration of monolithic applications and microservice applications. Background Technology

[0002] With the advancement of the digital wave, microservice architecture has emerged. Microservice architecture breaks down massive monolithic applications into a series of small, autonomous services, each focusing on specific business capabilities and achieving cross-service interaction through lightweight communication protocols (such as HTTP / REST, gRPC, etc.). However, during the migration from monolithic applications to microservice architecture, and during the long-term transition period where the two architectures coexist, interface incompatibility issues have gradually become prominent, directly leading to difficulties in achieving seamless integration and smooth switching between monolithic and microservice applications. Summary of the Invention

[0003] This application provides a method, apparatus, device, and computer-readable storage medium that supports the integration of monolithic applications and microservice applications, which can solve the technical problem in the prior art that monolithic applications and microservice applications use different interface designs and communication methods, making it difficult to seamlessly integrate and switch between the two.

[0004] In a first aspect, embodiments of this application provide a method for supporting the integration of monolithic applications and microservice applications, characterized in that it includes: Construct a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture; The target implementation method is determined based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; Client requests are received via an adapter, wherein the adapter maps the client requests to the corresponding implementation class according to the target implementation method; The client request is executed, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

[0005] In conjunction with the first aspect, in one implementation method, determining the target implementation method based on configuration information includes: The configuration information is obtained from the configuration center, and the configuration information includes the architecture mode identifier and implementation method parameters; Based on the architecture pattern identifier, determine whether the current application architecture is a monolithic application or a microservice application; If it is determined to be a monolithic application, then the target implementation method will be determined to be a local implementation; If it is determined to be a microservice application, then the target implementation method is determined to be remote implementation; The specific execution path of the local implementation or the remote implementation is further determined based on the implementation method parameters, wherein the execution path is used to guide the mapping operation of the adapter.

[0006] In conjunction with the first aspect, in one implementation, receiving client requests via an adapter includes: Receive the client request and parse its request format and content; According to the target implementation method, the corresponding interface requirements are obtained, wherein the interface requirements are used to adapt the calling rules of the local implementation or the remote implementation; Adjust the parameters of the client request to match the interface requirements; The adjusted client request is forwarded to the corresponding implementation class. Log information of the mapping process is recorded, and the log information is used for subsequent request tracing and error troubleshooting.

[0007] In conjunction with the first aspect, in one implementation, executing the client request includes: Determine whether the target implementation method is local or remote; If implemented locally, the required data is obtained by directly accessing the data storage, which is used to store relevant data for the monolithic application. If implemented remotely, the address information of the target remote service is obtained through the service registry. Establish a communication connection with the target remote service based on the address information; The client requests are sent and the response data of the target remote service is received through the communication connection.

[0008] In conjunction with the first aspect, in one implementation, the construction of the general interface includes: Determine the service scope of the general interface, which covers the core functions of monolithic applications and microservice applications; Edit the input and output parameters of the general interface, wherein the input and output parameters are used to unify the data interaction format under monolithic architecture and microservice application architecture; Establish a mapping relationship between the general interface and the local and remote implementations; Verify the compatibility of the general interface under the monolithic architecture and the microservice application architecture. The compatibility verification is completed by simulating client requests. Adjust the definition of the general interface based on the verification results to optimize interaction efficiency.

[0009] In conjunction with the first aspect, in one implementation, the adapter maps the client request to the corresponding implementation class according to the target implementation method, including: Parse the service identifier in the client request, which indicates the specific service type requested; The system queries a preset mapping rule based on the service identifier and the target implementation method. The mapping rule is used to determine the corresponding implementation class. If the target implementation method is remote implementation, then the calling address of the remote implementation is dynamically obtained through the service registry center; The invocation method of the client request is adjusted according to the mapping rules and the invocation address; The adjusted client request is forwarded to the determined implementation class to complete the service call.

[0010] In conjunction with the first aspect, in one implementation, accessing the corresponding data storage or remote service according to the target implementation method includes: Determine the specific type of the target implementation method, where the specific type includes local implementation and remote implementation; If implemented locally, the target data is extracted from the data storage according to the content requested by the client; If it is a remote implementation, a remote call request is constructed based on the content requested by the client; S74. Interact with the remote service through the remote call request to obtain the response result of the remote service; The target data or the response result is formatted to adapt to the return of the client request.

[0011] Secondly, embodiments of this application provide an apparatus for supporting the integration of monolithic applications and microservice applications, characterized in that the apparatus for supporting the integration of monolithic applications and microservice applications includes: A building module is used to build a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture; The determination module is used to determine the target implementation method based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; A receiving module is used to receive client requests through an adapter, wherein the adapter maps the client requests to the corresponding implementation classes according to the target implementation method; An execution module is used to execute the client request, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

[0012] Thirdly, embodiments of this application provide a device that supports the integration of monolithic applications and microservice applications. The device includes a processor, a memory, and a program stored in the memory and executable by the processor that supports the integration of monolithic applications and microservice applications. When the program that supports the integration of monolithic applications and microservice applications is executed by the processor, it implements the steps of the method for supporting the integration of monolithic applications and microservice applications as described above.

[0013] Fourthly, embodiments of this application provide a computer-readable storage medium storing a program that supports the integration of monolithic applications and microservice applications. When the program supporting the integration of monolithic applications and microservice applications is executed by a processor, it implements the steps of the method for supporting the integration of monolithic applications and microservice applications as described above.

[0014] The beneficial effects of the technical solutions provided in this application include: By constructing a generic interface, which provides a unified abstract service description to support interaction between monolithic application architectures and microservice application architectures; determining the target implementation method based on configuration information, wherein the target implementation method includes local implementation and remote implementation; receiving client requests through an adapter, wherein the adapter maps the client request to the corresponding implementation class according to the target implementation method; and executing the client request, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method, this solves the technical problem in related technologies where monolithic applications and microservice applications use different interface designs and communication methods, making it difficult to seamlessly integrate and switch between them, thus achieving integration and switching between monolithic application architectures and microservice application architectures. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the first embodiment of the method for supporting the integration of monolithic applications and microservice applications according to this application; Figure 2 This is a schematic diagram of the functional modules of an embodiment of the apparatus supporting the integration of monolithic applications and microservice applications according to this application; Figure 3 This is a schematic diagram of the hardware structure of a device that supports the integration of monolithic applications and microservice applications in the embodiments of this application. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0017] First, some of the technical terms used in this application will be explained to help those skilled in the art understand this application.

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0019] In a first aspect, embodiments of this application provide a method for supporting the integration of monolithic applications and microservice applications.

[0020] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the method for supporting the integration of monolithic applications and microservice applications according to this application. Figure 1 As shown, the methods supporting the integration of monolithic applications and microservice applications include: Step S10: Construct a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture; Step S20: Determine the target implementation method based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; Step S30: Receive client requests through an adapter, wherein the adapter maps the client requests to the corresponding implementation class according to the target implementation method; Step S40: Execute the client request, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

[0021] As an example, the service scope of the general interface is defined, covering the core functions of both monolithic and microservice applications; the input and output parameters of the general interface are edited, wherein the input and output parameters are used to unify the data interaction format under monolithic and microservice application architectures; a mapping relationship is established between the general interface and the local and remote implementations; the compatibility of the general interface under the monolithic and microservice application architectures is verified, and the compatibility verification is completed by simulating client requests; the definition of the general interface is adjusted according to the verification results to optimize the interaction efficiency.

[0022] The configuration information is obtained from the configuration center. The configuration information includes the architecture mode identifier and the implementation method parameter. Based on the architecture mode identifier, it is determined whether the current application architecture is a monolithic application or a microservice application. If it is a monolithic application, the target implementation method is determined to be a local implementation. If it is a microservice application, the target implementation method is determined to be a remote implementation. Based on the implementation method parameter, the specific execution path of the local or remote implementation is further determined. The execution path is used to guide the mapping operation of the adapter.

[0023] Receive client requests and parse their request format and content; obtain the corresponding interface requirements according to the target implementation method, wherein the interface requirements are used to adapt the calling rules of local or remote implementation; adjust the parameters of the client request to match the interface requirements; forward the adjusted client request to the corresponding implementation class; record the mapping process log information, which is used for subsequent request tracing and error troubleshooting.

[0024] Determine whether the target implementation is local or remote. If it is local, directly access the data storage to obtain the required data. The data storage is used to store relevant data for the monolithic application. If it is remote, obtain the address information of the target remote service through the service registry. Establish a communication connection with the target remote service based on the address information. Send client requests through the communication connection and receive response data from the target remote service.

[0025] Determine the specific type of the target implementation method, which includes local implementation and remote implementation; if it is a local implementation, extract the target data from the data storage according to the content requested by the client; If implemented remotely, a remote call request is constructed based on the content requested by the client; the remote call request is used to interact with the remote service to obtain the response result of the remote service; the target data or response result is formatted to adapt to the return of the client request.

[0026] For example, define a generic UserService Interface: First, build a generic UserService interface that does not depend on a specific implementation or architecture and can be reused in monolithic and microservice architectures. / / Java example (similar concepts in other languages) public interface UserService { User getUserById(Long userId); void createUser(User user); / / ... other user-related operations}.

[0027] The remote implementation includes a remote implementation class. Creating the remote implementation class (RemoteUserService Class): Create a RemoteUserService class that implements the UserService interface. This class will be responsible for calling the remote user service via the RESTful API.

[0028] / / Java example (using RestTemplate; similar concepts and libraries exist in other languages) public class RemoteUserService implements UserService { private RestTemplate restTemplate; private String remoteServiceUrl; / / URL of the remote user service public RemoteUserService(RestTemplate restTemplate, String remoteServiceUrl) { / / Obtain the RestTemplate and service URL via dependency injection or configuration this.restTemplate = restTemplate; this.remoteServiceUrl = remoteServiceUrl; } @Override public User getUserById(Long userId) { / / Build the URL for the remote API, for example: / users / {userId} String apiUrl = remoteServiceUrl + " / users / " + userId; / / Use RestTemplate to send a GET request and expect to return a User object. ResponseEntity <user>response = restTemplate.getForEntity(apiUrl,User.class); / / Check the response status code and handle exceptions (e.g., 404, 500, etc.) if (response.getStatusCode() == HttpStatus.OK) { return response.getBody(); / / Returns the User object returned by the remote service. } else { / / Handle error conditions, such as throwing a custom exception or returning null. throw new RemoteServiceException("Failed to get user, status code: "+ response.getStatusCode()); } } @Override public void createUser(User user) { / / Build the URL for the remote API, for example: / users String apiUrl = remoteServiceUrl + " / users"; / / Use RestTemplate to send a POST request and send a User object as the request body. ResponseEntity <void>response = restTemplate.postForEntity(apiUrl,user, Void.class); / / Check the response status code and handle exceptions. if (response.getStatusCode() != HttpStatus.CREATED && response.getStatusCode() != HttpStatus.OK) { / / Assuming successful creation, return 201 or 200 throw new RemoteServiceException("Failed to create user, status code:" + response.getStatusCode()); } / / Creation successful, no need to return } / / ... Remote implementations of other interface methods are called using RestTemplate to invoke the corresponding RESTful API. }

[0029] Local implementations include local implementation classes. For example, for a monolithic application, we create a LocalUserService class that implements the UserService interface. This class will directly manipulate the monolithic application's data layer (such as a database or cache).

[0030] / / Java Example public class LocalUserService implements UserService { private UserRepository userRepository; / / Assuming a UserRepository exists for database operations. public LocalUserService(UserRepository userRepository) { / / Obtain UserRepository via dependency injection or direct instantiation this.userRepository = userRepository; } @Override public User getUserById(Long userId) { / / Directly call UserRepository to retrieve data return userRepository.findById(userId); } @Override public void createUser(User user) { / / Directly call UserRepository to save data userRepository.save(user); } / / ... Local implementations of other interface methods directly manipulate UserRepository or other local components. }

[0031] Configuring remote service calls: In microservice applications, it is necessary to configure RestTemplate (or other HTTP client libraries) and the URL of the remote user service (remoteServiceUrl). This is usually achieved through a configuration center, environment variables, or hard-coded in a configuration file.

[0032] Dependency injection or instantiation of RemoteUserService: Similar to the local implementation, in components that need to use UserService, the UserService interface is injected, and the dependency injection container is configured to register RemoteUserService as a remote implementation of UserService. (The dependency injection configuration is similar to the local implementation, but RemoteUserService needs to be registered instead of LocalUserService).

[0033] Remote API call flow: When the caller (e.g., the Controller) calls userService.getUserById(userId), it actually calls the RemoteUserService.getUserById(userId) method.

[0034] Using Adapters: The adapter pattern adapts different implementation classes to a unified interface. The core value of the adapter pattern lies in resolving interface incompatibility issues, allowing classes with incompatible interfaces to work together. When switching between monolithic and microservice applications is required, and the underlying implementation logic may need to be changed—that is, in scenarios requiring monolithic-microservice compatibility—adapters need to be designed and used. In monolithic applications, a local adapter is used; in microservice applications, a remote adapter is used.

[0035] For example, the local adapter LocalUserServiceAdapter implements the UserService interface and delegates the calls to the interface to LocalUserServiceImpl.

[0036] / / Java Example public class LocalUserServiceAdapter implements UserService { private LocalUserServiceImpl localUserService; public LocalUserServiceAdapter(LocalUserServiceImpl localUserService){ this.localUserService = localUserService; } @Override public User getUserById(Long userId) { System.out.println("LocalUserServiceAdapter: Adapts getUserById requests to LocalUserServiceImpl.fetchUser"); return localUserService.fetchUser(userId); / / Call the method of the local implementation class } @Override public void createUser(User user) { System.out.println("LocalUserServiceAdapter: Adapts createUser requests to LocalUserServiceImpl.saveUser"); localUserService.saveUser(user); / / Call the method of the local implementation class } / / ... Adaptation of other UserService interface methods }

[0037] For example, the remote adapter RemoteUserServiceAdapter implements the UserService interface, but internally it calls RemoteUserServiceInterface and converts the data returned by the remote service into a User object that the UserService interface expects.

[0038] / / Java Example public class RemoteUserServiceAdapter implements UserService { private RemoteUserServiceInterface remoteUserService; public RemoteUserServiceAdapter(RemoteUserServiceInterfaceremoteUserService) { this.remoteUserService = remoteUserService; } @Override public User getUserById(Long userId) { System.out.println("RemoteUserServiceAdapter: Adapt getUserById request to RemoteUserServiceImpl.fetchRemoteUserById"); String userJson = remoteUserService.fetchRemoteUserById(userId); / / Call the remote service interface / / Perform data transformation here: convert the JSON string to a User object. / / (In practical applications, a JSON parsing library, such as Jackson or Gson, is required.) User user = parseJsonToUser(userJson); / / Assuming there is a parseJsonToUser method for parsing. return user; } @Override public void createUser(User user) { System.out.println("RemoteUserServiceAdapter: Adapts for createUser requests to RemoteUserServiceImpl.postRemoteUser"); / / Perform data transformation here: Convert the User object to a JSON string. / / (In practical applications, a JSON serialization library such as Jackson or Gson is required.) String userJson = convertUserToJson(user); / / Assuming there is a convertUserToJson method for serialization. remoteUserService.postRemoteUser(userJson); / / Call the remote service interface } / / Simulates a JSON parsing method (real-world applications require a more sophisticated JSON parsing mechanism) private User parseJsonToUser(String userJson) { if (userJson == null || userJson.isEmpty()) { return null; } / / Simple string processing to simulate JSON parsing (this is just an example; a JSON library is required for real-world applications). String idStr = userJson.split(":")[1].split(",")[0].trim(); String username = userJson.split(":")[2].split("\"")[1].trim(); try { Long id = Long.parseLong(idStr); return new User(id, username); } catch (NumberFormatException e) { e.printStackTrace(); / / More robust error handling is needed in practical applications. return null; } } / / Simulate JSON conversion method (real-world applications require more sophisticated JSON serialization) private String convertUserToJson(User user) { if (user == null) { return "{}"; } return String.format("{\"id\": %d, \"username\": \"%s\"}", user.getId(), user.getUsername()); } / / ... Adaptation for other UserService interface methods (if the UserService interface has more methods) }

[0039] Configuration-based switching: Through the configuration center or configuration files, you can flexibly switch between using local or remote implementations, thereby enabling dynamic switching between monolithic and microservice deployment modes.

[0040] For example, the implementation steps are: 1. Add configuration items: First, add a configuration item in your configuration center or configuration file to specify the implementation type of UserService. For example, you can use the service.userService.mode property: Configuration files (e.g., application.properties or application.yml): service.userService.mode=local # Uses the local implementation by default # service.userService.mode=remote # Modify this configuration to switch to remote implementation. 2. Read configuration items: In the application code, it is necessary to read the values ​​of configuration items in the program code.

[0041] Java (Spring Framework example): If you are using the Spring Framework, you can use... Use the @Value annotation or the Environment object to read configuration items.

[0042] import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class ServiceModeConfig { @Value("${service.userService.mode:local}") / / Default value is local to prevent missing configuration. private String userServiceMode; public String getUserServiceMode() { return userServiceMode; } } 3. Select the adapter according to the configuration: In the application, based on the value of the service.userService.mode configuration item read, the application dynamically selects to create an instance of LocalUserServiceAdapter or RemoteUserServiceAdapter.

[0043] Java (Spring Framework Example - Using Bean Factories): In Spring configuration, you can create a Bean factory method that returns different UserService implementations based on configuration values.

[0044] import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class UserServiceConfig { private final ServiceModeConfig serviceModeConfig; public UserServiceConfig(ServiceModeConfig serviceModeConfig) { this.serviceModeConfig = serviceModeConfig; } @Bean public UserService userService() { String mode = serviceModeConfig.getUserServiceMode(); System.out.println("UserService configuration mode: " + mode); if ("remote".equalsIgnoreCase(mode)) { return new RemoteUserServiceAdapter(new RemoteUserServiceImpl()); / / Remote adapter } else { return new LocalUserServiceAdapter(new LocalUserServiceImpl()); / / Uses the local adapter by default or with the "local" configuration. } } } 4. The client-side code remains unchanged: The client-side code (e.g., the main method in Client.java) should remain unchanged, still calling the service through the UserService interface, without needing to know whether the underlying implementation is local or remote.

[0045] / / Client.java (The client code remains unchanged) public class Client { public static void main(String[] args) { / / ... (The previous code only needed to obtain the UserService instance from the factory or the Spring container) / / Spring Example: / / ApplicationContext context = new AnnotationConfigApplicationContext(UserServiceConfig.class, Client.class); / / UserService userService = context.getBean(UserService.class); / / Non-Spring example (using a factory): UserService userService = UserServiceFactory.createUserService(); User user1 = userService.getUserById(1L); System.out.println("User ID obtained by the client: " + user1); User newUser = new User(3L, "newUserFromConfig"); userService.createUser(newUser); User user3 = userService.getUserById(3L); System.out.println("User obtained by the client (ID=3, newly created): " + user3); } }

[0046] In this embodiment, a generic interface is constructed to provide a unified abstract service description to support the interaction between monolithic application architectures and microservice application architectures. A target implementation method is determined based on configuration information, including local and remote implementations. Client requests are received through an adapter, which maps the client request to the corresponding implementation class according to the target implementation method. The client request is executed, and the execution process accesses the corresponding data storage or remote service according to the target implementation method. This solves the technical problem in related technologies where monolithic applications and microservice applications use different interface designs and communication methods, making seamless integration and switching difficult. This achieves integration and switching between monolithic application architectures and microservice application architectures.

[0047] Secondly, embodiments of this application also provide an apparatus that supports the integration of monolithic applications and microservice applications.

[0048] In one embodiment, reference is made to Figure 2 , Figure 2 This is a functional module diagram of an embodiment of the apparatus supporting the integration of monolithic applications and microservice applications according to this application. Figure 2 As shown, the devices that support the integration of monolithic applications and microservice applications include: Module 10 is used to build a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture. The determining module 20 is used to determine the target implementation method based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; The receiving module 30 is configured to receive client requests through an adapter, wherein the adapter maps the client requests to the corresponding implementation class according to the target implementation method; The execution module 40 is used to execute the client request, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

[0049] Furthermore, in one embodiment, the determining module 20 is used to: The configuration information is obtained from the configuration center, and the configuration information includes the architecture mode identifier and implementation method parameters; Based on the architecture pattern identifier, determine whether the current application architecture is a monolithic application or a microservice application; If it is determined to be a monolithic application, then the target implementation method will be determined to be a local implementation; If it is determined to be a microservice application, then the target implementation method is determined to be remote implementation; The specific execution path of the local implementation or the remote implementation is further determined based on the implementation method parameters, wherein the execution path is used to guide the mapping operation of the adapter.

[0050] Furthermore, in one embodiment, the receiving module 30 is used to: Receive the client request and parse its request format and content; According to the target implementation method, the corresponding interface requirements are obtained, wherein the interface requirements are used to adapt the calling rules of the local implementation or the remote implementation; Adjust the parameters of the client request to match the interface requirements; The adjusted client request is forwarded to the corresponding implementation class. Log information of the mapping process is recorded, and the log information is used for subsequent request tracing and error troubleshooting.

[0051] Furthermore, in one embodiment, the execution module 40 is used to: Determine whether the target implementation method is local or remote; If implemented locally, the required data is obtained by directly accessing the data storage, which is used to store relevant data for the monolithic application. If implemented remotely, the address information of the target remote service is obtained through the service registry. Establish a communication connection with the target remote service based on the address information; The client requests are sent and the response data of the target remote service is received through the communication connection.

[0052] Furthermore, in one embodiment, the construction module 10 is used for: Determine the service scope of the general interface, which covers the core functions of monolithic applications and microservice applications; Edit the input and output parameters of the general interface, wherein the input and output parameters are used to unify the data interaction format under monolithic architecture and microservice application architecture; Establish a mapping relationship between the general interface and the local and remote implementations; Verify the compatibility of the general interface under the monolithic architecture and the microservice application architecture. The compatibility verification is completed by simulating client requests. Adjust the definition of the general interface based on the verification results to optimize interaction efficiency.

[0053] Furthermore, in one embodiment, the apparatus supporting the integration of monolithic applications and microservice applications further includes a new module for: Parse the service identifier in the client request, which indicates the specific service type requested; The system queries a preset mapping rule based on the service identifier and the target implementation method. The mapping rule is used to determine the corresponding implementation class. If the target implementation method is remote implementation, then the calling address of the remote implementation is dynamically obtained through the service registry center; The invocation method of the client request is adjusted according to the mapping rules and the invocation address; The adjusted client request is forwarded to the determined implementation class to complete the service call.

[0054] Furthermore, in one embodiment, the apparatus supporting the integration of monolithic applications and microservice applications further includes a new module for: Determine the specific type of the target implementation method, where the specific type includes local implementation and remote implementation; If implemented locally, the target data is extracted from the data storage according to the content requested by the client; If it is a remote implementation, a remote call request is constructed based on the content requested by the client; S74. Interact with the remote service through the remote call request to obtain the response result of the remote service; The target data or the response result is formatted to adapt to the return of the client request.

[0055] The functions of each module in the device that supports the integration of monolithic applications and microservice applications correspond to the steps in the method embodiment that supports the integration of monolithic applications and microservice applications. Their functions and implementation processes will not be described in detail here.

[0056] Thirdly, embodiments of this application provide a device that supports the integration of monolithic applications and microservice applications. The device that supports the integration of monolithic applications and microservice applications can be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.

[0057] Reference Figure 3 , Figure 3 This is a schematic diagram of the hardware structure of a device supporting the integration of monolithic applications and microservice applications, as described in the embodiments of this application. In these embodiments, the device supporting the integration of monolithic applications and microservice applications may include a processor, memory, a communication interface, and a communication bus.

[0058] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.

[0059] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces. These interfaces enable interconnection of internal devices supporting the integration of monolithic and microservice applications, as well as interfaces enabling interconnection between the device supporting monolithic and microservice applications and other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.

[0060] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0061] The processor can be a general-purpose processor, which can call a program stored in memory that supports the integration of monolithic applications and microservice applications, and execute the method for supporting the integration of monolithic applications and microservice applications provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the program supporting the integration of monolithic applications and microservice applications is called can be referred to the various embodiments of the method for supporting the integration of monolithic applications and microservice applications in this application, and will not be repeated here.

[0062] Those skilled in the art will understand that Figure 3 The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0063] Fourthly, embodiments of this application also provide a computer-readable storage medium.

[0064] The present application stores a program on a computer-readable storage medium that supports the integration of monolithic applications and microservice applications. When the program supporting the integration of monolithic applications and microservice applications is executed by a processor, it implements the steps of the method for supporting the integration of monolithic applications and microservice applications as described above.

[0065] The method implemented when the program supporting the integration of monolithic applications and microservice applications is executed can be referred to in the various embodiments of the method supporting the integration of monolithic applications and microservice applications in this application, and will not be repeated here.

[0066] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0067] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.

[0068] In the description of the embodiments in this application, terms such as "exemplary," "for example," or "for instance" are used to indicate that they are examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being better or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a specific manner.

[0069] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0070] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.

[0071] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.

[0072] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.< / void> < / user>

Claims

1. A method for supporting the integration of monolithic applications and microservice applications, characterized in that, include: Construct a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture; The target implementation method is determined based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; Client requests are received via an adapter, wherein the adapter maps the client requests to the corresponding implementation class according to the target implementation method; The client request is executed, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

2. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, The step of determining the target implementation method based on configuration information includes: The configuration information is obtained from the configuration center, and the configuration information includes the architecture mode identifier and implementation method parameters; Based on the architecture pattern identifier, determine whether the current application architecture is a monolithic application or a microservice application; If it is determined to be a monolithic application, then the target implementation method will be determined to be a local implementation; If it is determined to be a microservice application, then the target implementation method is determined to be remote implementation; The specific execution path of the local implementation or the remote implementation is further determined based on the implementation method parameters, wherein the execution path is used to guide the mapping operation of the adapter.

3. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, The process of receiving client requests via the adapter includes: Receive the client request and parse its request format and content; According to the target implementation method, the corresponding interface requirements are obtained, wherein the interface requirements are used to adapt the calling rules of the local implementation or the remote implementation; Adjust the parameters of the client request to match the interface requirements; The adjusted client request is forwarded to the corresponding implementation class. Log information of the mapping process is recorded, and the log information is used for subsequent request tracing and error troubleshooting.

4. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, Executing the client request includes: Determine whether the target implementation method is local or remote; If implemented locally, the required data is obtained by directly accessing the data storage, which is used to store relevant data for the monolithic application. If implemented remotely, the address information of the target remote service is obtained through the service registry. Establish a communication connection with the target remote service based on the address information; The client requests are sent and the response data of the target remote service is received through the communication connection.

5. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, The construction of the general interface includes: Determine the service scope of the general interface, which covers the core functions of monolithic applications and microservice applications; Edit the input and output parameters of the general interface, wherein the input and output parameters are used to unify the data interaction format under monolithic architecture and microservice application architecture; Establish a mapping relationship between the general interface and the local and remote implementations; Verify the compatibility of the general interface under the monolithic architecture and the microservice application architecture. The compatibility verification is completed by simulating client requests. Adjust the definition of the general interface based on the verification results to optimize interaction efficiency.

6. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, The adapter maps the client request to the corresponding implementation class according to the target implementation method, including: Parse the service identifier in the client request, which indicates the specific service type requested; The system queries a preset mapping rule based on the service identifier and the target implementation method. The mapping rule is used to determine the corresponding implementation class. If the target implementation method is remote implementation, then the calling address of the remote implementation is dynamically obtained through the service registry center; The invocation method of the client request is adjusted according to the mapping rules and the invocation address; The adjusted client request is forwarded to the determined implementation class to complete the service call.

7. The method for supporting the integration of monolithic applications and microservice applications as described in claim 1, characterized in that, Accessing the corresponding data storage or remote service according to the target implementation method includes: Determine the specific type of the target implementation method, where the specific type includes local implementation and remote implementation; If implemented locally, the target data is extracted from the data storage according to the content requested by the client; If it is implemented remotely, then construct a remote call request based on the content requested by the client; The remote call request is used to interact with the remote service and obtain the response result of the remote service. The target data or the response result is formatted to adapt to the return of the client request.

8. An apparatus for supporting the integration of monolithic applications and microservice applications, characterized in that, The device supporting the integration of monolithic applications and microservice applications includes: A building module is used to build a general interface, wherein the general interface is used to provide a unified abstract service description to support the interaction between monolithic application architecture and microservice application architecture; The determination module is used to determine the target implementation method based on the configuration information, wherein the target implementation method includes local implementation and remote implementation; A receiving module is used to receive client requests through an adapter, wherein the adapter maps the client requests to the corresponding implementation classes according to the target implementation method; An execution module is used to execute the client request, wherein the execution process accesses the corresponding data storage or remote service according to the target implementation method.

9. A device that supports the integration of monolithic applications and microservice applications, characterized in that, The device supporting the integration of monolithic applications and microservice applications includes a processor, a memory, and a program stored in the memory and executable by the processor that supports the integration of monolithic applications and microservice applications. When the program supporting the integration of monolithic applications and microservice applications is executed by the processor, it implements the steps of the method for supporting the integration of monolithic applications and microservice applications as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that supports the integration of monolithic applications and microservice applications, wherein when the program supporting the integration of monolithic applications and microservice applications is executed by a processor, it implements the steps of the method for supporting the integration of monolithic applications and microservice applications as described in any one of claims 1 to 7.