A method and device for processing a call request

Through the aspect-oriented programming framework, extension point objects are scheduled according to routing strategies and priorities, which solves the problems of high maintenance costs and business logic coupling of old systems, and achieves logic decoupling and improved reusability.

CN113448679BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010218530.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-25
Publication Date
2024-09-20
Estimated Expiration
2040-03-25

AI Technical Summary

Technical Problem

In the existing technology, the maintenance cost of the old system is high and the business logic is highly coupled, making it difficult to disassemble and decouple, making it difficult to add new logic and even unable to transform the old logic.

Method used

Receive call requests through the aspect-oriented programming framework, filter and schedule extension point implementation objects based on routing strategies, routing priorities, and concurrency strategies, decouple business logic, and manage and dynamically change extension point objects.

Benefits of technology

It realizes the decoupling and splitting of business logic, simplifies coding and maintenance, facilitates the transformation of old systems, and increases the reusability and scalability of logic code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113448679B
    Figure CN113448679B
Patent Text Reader

Abstract

The present invention discloses a method and device for processing a call request, and relates to the field of computer technology. A specific implementation of the method includes: receiving a call request passed in by an aspect-oriented container framework, screening out the extension point implementation object to be run according to the routing strategy and the business parameters carried by the call request; assigning a call priority to the extension point implementation object to be run according to the routing priority; calling the extension point implementation object to be run with the call priority according to the concurrency strategy to obtain a scheduling result; and running the extension point implementation object to be run based on the scheduling result and the business parameters to obtain a return value. This implementation can solve the technical problem of high coupling of business logic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing a call request. Background Art

[0002] Policy routing is scattered throughout the code, and subsequent additions of policies require modification of existing code logic. In addition, the policy logic is a black box that is invisible to other participants other than developers.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] As business and time develop, the maintenance cost of old systems is getting higher and higher. This is mainly because customized logic is not standardized and developed, and various business logics are coupled together, which is difficult to disassemble and decouple, making it difficult to add new logic or even impossible to transform old logic. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and apparatus for processing a call request to solve the technical problem of high coupling of business logic.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing a call request is provided, comprising:

[0007] Receive a call request from the aspect-oriented container framework, and filter out the extension point implementation object to be run according to the routing strategy and the business parameters carried in the call request;

[0008] According to the routing priority, assigning a calling priority to the extension point implementation object to be run;

[0009] According to the concurrency strategy, the extension point implementation object to be run that is assigned a calling priority is called to obtain a scheduling result;

[0010] Based on the scheduling result and the business parameter, the extension point implementation object to be run is run to obtain a return value.

[0011] Optionally, before receiving the incoming call request from the aspect-oriented container framework, the following is also included:

[0012] Respectively obtain the extension point implementation class corresponding to each extension point interface, parse each of the extension point implementation classes, and obtain configuration information of each of the extension point implementation classes; wherein the configuration information includes routing strategy, routing priority and concurrency strategy;

[0013] The configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces to obtain each of the extension point implementation objects.

[0014] Optionally, before obtaining the extension point implementation class corresponding to each extension point interface, the following is further included:

[0015] Generate an empty implementation class with aspect-oriented programming annotations corresponding to each extension point interface;

[0016] Initialize the aspect-oriented container framework;

[0017] The empty implementation class with the aspect-oriented programming annotations added is injected into the aspect-oriented container framework to obtain the empty implementation objects corresponding to the extension point interfaces.

[0018] Optionally, for each extension point interface, an empty implementation class with aspect-oriented programming annotations added corresponding to the extension point interface is generated using the following method:

[0019] Acquire the extension point interface and obtain interface information of the extension point interface; wherein the interface information includes interface name, method name, input parameter and output parameter;

[0020] Generate an empty implementation class corresponding to the extension point interface according to the interface information of the extension point interface and using a bytecode editor;

[0021] The aspect-oriented programming annotation is injected into the empty implementation class, thereby obtaining an empty implementation class with the aspect-oriented programming annotation added.

[0022] Optionally, after initializing the aspect-oriented container framework, it also includes:

[0023] Get the extension point package according to the path of the pre-configured extension point package;

[0024] Scan the extension point package to obtain each extension point interface;

[0025] According to each of the extension point interfaces, an information set of each of the extension point interfaces is obtained; wherein the information set includes an interface name, a method name, input parameters, output parameters, and an empty implementation class with aspect-oriented programming annotations added.

[0026] Optionally, after initializing the aspect-oriented container framework, it also includes:

[0027] Specifies the default injected object in the aspect-oriented container framework.

