A routing control method and device for interface interaction
By listening to server-side interface call requests and selecting appropriate channels for data interaction based on interface type and access information, the system crash problem caused by server-side interface anomalies was resolved, achieving rational resource utilization and system stability.
Patent Information
- Application Number
- CN202111599671.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2041-12-24
AI Technical Summary
Current technology cannot distinguish which server-side interfaces can be called normally and which server-side interfaces are abnormal, leading to access timeouts and system crashes.
By listening to the call requests of the server-side interface, querying the routing rules according to the interface type, and using the interface access information to select the appropriate channel from the preset channel set for data interaction, the system distinguishes between fast channels and blocked channels to ensure the rational use of resources.
It enables automatic channel allocation based on the stability of the server-side interface, reducing resource blocking and occupation, and improving system stability and call success rate.
Smart Images

Figure CN114490114B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a routing control method and apparatus for interface interaction. Background Technology
[0002] In the process of building a platform-based service system, it is usually necessary to connect to multiple servers (or interface providers), and the system and the servers transmit data via network protocols. In existing technologies, the system interacts with the servers over the internet by using connection pools and third-party tools to manage HTTP requests, which are used to send data to the servers.
[0003] In implementing this invention, the prior art has at least the following problems:
[0004] When using public interfaces to call different server interfaces for data interaction, existing technology cannot distinguish which server interfaces can be called normally and which server interfaces are abnormal. This can lead to access timeouts caused by abnormal server interfaces, the system's available connections being filled, subsequent requests being unable to be processed, and even system crashes. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a routing control method and apparatus for interface interaction. The method queries routing rules based on the interface type of the server interface in the call request, and then uses the routing rules and the pre-acquired interface access information of the server interface to determine the target channel to be used for data interaction. This enables the call request to be allocated to the appropriate channel for processing, thereby achieving reasonable utilization of resources.
[0006] To achieve the above objectives, according to one aspect of the present invention, a routing control method for interface interaction is provided.
[0007] An embodiment of the present invention provides a routing control method for interface interaction, comprising: listening to a call request from a public interface to a server interface; querying a matching routing rule based on the interface type of the server interface in the call request; selecting a channel from a preset channel set based on the routing rule and the interface access information of the server interface; and using the selected channel as the target channel for data interaction between the public interface and the server interface; wherein the interface access information is obtained by accessing the server interface through a channel in the channel set; and using the target channel for data interaction between the public interface and the server interface.
[0008] Optionally, the routing rule is used to set the value range of the evaluation parameter, and the interface access information includes the parameter value of the evaluation parameter corresponding to the channel; the step of selecting a channel from a preset channel set according to the routing rule and the interface access information of the server interface, and using the selected channel as the target channel used for data interaction between the public interface and the server interface, includes: comparing the parameter value of the evaluation parameter corresponding to the channel in the channel set with the corresponding value range, so as to filter out the channel whose parameter value is within the value range from the channel set, and add it to the candidate channel set; selecting a channel from the candidate channel set as the target channel used for data interaction between the public interface and the server interface.
[0009] Optionally, the channel type includes fast channels and blocked channels; selecting a channel from the candidate channel set as the target channel for data interaction between the public interface and the server interface includes: selecting a channel from the fast channels in the candidate channel set as the target channel for data interaction between the public interface and the server interface; the method further includes: when the parameter value of the evaluation parameter corresponding to the channel in the channel set is outside the corresponding value range, selecting a channel from the blocked channels in the channel set as the target channel for data interaction between the public interface and the server interface.
[0010] Optionally, the method further includes: obtaining the interface access information; and if obtaining the interface access information fails, randomly selecting a channel from the channel set as the initial channel used for data interaction between the public interface and the server interface.
[0011] Optionally, the method further includes: if the interface access information is successfully obtained, comparing the performance difference between the initial channel and the target channel according to the set access parameters, the interface access information corresponding to the initial channel and the interface access information corresponding to the target channel, and obtaining a comparison result; and determining whether the target channel needs to be replaced with the initial channel based on the comparison result.
[0012] Optionally, the method further includes: obtaining interface access information of the server interface that occupies the blocked channel for data interaction as access information to be processed; comparing the access information to be processed with pre-configured multi-level alarm conditions, and performing corresponding alarm processing if the access information to be processed meets the alarm conditions of the corresponding level.
[0013] Optionally, obtaining the interface access information includes: querying preset configuration information to obtain the connection information of the server interface; accessing the server interface according to the connection information of the server interface, and receiving the interface access information returned by the server interface.
[0014] To achieve the above objectives, according to another aspect of the present invention, a routing control device for interface interaction is provided.
[0015] An embodiment of the present invention provides a routing control device for interface interaction, comprising: a rule query module, configured to listen for call requests from a public interface to a server interface, and query matching routing rules based on the interface type of the server interface in the call request; a channel selection module, configured to select a channel from a preset channel set based on the routing rules and the interface access information of the server interface, and use the selected channel as the target channel for data interaction between the public interface and the server interface; wherein the interface access information is obtained by accessing the server interface through a channel in the channel set; and a data interaction module, configured to use the target channel for data interaction between the public interface and the server interface.
[0016] Optionally, the routing rules are used to set the value range of the evaluation parameters, and the interface access information includes the parameter value of the evaluation parameter corresponding to the channel; the channel selection module is further used to compare the parameter value of the evaluation parameter corresponding to the channel in the channel set with the corresponding value range, so as to filter out the channel whose parameter value is within the value range from the channel set and add it to the candidate channel set; select a channel from the candidate channel set as the target channel used for data interaction between the public interface and the server interface.
[0017] Optionally, the channel type includes a fast channel and a blocked channel; the channel selection module is further configured to select a channel from the fast channels in the candidate channel set as the target channel used for data interaction between the public interface and the server interface; the device further includes: a blocked channel selection module, configured to select a channel from the blocked channels in the channel set as the target channel used for data interaction between the public interface and the server interface when the parameter value of the evaluation parameter corresponding to the channel in the channel set is outside the corresponding value range.
[0018] Optionally, the device further includes: an initial channel selection module, used to acquire the interface access information; and in the event that the acquisition of the interface access information fails, to randomly select a channel from the channel set as the initial channel used for data interaction between the public interface and the server interface.
[0019] Optionally, the device further includes: a channel update module, configured to, upon successful acquisition of the interface access information, compare the performance difference between the initial channel and the target channel based on the set access parameters, the interface access information corresponding to the initial channel, and the interface access information corresponding to the target channel, and obtain a comparison result; and determine, based on the comparison result, whether the target channel needs to be replaced with the initial channel.
[0020] Optionally, the device further includes: an alarm module, used to acquire interface access information of the server interface that occupies the blocked channel for data interaction as access information to be processed; compare the access information to be processed with pre-configured multi-level alarm conditions, and perform corresponding alarm processing if the access information to be processed meets the alarm conditions of the corresponding level.
[0021] Optionally, the initial channel selection module is further configured to query preset configuration information to obtain the connection information of the server interface; access the server interface according to the connection information of the server interface, and receive the interface access information returned by the server interface.
[0022] To achieve the above objectives, according to another aspect of the present invention, an electronic device is provided.
[0023] An electronic device according to an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a routing control method for interface interaction according to an embodiment of the present invention.
[0024] To achieve the above objectives, according to another aspect of the present invention, a computer-readable medium is provided.
[0025] An embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a routing control method for interface interaction according to an embodiment of the present invention.
[0026] One embodiment of the above invention has the following advantages or beneficial effects: based on the interface type of the server interface in the call request, the routing rules are queried, and then the target channel to be occupied by the data interaction is determined by using the routing rules and the interface access information of the server interface that is pre-acquired. This enables the call request to be allocated to the appropriate channel for processing, thus realizing the rational utilization of resources.
[0027] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0028] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0029] Figure 1 This is a schematic diagram of the main steps of a routing control method for interface interaction according to an embodiment of the present invention;
[0030] Figure 2 This is a schematic diagram illustrating the implementation principle of a routing control method for interface interaction according to an embodiment of the present invention;
[0031] Figure 3 This is a schematic diagram of the data processing flow of the timer processor in the routing control method for interface interaction according to an embodiment of the present invention;
[0032] Figure 4 This is a schematic diagram of the data processing flow of the routing rule engine in the routing control method for interface interaction according to an embodiment of the present invention;
[0033] Figure 5 This is a schematic diagram of the data processing flow of the interface call processor in the routing control method for interface interaction according to an embodiment of the present invention;
[0034] Figure 6 This is a schematic diagram of the main modules of a routing control device for interface interaction according to an embodiment of the present invention;
[0035] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0036] Figure 8 This is a schematic diagram of the structure of a computer device suitable for implementing electronic devices according to embodiments of the present invention. Detailed Implementation
[0037] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0038] As described in the background section, in existing technologies, when a system uses a public interface to call different server-side interfaces for data interaction, it is impossible to distinguish which server-side interfaces can be called normally and which are abnormal. This can lead to situations where access timeouts occur due to abnormal server-side interfaces, the system's available connections are exhausted, subsequent requests cannot be processed, and it may even cause the system to crash. Here, the public interface refers to an application programming interface (API) that can access different server-side interfaces.
[0039] For example, if a business system uses the same interface to connect with multiple insurance companies for underwriting, meaning the same interface is provided to multiple insurance companies, and it is impossible to distinguish which insurance companies' systems are stable, which insurance companies' systems are being upgraded, or which insurance companies' systems are abnormal and cannot be accessed, access timeouts may occur due to abnormal system interfaces of insurance companies, the available connections of the business system may be exhausted, subsequent requests may not be processed, and the business system may crash.
[0040] To address the aforementioned high-concurrency, distributed access scenarios, this embodiment provides a routing control method for interface interaction. This method can allocate channels for call requests based on the actual situation of the server, ensuring the rational use of system resources and the normal operation of the system. The details are as follows.
[0041] Figure 1 This is a schematic diagram illustrating the main steps of a routing control method for interface interaction according to an embodiment of the present invention. Figure 1 As shown in the figure, the routing control method for interface interaction according to an embodiment of the present invention mainly includes the following steps:
[0042] Step S101: Listen for calls from the public interface to the server interface. Based on the interface type of the server interface in the call request, query the matching routing rules. Listen for calls from the public interface to the server interface, where the call request includes the interface type of the requested server interface. After detecting a call request from the public interface to a specific server interface, parse the call request to obtain the interface type of the server interface. Since different interface types correspond to their own routing rules, the matching routing rules can be retrieved based on the interface type.
[0043] In this embodiment, the interface type is related to specific business operations, such as underwriting interface, insurance coverage interface, renewal interface, insurance renewal interface, and insurance cancellation interface. The routing rules are used to set access restriction information corresponding to each interface type. This access restriction information can be a range of values for evaluation parameters, such as status codes or access durations.
[0044] Step S102: Based on the routing rules and the interface access information of the server interface, select a channel from a preset channel set, and use the selected channel as the target channel for data interaction between the public interface and the server interface. The interface access information is obtained by accessing the server interface using a channel from the channel set. That is, the server interface is accessed using a channel from the channel set beforehand, and the information returned by the server interface is the interface access information. In this embodiment, the interface access information may include the parameter values of the evaluation parameters corresponding to the channel.
[0045] After finding the matching routing rules and obtaining the interface access information of the server interface, the parameter value of the same evaluation parameter in the interface access information can be compared with the corresponding value range in the routing rules. Based on the comparison results, a channel whose parameter value is within the value range is selected from the channel set, and this channel is used as the target channel for data interaction between the public interface and the server interface.
[0046] Step S103: Use the target channel to perform data interaction between the public interface and the server interface. The public interface and the server interface use the target channel to interact with each other, that is, to send the call request to the server interface through the target channel, and at the same time receive the data returned by the server interface through the target channel. In this way, the call request is assigned to the appropriate channel for processing, achieving reasonable utilization of resources.
[0047] Figure 2 This is a schematic diagram illustrating the implementation principle of a routing control method for interface interaction according to an embodiment of the present invention. Figure 2 As shown, the routing control method of this embodiment is implemented by a routing control device, which includes three parts: a timing processor, a routing rule engine, and an interface call processor. The timing processor is mainly used to periodically poll and check the operational status of the server-side interface. Specifically, it can query preset configuration information according to the interface type to obtain the connection information of the server-side interface. Then, based on the connection information, it accesses the server-side interface (e.g., by sending a heartbeat request) and receives the interface access information returned by the server-side interface, which represents the operational status of the server-side interface.
[0048] The routing rule engine is primarily used to determine the appropriate channel for a server-side interface based on its operational status. The interface call handler is mainly responsible for using the selected channel to complete data exchange between interfaces. There are two channel types: fast channels and blocking channels. Fast channels have opposite configurations to blocking channels; fast channels have shorter timeouts and more threads in their thread pools than blocking channels. To reduce resource congestion and consumption, servers with normal service can use fast channels for data exchange, while servers with service malfunctions can use blocking channels.
[0049] Figure 3 This is a schematic diagram of the data processing flow of the timer processor in the routing control method for interface interaction according to an embodiment of the present invention. Figure 3 As shown, the data processing flow of the timer processor in this embodiment of the invention is implemented by a timer unit and a configuration unit, and mainly includes the following steps:
[0050] Step S301: The scheduled task of the timing unit is triggered, sending a query request to the configuration unit. The configuration unit contains configuration information for the server interfaces to be detected, such as interface type, connection information, and interface identifier. Connection information can be IP address, port, and access path. Configuration information can be stored in configuration files, database tables, cache, or memory.
[0051] In this embodiment, a timer trigger can be configured to initiate the scheduled task. This trigger can be Spring's Quartz timer or a third-party tool such as easyJob or elasticJob. When the scheduled task is triggered, the timing unit sends a query request to the configuration unit. This query request includes the interface type of the server-side interface and is used to query configuration information related to that interface type. Both easyJob and elasticJob are distributed task invocation systems.
[0052] Preferably, locking can be added to the scheduled tasks, such as with distributed locks, to ensure that the resources used by the scheduled tasks are executed only once. Distributed locking can be implemented in several ways. For example, it can be done using a Redis caching tool; another approach is to use a database-first-update-then-process principle, where the thread that successfully updates the database processes the data, while others return failed data; yet another approach is to rely on EasyJob for sharding, where each thread only processes data belonging to its own shard.
[0053] Step S302: The configuration unit returns the connection information of the corresponding server interface to the timing unit according to the interface type in the query request.
[0054] Step S303: The timing unit queries the corresponding server-side interface using distributed scheduling based on the connection information. Distributed scheduling can be implemented using easyJob. easyJob partitions the database tables according to business logic, for example, dividing all data into 100 partitions and then creating 10 shards for multi-threaded calls. According to the configuration, each shard task will fall into one of the 10 database partitions for data processing. For example, shard 1 processes data from partitions 1, 11, 21, 31, 41, 51, 61, 71, 81, and 91, and so on. If 100 shards are created, each shard task processes data from one partition. The number of partitions and shards can be configured according to actual needs.
[0055] Step S304: The timing unit receives the interface access information returned by the server interface, encapsulates the interface access information, and sends the encapsulation result to the routing rule engine. The interface access information includes the status code obtained from accessing the server interface, the interface return duration, etc. The status code indicates whether the server interface is operating normally.
[0056] In the above process, the timer processor accesses each server interface periodically using the interface type, connection information, and interface identifier in the configuration information, and returns the interface access information, such as the status code and return time information, to the routing rule engine for processing. It is understandable that... Figure 3 This is only to illustrate that the timer needs to interact with the relevant interfaces on the server side; the server side is not part of the timer.
[0057] Figure 4 This is a schematic diagram of the data processing flow of the routing rule engine in the routing control method for interface interaction according to an embodiment of the present invention. Figure 4 As shown, the data processing flow of the routing rule engine in this embodiment of the invention mainly includes the following steps:
[0058] Step S401: Listen for network requests from the interface call handler. If a message queue is used, the network request is a call request; if a remote call or HTTP call is used, the network request is an access request.
[0059] Step S402: Based on the interface type of the server interface in the network request, query the matching routing rules. In this embodiment, the routing rules are used to set the value range of evaluation parameters such as status codes and access duration. Specifically, the status code range includes non-abnormal status codes, while abnormal status codes include 404, 405, etc.; the access duration range is, for example, less than 5000 milliseconds.
[0060] Step S403: Based on the routing rules and the interface access information of the server interface, select at least one channel from the preset channel set, and use the selected channel as the target channel for data interaction between the public interface and the server interface.
[0061] Specifically, if the routing rule engine successfully obtains the interface access information of the specified interface type in the network request, this step needs to compare the parameter value of the evaluation parameter corresponding to the channel in the channel set with the corresponding value range, so as to filter out the channel whose parameter value is outside the value range from the channel set and add it to the candidate channel set; then the channel in the candidate channel set is used as the target channel for data interaction between the public interface and the server interface.
[0062] Taking status code and access duration as evaluation parameters as an example, this step involves comparing the status code corresponding to each channel in the channel set with the value range of the status code in the routing rules to filter out channels whose status codes fall within the corresponding value range from the channel set and add them to the intermediate channel set; then, comparing the access duration corresponding to the channels in the intermediate channel set with the value range of the access duration in the routing rules to filter out channels whose access duration falls within the corresponding value range from the candidate channel set and add them to the candidate channel set; finally, the channels in the candidate channel set are used as target channels for data interaction between the public interface and the server interface.
[0063] If the routing rules engine fails to obtain (i.e. fails to obtain) the interface access information for the specified interface type in the network request, it indicates that the interface type is a newly configured interface type. In this case, a channel can be randomly selected from the channel set as the initial channel used for data interaction between the public interface and the server interface.
[0064] Step S404: Check if engine rule data exists on the current server. If it does not exist, proceed to step S405; if it exists, proceed to step S406. Engine rule data may include interface type, service provider, interface access information, channel, cumulative number of interface access timeouts, number of exception status code returns, etc. If the access duration is outside the corresponding value range, the interface access is considered to have timed out.
[0065] Step S405: Store the target channel in the engine rule data to end this process. The storage location can be a database, cache, etc.
[0066] Step S406: Compare the existing channel in the engine rule data with the target channel. Based on the comparison result, determine whether the channel needs to be changed, and if it is determined that the channel needs to be changed, then change the channel. If it is the second time a network request is detected, then the channel is the initial channel; if the number of network requests detected is greater than 2, then the channel is the target channel obtained in the previous step.
[0067] Taking the comparison between the initial channel and the target channel as an example, this step requires comparing the performance differences between the initial channel and the target channel based on the set access parameters, the interface access information corresponding to the initial channel, and the interface access information corresponding to the target channel, to obtain the comparison result. Then, based on the comparison result, it is determined whether the target channel needs to be replaced with the initial channel.
[0068] Access parameters can include, for example, interface access duration, status code, and error message. For instance, if the access duration of the initial channel is greater than that of the target channel, it indicates that the target channel performs better than the initial channel, and therefore no replacement is needed. In this embodiment, the usage count of each channel is accumulated and saved as a reference for future calls.
[0069] Figure 5 This is a schematic diagram of the data processing flow of the interface call processor in the routing control method for interface interaction according to an embodiment of the present invention. Figure 5 As shown, the data processing flow of the interface call processor in this embodiment of the invention includes a core unit and mainly includes the following steps:
[0070] Step S501: The core unit sends a call request to the routing rule engine. The call request includes the interface type of the server interface.
[0071] Step S502: The routing rule engine checks whether there is corresponding engine rule data based on the call request. If it exists, the engine rule data is returned to the core unit; if it does not exist, the default engine rule data is returned to the core unit.
[0072] Step S503: The core unit determines the final channel based on the returned target channel and interface access information to enable data interaction between the public interface and the server interface. If the evaluation parameter values corresponding to the channels in the channel set are within the appropriate range, a channel is selected from the fast channels in the candidate channel set as the target channel (i.e., the final channel) used for data interaction between the public interface and the server interface.
[0073] If multiple service requests use a single thread pool connection simultaneously, a slow response from one service request will occupy a connection in the thread pool, preventing other service requests from obtaining thread processing, thus causing blocking and impacting overall system performance. Therefore, in this embodiment, if the parameter value of the evaluation parameter corresponding to a channel in the channel set is outside the corresponding value range, it is considered that the blocking condition has been met, and a channel can be selected from the blocked channels in the channel set as the target channel (i.e., the final channel) used for data interaction between the public interface and the server interface.
[0074] The above processing allows servers with fast response times and stable systems to interact with data via a fast channel, while servers with slow response times and unstable systems can interact via a blocking channel. The blocking channel is configured with a longer timeout and a smaller thread pool, the timeout duration and thread pool size being the opposite of the fast channel, to reduce resource consumption. Preferably, if the blocking reaches a configured blocking threshold, the call can be blocked entirely.
[0075] In one embodiment, alarm configuration can be applied to server interfaces using blocked channels to promptly notify relevant personnel for handling. Specifically, the interface access information of server interfaces using blocked channels for data interaction is obtained as pending access information. Then, the pending access information is compared with pre-configured multi-level alarm conditions. If the pending access information meets the alarm conditions of the corresponding level, appropriate alarm processing is performed. The multi-level alarm conditions can be formulated based on factors such as interface call volume and access duration.
[0076] In this embodiment, when interfaces are shared, the stability of different server-side interfaces can be differentiated, and the appropriate channel for data interaction can be determined based on the stability of the server-side interfaces. Furthermore, the system can automatically assess whether the current server is suitable for continued calls based on the range of routing rules, thereby reducing resource consumption caused by data interaction. Simultaneously, a fast channel can be allocated to servers with fast request response times and stable systems, while a blocking channel can be allocated to servers with slow request response times and unstable systems. This ensures that calls from multiple servers do not interfere with each other, reduces resource congestion and consumption caused by shared channels, and improves the success rate of calls.
[0077] Figure 6 This is a schematic diagram of the main modules of a routing control device for interface interaction according to an embodiment of the present invention. Figure 6 As shown, the routing control device 600 for interface interaction in this embodiment of the invention mainly includes:
[0078] The rule query module 601 is used to listen for calls from the public interface to the server interface, and to query matching routing rules based on the interface type of the server interface in the call request. The module listens for calls from the public interface to the server interface, and these calls include the interface type of the requested server interface. After detecting a call request from the public interface to a specific server interface, the module parses the call request to obtain the interface type of the server interface. Since different interface types correspond to their own routing rules, the module can then query and obtain matching routing rules based on the interface type.
[0079] In this embodiment, the interface type is related to specific business operations, such as underwriting interface, insurance coverage interface, renewal interface, insurance renewal interface, and insurance cancellation interface. The routing rules are used to set access restriction information corresponding to each interface type. This access restriction information can be a range of values for evaluation parameters, such as status codes or access durations.
[0080] The channel selection module 602 is used to select a channel from a preset channel set according to the routing rules and the interface access information of the server interface, and to use the selected channel as the target channel for data interaction between the public interface and the server interface. The interface access information is obtained by accessing the server interface using a channel from the channel set. That is, the server interface is accessed using a channel from the channel set beforehand, and the information returned by the server interface is the interface access information. In this embodiment, the interface access information may include the parameter values of the evaluation parameters corresponding to the channel.
[0081] After finding the matching routing rules and obtaining the interface access information of the server interface, the parameter value of the same evaluation parameter in the interface access information can be compared with the corresponding value range in the routing rules. Based on the comparison results, a channel whose parameter value is within the value range is selected from the channel set, and this channel is used as the target channel for data interaction between the public interface and the server interface.
[0082] The data interaction module 603 is used to perform data interaction between the public interface and the server interface using the target channel. The public interface and the server interface interact using the target channel, that is, the call request is sent to the server interface through the target channel, and the data returned by the server interface is received through the same target channel. This ensures that the call request is assigned to the appropriate channel for processing, achieving efficient resource utilization.
[0083] In addition, the routing control device 600 for interface interaction in this embodiment of the invention may further include: a blocking channel selection module, an initial channel selection module, a channel update module, and an alarm module. Figure 6 (Not shown in the image). The blocking channel selection module is used to select a channel from the blocked channels in the channel set as the target channel for data interaction between the public interface and the server interface when the parameter values of the evaluation parameters corresponding to the channels in the channel set are outside the corresponding value range.
[0084] An initial channel selection module is used to obtain the interface access information; if the interface access information fails to be obtained, a channel is randomly selected from the channel set as the initial channel used for data interaction between the public interface and the server interface.
[0085] The channel update module is used to, when the interface access information is successfully obtained, compare the performance difference between the initial channel and the target channel according to the set access parameters, the interface access information corresponding to the initial channel and the interface access information corresponding to the target channel, and obtain a comparison result; and determine whether the target channel needs to be replaced with the initial channel based on the comparison result.
[0086] The alarm module is used to acquire interface access information of the server interface occupying the blocked channel for data interaction as pending access information; it compares the pending access information with pre-configured multi-level alarm conditions, and performs corresponding alarm processing if the pending access information meets the alarm conditions of the corresponding level. As can be seen from the above description, based on the interface type of the server interface in the call request, routing rules are queried, and then the target channel to be occupied by the data interaction is determined using the routing rules and the pre-acquired interface access information of the server interface. This allows the call request to be allocated to the appropriate channel for processing, achieving rational utilization of resources.
[0087] Figure 7 An exemplary system architecture 700 is shown, to which the routing control method or routing control device for interface interaction of embodiments of the present invention can be applied.
[0088] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, and 703, networks 704 and 706, and servers 705 and 707. Network 704 serves as the medium for providing a communication link between terminal devices 701, 702, and 703 and server 705. Network 706 serves as the medium for providing a communication link between server 705 and server 707. Networks 704 and 706 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0089] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc. Terminal devices 701, 702, and 703 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0090] Server 705 can be a server that provides various services, such as a backend management server that processes call requests sent by administrators using terminal devices 701, 702, and 703. The backend management server can query routing rules, select target channels, and interact with server 707, and then feed back the processing results (such as data interaction results) to the terminal devices.
[0091] It should be noted that the routing control method for interface interaction provided in this application embodiment is generally executed by server 705, and correspondingly, the routing control device for interface interaction is generally set in server 705.
[0092] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0093] According to embodiments of the present invention, the present invention also provides an electronic device and a computer-readable medium.
[0094] The electronic device of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a routing control method for interface interaction according to an embodiment of the present invention.
[0095] The present invention provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements a routing control method for interface interaction according to an embodiment of the present invention.
[0096] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 800 suitable for implementing an electronic device according to embodiments of the present invention. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0097] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the computer system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0098] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0099] In particular, according to embodiments disclosed in this invention, the processes described in the above main step diagrams can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the main step diagrams. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.
[0100] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0101] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0102] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor may be described as including a rule query module, a channel selection module, and a data interaction module. The names of these modules do not necessarily limit the module itself; for example, the rule query module may also be described as "a module that listens for calls from a public interface to a server interface and queries matching routing rules based on the interface type of the server interface in the call request."
[0103] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: listening for calls from a public interface to a server interface; querying matching routing rules based on the interface type of the server interface in the call request; selecting a channel from a preset channel set based on the routing rules and the interface access information of the server interface; and using the selected channel as the target channel for data interaction between the public interface and the server interface; wherein the interface access information is obtained by accessing the server interface through a channel in the channel set; and using the target channel for data interaction between the public interface and the server interface.
[0104] According to the technical solution of the present invention, based on the interface type of the server interface in the call request, the routing rules are queried, and then the target channel to be occupied by the data interaction is determined by using the routing rules and the interface access information of the server interface that is pre-acquired. This enables the call request to be allocated to the appropriate channel for processing, thereby achieving the rational utilization of resources.
[0105] The above-described product can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0106] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A routing control method for interface interaction, characterized in that, include: Listen for calls from the public interface to the server interface, and query the matching routing rules based on the interface type of the server interface in the call request; different interface types have their own routing rules. Based on the routing rules and the interface access information of the server interface, a channel is selected from a preset channel set, and the selected channel is used as the target channel for data interaction between the public interface and the server interface; wherein, the interface access information is obtained by accessing the server interface through the channel of the channel set; The target channel is used to perform data interaction between the public interface and the server interface; The method further includes: Obtain the interface access information; If the interface access information fails to be obtained, a channel is randomly selected from the channel set as the initial channel used for data interaction between the public interface and the server interface. If the interface access information is successfully obtained, the performance difference between the initial channel and the target channel is compared based on the set access parameters, the interface access information corresponding to the initial channel, and the interface access information corresponding to the target channel, and a comparison result is obtained. Based on the comparison results, it is determined whether the target channel needs to be replaced with the initial channel.
2. The method according to claim 1, characterized in that, The routing rules are used to set the value range of the evaluation parameters, and the interface access information includes the parameter values of the evaluation parameters corresponding to the channel. The step of selecting a channel from a preset channel set based on the routing rules and the interface access information of the server interface, and using the selected channel as the target channel for data interaction between the public interface and the server interface, includes: The parameter values of the evaluation parameters corresponding to the channels in the channel set are compared with the corresponding value ranges to filter out the channels whose parameter values are within the value ranges and add them to the candidate channel set. One channel is selected from the candidate channel set as the target channel for data interaction between the public interface and the server interface.
3. The method according to claim 2, characterized in that, The channel types include fast channels and blocking channels; Selecting a channel from the candidate channel set as the target channel for data interaction between the public interface and the server interface includes: Select one channel from the fast channels of the candidate channel set as the target channel used for data interaction between the public interface and the server interface; The method further includes: when the parameter value of the evaluation parameter corresponding to the channel in the channel set is outside the corresponding value range, selecting a channel from the blocked channels in the channel set as the target channel used for data interaction between the public interface and the server interface.
4. The method according to claim 3, characterized in that, The method further includes: Obtain the interface access information of the server interface that is using the blocked channel for data interaction as access information to be processed; The access information to be processed is compared with the pre-configured multi-level alarm conditions. If the access information to be processed meets the alarm conditions of the corresponding level, the corresponding alarm processing is performed.
5. The method according to claim 1, characterized in that, The process of obtaining the interface access information includes: Query the preset configuration information to obtain the connection information of the server interface; Based on the link information of the server interface, access the server interface and receive the interface access information returned by the server interface.
6. A routing control device for interface interaction, characterized in that, include: The rule query module is used to listen for calls from the public interface to the server interface, and query the matching routing rules based on the interface type of the server interface in the call request; different interface types have their own routing rules. The channel selection module is used to select a channel from a preset channel set according to the routing rules and the interface access information of the server interface, and use the selected channel as the target channel used for data interaction between the public interface and the server interface; wherein, the interface access information is obtained by accessing the server interface through the channel of the channel set; The data interaction module is used to perform data interaction between the public interface and the server interface using the target channel; An initial channel selection module is used to obtain the interface access information; if the interface access information fails to be obtained, a channel is randomly selected from the channel set as the initial channel used for data interaction between the public interface and the server interface. The channel update module is used to, when the interface access information is successfully obtained, compare the performance difference between the initial channel and the target channel according to the set access parameters, the interface access information corresponding to the initial channel and the interface access information corresponding to the target channel, and obtain a comparison result; and determine whether the target channel needs to be replaced with the initial channel based on the comparison result.
7. An electronic device, characterized in that, include: One or more processors; 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 as described in any one of claims 1-5.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
A method and apparatus for determining a payment channel
CN109447610A
Method and system for processing payment request message and storage medium
CN110765164A