[0028] Optionally, obtain the extension point implementation class corresponding to each extension point interface, including:

[0029] According to the path of the pre-configured extension point implementation class package, obtain the extension point implementation class package;

[0030] The extension point implementation class package is scanned to obtain the extension point implementation class corresponding to each extension point interface.

[0031] Optionally, after obtaining the scheduling result, the method further includes: storing the scheduling result in a cache.

[0032] Optionally, after storing the scheduling result in the cache, the method further includes:

[0033] Receiving a business request passed in by the aspect-oriented container framework; wherein the business request has the same business scenario as the calling request;

[0034] Obtain the scheduling result from the cache;

[0035] Based on the scheduling result and the service parameters carried in the service request, the extension point implementation object to be run is run to obtain a return value.

[0036] In addition, according to another aspect of an embodiment of the present invention, there is provided a device for processing a call request, comprising:

[0037] A screening module is used to receive the incoming call request from the aspect-oriented container framework, and screen out the extension point implementation objects to be run according to the routing strategy and the business parameters carried in the call request;

[0038] A routing module, used for assigning a calling priority to the extension point implementation object to be run according to the routing priority;

[0039] A scheduling module, used for calling the extension point implementation object to be run and given a calling priority according to a concurrency strategy, to obtain a scheduling result;

[0040] The return module is used to run the extension point implementation object to be run based on the scheduling result and the business parameter to obtain a return value.

[0041] Optionally, the screening module is further used for:

[0042] Before receiving the incoming call request from the aspect-oriented container framework, respectively obtain the extension point implementation class corresponding to each extension point interface, parse each of the extension point implementation classes, and obtain the configuration information of each of the extension point implementation classes; wherein the configuration information includes routing strategy, routing priority and concurrency strategy;

[0043] The configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces to obtain each of the extension point implementation objects.

[0044] Optionally, the screening module is further used for:

[0045] Before obtaining the extension point implementation classes corresponding to each extension point interface, generate an empty implementation class corresponding to each extension point interface with aspect-oriented programming annotations added;

[0046] Initialize the aspect-oriented container framework;

[0047] The empty implementation class with the aspect-oriented programming annotations added is injected into the aspect-oriented container framework to obtain the empty implementation objects corresponding to the extension point interfaces.

[0048] Optionally, for each extension point interface, an empty implementation class with aspect-oriented programming annotations added corresponding to the extension point interface is generated using the following method:

[0049] Acquire the extension point interface and obtain interface information of the extension point interface; wherein the interface information includes interface name, method name, input parameter and output parameter;

[0050] Generate an empty implementation class corresponding to the extension point interface according to the interface information of the extension point interface and using a bytecode editor;

[0051] The aspect-oriented programming annotation is injected into the empty implementation class, thereby obtaining an empty implementation class with the aspect-oriented programming annotation added.

[0052] Optionally, the screening module is further used for:

[0053] After initializing the aspect-oriented container framework, the extension point package is obtained according to the path of the pre-configured extension point package;

[0054] Scan the extension point package to obtain each extension point interface;

[0055] According to each of the extension point interfaces, an information set of each of the extension point interfaces is obtained; wherein the information set includes an interface name, a method name, input parameters, output parameters, and an empty implementation class with aspect-oriented programming annotations added.

[0056] Optionally, the screening module is further used for:

[0057] After initializing the aspect-oriented container framework, a default injected object is specified in the aspect-oriented container framework.

[0058] Optionally, the screening module is further used for:

[0059] According to the path of the pre-configured extension point implementation class package, obtain the extension point implementation class package;

[0060] The extension point implementation class package is scanned to obtain the extension point implementation class corresponding to each extension point interface.

[0061] Optionally, the scheduling module is further used to: after obtaining the scheduling result, store the scheduling result in a cache.

[0062] Optionally, the return module is further used for:

[0063] After storing the scheduling result in the cache, receiving a business request from the aspect-oriented container framework; wherein the business request has the same business scenario as the call request;

[0064] Obtain the scheduling result from the cache;

[0065] Based on the scheduling result and the service parameters carried in the service request, the extension point implementation object to be run is run to obtain a return value.

[0066] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0067] one or more processors;

[0068] a storage device for storing one or more programs,

[0069] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.

[0070] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0071] An embodiment of the above invention has the following advantages or beneficial effects: because the scheduling result is obtained according to the routing strategy, routing priority and concurrency strategy, and the extension point implementation object to be run is run based on the scheduling combination and business parameters to obtain the technical means of the return value, the technical problem of high coupling of business logic in the prior art is overcome. The embodiment of the present invention uses an object-oriented method to split and decouple the inherent logic, and can centrally manage and dynamically change the decoupled extension point implementation objects. On the one hand, the embodiment of the present invention decouples the complex business logic, making coding and maintenance simple, and there is no need to write complex factory mode and responsibility chain mode. As long as the business logic is executed and the results are aggregated according to the scheduling results; on the other hand, when transforming the old business system, it is convenient to disassemble the business, and when expanding the new business, while fully reusing the original logic, the new logic can be expanded without worrying about affecting the original logic. Therefore, the embodiment of the present invention can effectively decouple the logic code and split the business logic, thereby increasing the reusability and extensibility of the logic code.

[0072] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0074] Figure 1 is a schematic diagram of the main process of the method for processing a call request according to an embodiment of the present invention;

[0075] Figure 2 is a schematic diagram of the main process of the compiling stage according to an embodiment of the present invention;

[0076] Figure 3 is a schematic diagram of the main process of the startup phase according to an embodiment of the present invention;

[0077] Figure 4 A schematic diagram of the main process of the operation phase according to an embodiment of the present invention;

[0078] Figure 5 is a schematic diagram of main modules of an apparatus for processing a call request according to an embodiment of the present invention;

[0079] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0080] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0081] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0082] Figure 1 Schematic diagram of the main process of the method for processing a call request according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for processing the call request may include:

[0083] Step 101, receiving a call request from an aspect-oriented container framework, and filtering out extension point implementation objects to be run according to a routing strategy and business parameters carried in the call request.

[0084] In an embodiment of the present invention, the business that needs to be disassembled (such as order query business, inventory query business or logistics query business, etc.) is called an extension point, and the extension point is defined as an interface, and the different implementation logics of different businesses are called extension point implementation classes. The implementation of the embodiment of the present invention relies on an aspect-oriented container framework (such as a spring framework), and different extension point implementation classes are managed by extension point implementation objects (i.e., extension point implementation beans) maintained by the framework. Taking the spring framework as an example, the framework can intercept call requests through an AOP (Aspect Oriented Programming) interceptor, so that the call request is passed into the routing framework, the routing framework receives the call request passed in by the spring framework, and then obtains the routing strategy from the cache, analyzes the routing strategy corresponding to different extension point implementation objects, and selects the extension point implementation objects to be run from the various extension point implementation objects maintained by the spring framework according to the routing strategy, the business parameters carried by the call request, and the current system environment.

[0085] The spring framework is an open source framework based on the Java language. It simplifies object management, method proxy and other functions in code development. It effectively manages and maintains objects in Java code through inversion of control (IoC). Through aspect-oriented programming (AOP), the coding process focuses more on the cohesion of business code rather than general code such as logging and transactions.

[0086] Optionally, the routing strategy includes the combination parameters of the extension point implementation object and the system operating environment, such as under which parameter combinations and in which system environments the extension point implementation object runs, so the routing framework filters out those extension point implementation objects that should not run according to the routing strategy and business parameters, thereby screening out the extension point implementation objects that should run.

[0087] Optionally, before step 101, it also includes: respectively obtaining the extension point implementation class corresponding to each extension point interface, parsing each of the extension point implementation classes, and obtaining the configuration information of each of the extension point implementation classes; injecting the configuration information of each of the extension point implementation classes into the empty implementation object corresponding to each of the extension point interfaces, and obtaining each of the extension point implementation objects. In order to achieve the maintenance and management of each of the extension point implementation objects, it is necessary to generate the extension point implementation object corresponding to each of the extension point interfaces before step 101. Specifically, the routing framework first obtains the extension point implementation class corresponding to each of the extension point interfaces, and each of the extension point interfaces can correspond to multiple extension point implementation classes; then parses each of the extension point implementation classes, and obtains the configuration information of each of the extension point implementation classes, wherein the configuration information includes routing strategy, routing priority and concurrency strategy, and the configuration information can also be stored in a cache; finally, the configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces, and thus obtains each of the extension point implementation objects. It should be pointed out that the routing framework will automatically route to the corresponding empty implementation object based on the configuration information on the method in the extension point implementation class, and then inject the configuration information into the corresponding empty implementation object.

[0088] Optionally, the routing priority includes the execution order of the extension point implementation objects, such as which one is executed first and which one is executed later when multiple extension point implementation objects are to be executed. The concurrency strategy includes a parallel call strategy and / or a serial call strategy, such as when multiple extension point implementations are to be executed, the one with the highest priority is selected for execution, or all are executed sequentially.

[0089] Optionally, before obtaining the extension point implementation classes corresponding to each extension point interface respectively, the method further includes: generating an empty implementation class with aspect-oriented programming annotations corresponding to each extension point interface; initializing an aspect-oriented container framework; injecting the empty implementation class with aspect-oriented programming annotations into the aspect-oriented container framework to obtain an empty implementation object corresponding to each extension point interface. In order to inject the configuration information of each extension point implementation class into the empty implementation object corresponding to each extension point interface respectively, it is also necessary to generate the extension point implementation object corresponding to each extension point interface before step 101. Specifically, firstly, an empty implementation class with AOP annotations corresponding to each extension point interface is generated, and then the spring framework is initialized to start the routing framework; finally, the routing framework injects the empty implementation class with AOP annotations into the spring framework to obtain an empty implementation bean.

[0090] Optionally, for each extension point interface, the following method is used to generate an empty implementation class corresponding to the extension point interface with aspect-oriented programming annotations added: obtain the extension point interface and obtain the interface information of the extension point interface; generate an empty implementation class corresponding to the extension point interface based on the interface information of the extension point interface and using a bytecode editor; inject aspect-oriented programming annotations into the empty implementation class, thereby obtaining an empty implementation class with aspect-oriented programming annotations added. In the compilation stage, first obtain the extension point interface and obtain the interface information of the extension point interface, wherein the interface information includes the interface name, method name, input parameters, and output parameters; then use a bytecode editor to generate a corresponding empty implementation class based on the interface information; finally, inject AOP annotations into the empty implementation class.

[0091] Bytecode editor: By adding or modifying bytecode, you can dynamically add classes, class members, and method functions to the code. The purpose of injecting AOP annotations during the compilation phase is to allow the AOP interceptor of the spring framework to intercept the call request, so that the call request enters the routing framework, thereby routing each extension point implementation object. The embodiment of the present invention relies on the bytecode editor and uses the bytecode editor to generate a default empty implementation class for the extension point interface.

[0092] Optionally, after initializing the aspect-oriented container framework, it also includes: obtaining the extension point package according to the path of the pre-configured extension point package; scanning the extension point package to obtain each extension point interface; and obtaining the information set of each extension point interface according to each extension point interface. Developers can pre-configure the path of the extension point package. When the routing framework is started, the extension point package is obtained according to the path of the extension point package, and then the extension point package is scanned to obtain each extension point interface in the extension point package. Finally, according to each extension point interface, the information set of each extension point interface is obtained. The information set includes the interface name, method name, input parameter, output parameter, and an empty implementation class with AOP annotations (generated during the compilation stage).

[0093] Optionally, after initializing the aspect-oriented container framework, the method further includes: specifying a default injected object (bean) in the aspect-oriented container framework. Since the default injected bean is pre-specified, the empty implementation class with AOP annotations is injected into the default injected bean, thereby obtaining an empty implementation bean corresponding to each of the extension point interfaces.

[0094] Optionally, the extension point implementation class corresponding to each extension point interface is obtained respectively, including: obtaining the extension point implementation class package according to the path of the pre-configured extension point implementation class package; scanning the extension point implementation class package to obtain the extension point implementation class corresponding to each extension point interface. Developers can pre-configure the path of the extension point implementation class package, and when the routing framework is started, the extension point implementation class package is obtained according to the path of the extension point implementation class package, and then the extension point implementation class package is scanned to obtain the extension point implementation class corresponding to each extension point interface. It should be pointed out that the path of the extension point package and the extension point implementation class package needs to be pre-configured, and each extension point interface can correspond to multiple extension point implementation classes.

[0095] Step 102: assigning a calling priority to the extension point implementation object to be executed according to the routing priority.

[0096] After the routing framework selects each extension point implementation object to be run according to the routing strategy, it further assigns a calling priority to these extension point implementation objects to be run according to the routing priority corresponding to these extension point implementation objects to be run. Optionally, the routing priority can be obtained from the cache.

[0097] Step 103: According to the concurrency strategy, the extension point implementation object to be executed that is assigned a calling priority is called to obtain a scheduling result.

[0098] After assigning a call priority to each extension point implementation object to be run, the routing framework further calls the extension point implementation object to be run assigned a call priority according to the concurrency strategy to obtain a scheduling result. Optionally, the routing priority can be obtained from a cache.

[0099] Optionally, after obtaining the scheduling result, the method further includes: storing the scheduling result in a cache. The scheduling result is stored in the cache, and when the same service is called next time, the scheduling result corresponding to the service stored in the cache can be directly obtained, thereby saving request processing time.

[0100] Step 104: Based on the scheduling result and the business parameter, the extension point implementation object to be run is run to obtain a return value.

[0101] The routing framework runs the extension point implementation object to be run based on the scheduling result obtained in step 103 and the business parameters parsed in step 101, thereby obtaining a corresponding return value.

[0102] Optionally, after storing the scheduling result in the cache, it also includes: receiving a business request passed in by the aspect-oriented container framework; obtaining the scheduling result from the cache; and running the extension point implementation object to be run based on the scheduling result and the business parameters carried by the business request to obtain a return value. The business request has the same business scenario as the call request. In order to improve the response speed of the system, the routing framework will cache the scheduling results. When the system runs into the same business scenario again, the routing framework will directly return the scheduling results in the cache instead of analyzing and routing again.

[0103] The embodiment of the present invention implements routing to one or more extended business logics (extension point implementation objects) in different business scenarios through a flexible and lightweight routing framework. These business logics can be executed according to certain rules or conventions.

[0104] According to the various embodiments described above, it can be seen that the embodiments of the present invention obtain the scheduling results according to the routing strategy, routing priority and concurrency strategy, thereby running the extension point implementation object to be run based on the scheduling combination and business parameters, and obtaining the technical means of the return value, which solves the technical problem of high coupling of business logic in the prior art. The embodiments of the present invention use the object-oriented method to split and decouple the inherent logic, and can centrally manage and dynamically change the decoupled extension point implementation objects. On the one hand, the embodiments of the present invention decouple the complex business logic, making coding and maintenance simple, without the need to write complex factory mode and responsibility chain mode, as long as the business logic is executed and the results are aggregated according to the scheduling results; on the other hand, when transforming the old business system, it is convenient to disassemble the business, and when expanding the new business, while fully reusing the original logic, the new logic can be expanded without worrying about affecting the original logic. Therefore, the embodiments of the present invention can effectively decouple the logic code and split the business logic, thereby increasing the reusability and extensibility of the logic code.

[0105] As another embodiment of the present invention, the method for processing a request mainly includes a compiling phase, a starting phase and a running phase, and these three phases are described in detail below.

[0106] Figure 2 FIG. 1 is a schematic diagram of the main process of the compilation phase according to an embodiment of the present invention. Figure 2 As shown, the compilation phase mainly includes the following steps:

[0107] Step 1: Get the extension point interface with the compilation annotation added, and get the interface information of each extension point interface; the interface information includes the interface name, method name, input parameters, output parameters, etc.

[0108] Step 2: Generate an empty implementation class corresponding to the extension point interface according to the interface information of the extension point interface and using a bytecode editor.

[0109] Step 3: Add AOP annotations to the empty implementation class to obtain an empty implementation class with AOP annotations added.

[0110] The purpose of injecting AOP annotations during the compilation phase is to allow the AOP interceptor of the spring framework to intercept the call request, so that the call request enters the routing framework, thereby routing the implementation objects of each extension point.

[0111] Figure 3 FIG. 1 is a schematic diagram of the main process of the startup phase according to an embodiment of the present invention. Figure 3 As shown, the startup phase mainly includes the following steps:

[0112] Step 1. Initialize the spring framework and specify the default injected beans in the spring framework.

[0113] Step 2: Start the routing framework.

[0114] Step 3: Obtain the path of a pre-configured extension point package, and obtain the extension point package according to the path of the extension point package; obtain the extension point interface with the compilation annotation added by scanning each extension point interface in the extension point package.

[0115] Step 4: According to each of the extension point interfaces, obtain the information set corresponding to the extension point interface; wherein the information set includes the interface name, method name, input parameters, output parameters and an empty implementation class with AOP annotations obtained during the compilation phase.

[0116] Step 5. Inject the empty implementation class with AOP annotations into the default bean of the spring framework to obtain an empty implementation bean.

[0117] Step 6: According to the path of the pre-configured extension point implementation class package, obtain the extension point implementation class package; and obtain the extension point implementation class with the compilation annotation added by scanning each extension point implementation class in the extension point implementation class package.

[0118] Step 7: parse each of the extension point implementation classes to obtain configuration information on the methods of the extension point implementation class (including routing strategy, routing priority, and concurrency strategy); then inject the configuration information into the empty implementation bean of the spring framework to obtain the extension point implementation bean.

[0119] The routing strategy includes the combination parameters of the extension point implementation object and the system operating environment, such as under which parameter combinations and system environments the extension point implementation object runs; the routing priority includes the execution order of the extension point implementation object, such as which one is executed first and which one is executed later when multiple extension point implementation objects are to be executed. The concurrency strategy includes parallel call strategy and / or serial call strategy, such as when multiple extension point implementations are to be executed, choose the one with the highest priority to execute, or execute all of them sequentially.

[0120] Step 8: Store the configuration information corresponding to each extension point implementation bean in step 7 into the cache.

[0121] Figure 4 A schematic diagram of the main process of the operation phase according to an embodiment of the present invention. Figure 4 As shown, the operation phase mainly includes the following steps:

[0122] Step 1: The user triggers the execution of the business code;

[0123] Step 2: The business code initiates a call request to the spring framework (carrying business parameters);

[0124] Step 3: The Spring framework parses the AOP annotations and calls the routing framework through the AOP interceptor.

[0125] The spring framework can intercept call requests through AOP interceptors, so that the call requests are passed into the routing framework, and the routing framework receives the call requests passed in by the spring framework.

[0126] Step 4: The routing framework obtains the routing strategy from the cache, analyzes the routing strategies corresponding to different extension point implementation objects, and filters out the extension point implementation beans that should not be run based on the routing strategy, the business parameters carried by the call request, and the current system environment, and selects the extension point implementation beans to be run.

[0127] Step 5: The routing framework obtains the routing priority from the cache, and assigns a calling priority to the extension point implementation bean to be run according to the routing priority.

[0128] Step 6: The routing framework obtains the concurrency strategy from the cache, and calls the extension point implementation bean according to the concurrency strategy, such as parallel call, serial call, etc., to obtain the scheduling result, and stores the scheduling result in the cache.

[0129] Step 7: Run the extension point implementation bean to be run according to the scheduling result, and obtain the return value corresponding to the business parameter.

[0130] After storing the dispatch result of the call request in the cache, if a business request with the same business scenario is received again from the spring framework, the dispatch result is directly obtained from the cache, and then the extension point implementation object to be run is run based on the dispatch result and the business parameters carried by the business request, thereby obtaining the corresponding return value. The routing framework does not need to analyze and route again, but runs the extension point implementation object to be run according to the dispatch result in the cache, which can significantly improve the response speed of the system.

[0131] In addition, the specific implementation content of the method for processing a call request in a reference embodiment of the present invention has been described in detail in the method for processing a call request described above, so the repeated content will not be described here.

[0132] Figure 5 is a schematic diagram of main modules of an apparatus for processing a call request according to an embodiment of the present invention, such as Figure 5 As shown, the device 500 for processing call requests includes a screening module 501, a routing module 502, a scheduling module 503 and a return module 504; wherein the screening module 501 is used to receive the call request passed in by the aspect-oriented container framework, and screen out the extension point implementation object to be run according to the routing strategy and the business parameters carried by the call request; the routing module 502 is used to assign a call priority to the extension point implementation object to be run according to the routing priority; the scheduling module 503 is used to call the extension point implementation object to be run that is assigned the call priority according to the concurrency strategy to obtain a scheduling result; the return module 504 is used to run the extension point implementation object to be run based on the scheduling result and the business parameters to obtain a return value.

[0133] Optionally, the screening module 501 is further used for:

[0134] Before receiving the incoming call request from the aspect-oriented container framework, respectively obtain the extension point implementation class corresponding to each extension point interface, parse each of the extension point implementation classes, and obtain the configuration information of each of the extension point implementation classes; wherein the configuration information includes routing strategy, routing priority and concurrency strategy;

[0135] The configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces to obtain each of the extension point implementation objects.

[0136] Optionally, the screening module 501 is further used for:

[0137] Before obtaining the extension point implementation classes corresponding to each extension point interface, generate an empty implementation class corresponding to each extension point interface with aspect-oriented programming annotations added;

[0138] Initialize the aspect-oriented container framework;

[0139] The empty implementation class with the aspect-oriented programming annotations added is injected into the aspect-oriented container framework to obtain the empty implementation objects corresponding to the extension point interfaces.

[0140] Optionally, for each extension point interface, an empty implementation class with aspect-oriented programming annotations added corresponding to the extension point interface is generated using the following method:

[0141] Acquire the extension point interface and obtain interface information of the extension point interface; wherein the interface information includes interface name, method name, input parameter and output parameter;

[0142] Generate an empty implementation class corresponding to the extension point interface according to the interface information of the extension point interface and using a bytecode editor;

[0143] The aspect-oriented programming annotation is injected into the empty implementation class, thereby obtaining an empty implementation class with the aspect-oriented programming annotation added.

[0144] Optionally, the screening module 501 is further used for:

[0145] After initializing the aspect-oriented container framework, the extension point package is obtained according to the path of the pre-configured extension point package;

[0146] Scan the extension point package to obtain each extension point interface;

[0147] According to each of the extension point interfaces, an information set of each of the extension point interfaces is obtained; wherein the information set includes an interface name, a method name, input parameters, output parameters, and an empty implementation class with aspect-oriented programming annotations added.

[0148] Optionally, the screening module 501 is further used for:

[0149] After initializing the aspect-oriented container framework, a default injected object is specified in the aspect-oriented container framework.

[0150] Optionally, the screening module 501 is further used for:

[0151] According to the path of the pre-configured extension point implementation class package, obtain the extension point implementation class package;

[0152] The extension point implementation class package is scanned to obtain the extension point implementation class corresponding to each extension point interface.

[0153] Optionally, the scheduling module 503 is further configured to: after obtaining the scheduling result, store the scheduling result in a cache.

[0154] Optionally, the returning module 504 is further configured to:

[0155] After storing the scheduling result in the cache, receiving a business request from the aspect-oriented container framework; wherein the business request has the same business scenario as the call request;

[0156] Obtain the scheduling result from the cache;

[0157] Based on the scheduling result and the service parameters carried in the service request, the extension point implementation object to be run is run to obtain a return value.

[0158] It can be seen that the embodiment of the present invention obtains the scheduling result according to the routing strategy, routing priority and concurrency strategy, thereby running the extension point implementation object to be run based on the scheduling combination and business parameters, and obtaining the technical means of the return value, which solves the technical problem of high coupling of business logic in the prior art. The embodiment of the present invention uses an object-oriented method to split and decouple the inherent logic, and can centrally manage and dynamically change the decoupled extension point implementation objects. On the one hand, the embodiment of the present invention decouples the complex business logic, making coding and maintenance simple, without the need to write complex factory patterns and responsibility chain patterns, and can execute business logic and aggregate results according to the scheduling results; on the other hand, when transforming old business systems, it is convenient to disassemble the business, and when expanding new businesses, while fully reusing the original logic, the new logic can be expanded without worrying about affecting the original logic. Therefore, the embodiment of the present invention can effectively decouple the logic code and split the business logic, thereby increasing the reusability and extensibility of the logic code.

[0159] It should be noted that the specific implementation content of the device for processing a call request in the present invention has been described in detail in the method for processing a call request described above, so the repeated content will not be described here.

[0160] Figure 6 An exemplary system architecture 600 is shown to which the method for processing a call request or the apparatus for processing a call request according to an embodiment of the present invention can be applied.

[0161] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0162] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0163] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0164] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results (such as target push information, item information - only an example) to the terminal device.

[0165] It should be noted that the method for processing a call request provided in the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus for processing a call request is generally set in the server 605. The method for processing a call request provided in the embodiment of the present invention can also be executed by the terminal devices 601, 602, and 603, and accordingly, the apparatus for processing a call request can be set in the terminal devices 601, 602, and 603.

[0166] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0167] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0168] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0169] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0170] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0171] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0172] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0173] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a screening module, a routing module, a scheduling module and a return module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.

[0174] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device implements the following method: receiving a call request passed in by an aspect-oriented container framework, filtering out the extension point implementation object to be run according to the routing strategy and the business parameters carried by the call request; assigning a call priority to the extension point implementation object to be run according to the routing priority; calling the extension point implementation object to be run with the call priority according to the concurrency strategy to obtain a scheduling result; running the extension point implementation object to be run based on the scheduling result and the business parameters to obtain a return value.

[0175] According to the technical solution of the embodiment of the present invention, the technical means of obtaining the scheduling result according to the routing strategy, routing priority and concurrency strategy, and then running the extension point implementation object to be run based on the scheduling combination and business parameters to obtain the return value overcomes the technical problem of high coupling of business logic in the prior art. The embodiment of the present invention uses an object-oriented method to split and decouple the inherent logic, and can centrally manage and dynamically change the decoupled extension point implementation objects. On the one hand, the embodiment of the present invention decouples the complex business logic, making coding and maintenance simple, without the need to write complex factory patterns and responsibility chain patterns, and can execute the business logic and aggregate the results according to the scheduling results; on the other hand, when transforming the old business system, it is convenient to disassemble the business, and when expanding the new business, while fully reusing the original logic, the new logic can be expanded without worrying about affecting the original logic. Therefore, the embodiment of the present invention can effectively decouple the logic code and split the business logic, thereby increasing the reusability and extensibility of the logic code.

[0176] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing a call request, characterized in that: include: Receive a call request from the aspect-oriented container framework, and filter out the extension point implementation object to be run according to the routing strategy and the business parameters carried in the call request; The business that needs to be disassembled is called an extension point; According to the routing priority, assigning a calling priority to the extension point implementation object to be run; According to the concurrency strategy, the extension point implementation object to be run that is assigned a calling priority is called to obtain a scheduling result; Based on the scheduling result and the business parameter, running the extension point implementation object to be run, and obtaining a return value; Before receiving the incoming call request from the aspect-oriented container framework, it also includes: Respectively obtain the extension point implementation class corresponding to each extension point interface, parse each of the extension point implementation classes, and obtain configuration information of each of the extension point implementation classes; wherein the configuration information includes routing strategy, routing priority and concurrency strategy; The configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces to obtain each of the extension point implementation objects.

2. The method according to claim 1, characterized in that: Before obtaining the extension point implementation class corresponding to each extension point interface, it also includes: Generate an empty implementation class with aspect-oriented programming annotations corresponding to each extension point interface; Initialize the aspect-oriented container framework; The empty implementation class with the aspect-oriented programming annotations added is injected into the aspect-oriented container framework to obtain the empty implementation objects corresponding to the extension point interfaces.

3. The method according to claim 2, characterized in that For each extension point interface, the following method is used to generate an empty implementation class corresponding to the extension point interface with aspect-oriented programming annotations added: Acquire the extension point interface and obtain interface information of the extension point interface; wherein the interface information includes interface name, method name, input parameter and output parameter; Generate an empty implementation class corresponding to the extension point interface according to the interface information of the extension point interface and using a bytecode editor; The aspect-oriented programming annotation is injected into the empty implementation class, thereby obtaining an empty implementation class with the aspect-oriented programming annotation added.

4. The method according to claim 2, characterized in that: After initializing the aspect-oriented container framework, it also includes: Get the extension point package according to the path of the pre-configured extension point package; Scan the extension point package to obtain each extension point interface; According to each of the extension point interfaces, an information set of each of the extension point interfaces is obtained; wherein the information set includes an interface name, a method name, input parameters, output parameters, and an empty implementation class with aspect-oriented programming annotations added.

5. The method according to claim 2, characterized in that: After initializing the aspect-oriented container framework, it also includes: Specifies the default injected object in the aspect-oriented container framework.

6. The method according to claim 1, characterized in that Get the extension point implementation class corresponding to each extension point interface respectively, including: According to the path of the pre-configured extension point implementation class package, obtain the extension point implementation class package; The extension point implementation class package is scanned to obtain the extension point implementation class corresponding to each extension point interface.

7. The method according to claim 1, characterized in that After obtaining the scheduling result, the method further includes: storing the scheduling result in a cache.

8. The method according to claim 7, characterized in that After storing the scheduling result in the cache, the method further includes: Receiving a business request passed in by the aspect-oriented container framework; wherein the business request has the same business scenario as the calling request; Obtain the scheduling result from the cache; Based on the scheduling result and the service parameters carried in the service request, the extension point implementation object to be run is run to obtain a return value.

9. A device for processing a call request, characterized in that: include: The screening module is used to receive the incoming call request from the aspect-oriented container framework, and screen out the extension point implementation objects to be run according to the routing strategy and the business parameters carried by the call request; the business to be disassembled is called the extension point; A routing module, used for assigning a calling priority to the extension point implementation object to be run according to the routing priority; A scheduling module, used for calling the extension point implementation object to be run and given a calling priority according to a concurrency strategy, to obtain a scheduling result; A return module, used to run the extension point implementation object to be run based on the scheduling result and the business parameter, and obtain a return value; The screening module is also used for: Before receiving the incoming call request from the aspect-oriented container framework, respectively obtain the extension point implementation class corresponding to each extension point interface, parse each of the extension point implementation classes, and obtain the configuration information of each of the extension point implementation classes; wherein the configuration information includes routing strategy, routing priority and concurrency strategy; The configuration information of each of the extension point implementation classes is injected into the empty implementation object corresponding to each of the extension point interfaces to obtain each of the extension point implementation objects.

10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • AOP (Aspect Oriented Programming) implementation method of EJB 3 (Enterprise Java Beans 3) containers based on dynamic stack

    CN102508668A

  • Event priority scheduling-based complex event detection method

    CN105955814A

  • Remote procedure call processing method used for distributed system and remote procedure call processing system thereof

    CN106713226A

  • Data source routing management method and device

    CN110765187A

  • Selection services component for an extensible editor

    US7444587B1