CN109635019B - Request processing method, device, equipment and storage medium - Google Patents

Request processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN109635019B
CN109635019B CN201811246136.5A CN201811246136A CN109635019B CN 109635019 B CN109635019 B CN 109635019B CN 201811246136 A CN201811246136 A CN 201811246136A CN 109635019 B CN109635019 B CN 109635019B
Authority
CN
China
Prior art keywords
request
interface
protocol type
path
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811246136.5A
Other languages
Chinese (zh)
Other versions
CN109635019A (en
Inventor
张鹏
谢鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811246136.5A priority Critical patent/CN109635019B/en
Publication of CN109635019A publication Critical patent/CN109635019A/en
Application granted granted Critical
Publication of CN109635019B publication Critical patent/CN109635019B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a request processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set; when the request protocol type belongs to a preset protocol type set, reading a request path contained in an interface call request; the method for processing the request detects whether the request protocol type corresponding to the request belongs to a preset protocol type set or not when any request is received, if so, the service logic object for carrying out subsequent request processing is determined according to the request path contained in the request, and compared with the existing one-to-one mapping request response mode, the method can effectively avoid response blocking caused by single protocol data transmission errors, and improves the request processing fault tolerance and processing efficiency.

Description

Request processing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a request.
Background
At present, with the rapid development of internet technology, many internet enterprises with wider service coverage design corresponding service management platforms to perform unified management on physical/virtual resources and service resources related to services. Such service management platforms are typically implemented using a representational state transfer (Representational State Transfer, REST) software architecture style, all of which are provided through REST interfaces, and associated external systems or third party users interface with the host system in which the service management platform is located through different transport protocols (e.g., HTTP or HTTPs) to obtain corresponding resources. However, in practice, since the services related to the associated external systems are different, the protocol type methods used when the interface call request is transmitted are different. Aiming at the problems, platform developers usually adopt a one-to-one mapping mode to ensure the normal response of a main system to various request calls, but the mode has the defects that when the main system faces a large number of call requests which are high in concurrency and different in protocol type, the processing efficiency is too slow, the response is not timely due to easy data blocking, and the risk and instability of downtime of the system are increased.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a request processing method, a device, equipment and a storage medium, and aims to solve the technical problems that the processing efficiency is too slow and the response is not timely when a large number of call requests of different protocol types are faced in the prior art.
To achieve the above object, the present invention provides a request processing method, including the steps of:
receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set;
when the request protocol type belongs to the preset protocol type set, a request path contained in the interface call request is read;
and searching a business logic object corresponding to the request path in a database, and sending the interface calling request to the business logic object.
Preferably, before the step of searching the database for the service logic object corresponding to the request path, the method further includes:
reading interface parameters contained in the request path, and determining object query parameters according to service identifiers and interface identifiers contained in the interface parameters;
the step of searching the business logic object corresponding to the request path in the database comprises the following steps:
and searching the business logic object corresponding to the object query parameter in the mapping relation stored in the database, wherein the mapping relation stores the corresponding relation between the object query parameter and the business logic object.
Preferably, the step of determining the object query parameter according to the service identifier and the interface identifier included in the interface parameter includes:
reading a service identifier and an interface identifier contained in the interface parameter, and searching a target node corresponding to the service identifier according to a pre-established service logic tree structure;
and acquiring an interface path set corresponding to the target node, determining a target path from the interface path set according to the interface identifier, and taking the target path as an object query parameter.
Preferably, before the step of receiving an interface call request, obtaining a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set, the method further includes:
acquiring service objects to be classified, and performing service logic classification on the service objects by adopting a tangent plane-oriented programming technology to acquire a plurality of service logic objects;
reading a service identifier carried in the service logic object, and determining a service class to which the service logic object belongs according to the read service identifier;
and establishing a service logic tree structure by taking the service identifier corresponding to each service logic object as a child node and the service class as a father node.
Preferably, the step of receiving an interface call request and obtaining a request protocol type corresponding to the interface call request includes:
when receiving an interface call request, intercepting the interface call request, and performing cross-domain access detection on the interface call request;
and when the interface call request is detected to belong to the cross-domain access request, acquiring a request protocol type corresponding to the interface call request.
Preferably, the step of receiving an interface call request and performing cross-domain access detection on the interface call request includes:
receiving an interface call request, acquiring a request path corresponding to the interface call request, and reading a domain name field and a port field from the request path;
detecting whether the domain name field is the same as the domain name field corresponding to the local domain name and/or detecting whether the port field is the same as the port field corresponding to the local port;
and if the domain name field is different from the domain name field corresponding to the local domain name and/or the port field is different from the port field corresponding to the local port, judging that the interface call request belongs to a cross-domain access request.
Preferably, after the step of receiving an interface call request and performing cross-domain access detection on the interface call request, the method further includes:
when the interface call request is detected not to belong to the cross-domain access request, acquiring a request parameter and a request path contained in the interface call request;
and determining a target interface to be called according to the request path, and sending the request parameter to a target service logic object corresponding to the target interface to be called, so that the target service logic object obtains parameter output data according to the request parameter and feeds back the parameter output data.
In addition, in order to achieve the above object, the present invention also proposes a request processing apparatus, the apparatus comprising:
the request receiving module is used for receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set;
the protocol detection module is used for reading a request path contained in the interface call request when the request protocol type belongs to the preset protocol type set;
and the object searching module is used for searching the service logic object corresponding to the request path in the database and sending the interface calling request to the service logic object.
In addition, to achieve the above object, the present invention also proposes a request processing apparatus, the apparatus comprising: a memory, a processor, and a request processing program stored on the memory and executable on the processor, the request processing program configured to implement the steps of the request processing method as described above.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having stored thereon a request processing program which, when executed by a processor, implements the steps of the request processing method as described above.
The method comprises the steps of obtaining a request protocol type corresponding to an interface call request by receiving the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set; when the request protocol type belongs to a preset protocol type set, reading a request path contained in an interface call request; the method for processing the request detects whether the request protocol type corresponding to the request belongs to a preset protocol type set or not when any request is received, if so, the service logic object for carrying out subsequent request processing is determined according to the request path contained in the request, and compared with the existing one-to-one mapping request response mode, the method can effectively avoid response blocking caused by single protocol data transmission errors, and improves the request processing fault tolerance and processing efficiency.
Drawings
FIG. 1 is a schematic diagram of a request processing device of a hardware runtime environment according to an embodiment of the present invention;
FIG. 2 is a flowchart of a first embodiment of a request processing method according to the present invention;
FIG. 3 is a flowchart of a request processing method according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of a service logic tree structure in a second embodiment of a request processing method according to the present invention;
FIG. 5 is a flowchart of a request processing method according to a third embodiment of the present invention;
fig. 6 is a block diagram of a first embodiment of a request processing apparatus according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a request processing device of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the request processing apparatus may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) Memory or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the structure shown in fig. 1 is not limiting and may include more or fewer components than shown, or certain components may be combined, or a different arrangement of components.
As shown in fig. 1, an operating system, a data storage module, a network communication module, a user interface module, and a request processing program may be included in the memory 1005 as one type of storage medium.
In the request processing apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the request processing apparatus of the present invention may be provided in a request processing apparatus that invokes a request processing program stored in the memory 1005 through the processor 1001 and executes the request processing method provided by the embodiment of the present invention.
An embodiment of the present invention provides a request processing method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the request processing method of the present invention.
In this embodiment, the request processing method includes the following steps:
step S10: receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set;
it should be noted that, the execution body of the method of this embodiment may be a pre-developed host system for responding to a call request sent by an external system, where the host system may be a channel for outputting data externally, and the output object is a third-party external system or an associated system connected with the host system.
It should be understood that the request protocol type may be a protocol type of a network transport protocol or a transport protocol corresponding to the interface call request, and in this embodiment, the request protocol type includes, but is not limited to: hypertext transfer protocol (HyperText Transfer Protocol, HTTP), hypertext transfer protocol for secure data transfer (HyperText Transfer Protocol over Secure Socket Layer, HTTPs), enterprise service bus (Enterprise Service Bus, ESB), EJB (Enterprise JavaBean, a standard for developing component-based enterprise multiple applications), and the like.
In addition, before executing the step, a developer may classify the transmission protocols with the same or similar standards or principles into one class according to different standards or principles of various protocols, for example, in this embodiment, HTTP and HTTPs types of protocols may be uniformly classified into HTTP classes and the preset protocol type set may be constructed; the protocol (such as ESB protocol and EJB protocol) with the protocol standard or principle as the object mapping principle is classified into another class and a second protocol type set is established, so that when various requests are received by a main system, the protocol can be intercepted and split according to different request protocol types, then the split requests are distributed for requesting objects, response blocking caused by data transmission errors of a certain protocol is avoided, and the request processing fault tolerance and processing efficiency are improved.
In a specific implementation, when receiving an interface call request sent by a certain association system, the main system analyzes the interface call request, obtains a request protocol type corresponding to the request according to an analysis result, and then detects whether the request protocol type belongs to the preset protocol type set, if so, executes step S20, and if not, determines that the request protocol type set is a second protocol type set and executes a preset request response operation corresponding to the second protocol type set.
Step S20: when the request protocol type belongs to the preset protocol type set, a request path contained in the interface call request is read;
it should be appreciated that the request path may be a uniform resource locator (Uniform Resource Locator, URL) contained in the interface call request, such as: the request path in this step is https:// www.xxx.xx/sysName/productive Name/mehodName/interfaceName/[. The request path may include an interface identifier "interface name" of the interface to be called and a service identifier "sysName/product name/method name" corresponding to the interface to be called, for example, "sysName" is an insurance or a bank; "ProductName" is "Life Insource" (Life risk) or "Property Insurance" (risk of birth); "methodName" is "Property Insurance Detail s" (risk details) etc., in actual course, the host system may determine the business logic object that responds to the interface call request according to the request path contained in the interface call request.
It should be noted that, before executing this step, a developer may set, in advance, a gateway interface matching mode corresponding to the preset protocol type set to: fuzzy, variable length matching to perform a preliminary screening of the received request; the ambiguity is that the request parameters carried by the interface call request are not particularly limited, and no matter what parameters are transmitted, the main system can respond to the request as long as the main system can normally provide services to the outside; the variable length matching, i.e. variable length parameter matching, is a set of parameters, the number of parameters in the set may be one or more, or there may be no parameters; each parameter type in this parameter set is uncertain and its manifestation is generally shown as "[.+ -.") in the request path described above.
In a specific implementation, when detecting that a request protocol type corresponding to an interface call request belongs to a preset protocol type set, a main system reads a request path contained in the interface call request.
Further, in this embodiment, if the host system detects that the request protocol type corresponding to the interface call request does not belong to the preset protocol type set, it determines that the request protocol type belongs to the second protocol type set, and maps the interface call request to a preset common protocol management module, so that the common protocol management module directly distributes the request to a corresponding service logic object according to an interface identifier (for example, an interface name or an interface number) included in the interface call request, and the service logic object processes the request.
Step S30: and searching a business logic object corresponding to the request path in a database, and sending the interface calling request to the business logic object.
It should be appreciated that the service logic Object may be a service logic class written by a developer according to a service flow of a different service related to a third party external system, which is a class, i.e. an Object-oriented programming (OOP, object-Oriented Programming) implementing a basis for information encapsulation, a user-defined type, also referred to as a class type, each class containing a data description and a set of functions for operating data or delivering messages, and an instance of the class is referred to as an Object. The business logic object can acquire corresponding parameter output data according to the request parameters carried in the request path and feed the parameter output data back to the request initiator.
Before executing this step, the developer may classify the service logic codes/objects written for the third-party external system or the associated system according to different service types, for example, classifying all the codes written for the third-party external system according to the service types of banks, insurance, internet, investment, etc., and then layering the classified logic codes/objects. For example, business logic objects corresponding to insurance business may be classified into logic objects such as life insurance, senior insurance and production insurance, and methods (methods) or functions included in each class of logic objects may be further classified according to different interface attributes or definitions, for example, production insurance logic objects include an automatic production insurance adding and hanging and asset inquiring interface and a production insurance detail interface, and production insurance automatic adding and hanging and asset inquiring interfaces may be further classified into: automatic hanging and asset query interface for producing risk-normal asset query, automatic hanging and asset query interface for producing risk-clientNo is empty, automatic hanging and asset query interface for producing risk-partyNo is empty, automatic hanging and asset query interface for producing risk-serviceId is empty, etc.
In a specific implementation, after acquiring a request path contained in an interface call request, a host system may search a database storing service logic objects for a service logic object corresponding to the request path, and then send the interface call request to the searched service logic object, where the interface call request is responded by the host system.
The method comprises the steps of obtaining a request protocol type corresponding to an interface call request by receiving the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set; when the request protocol type belongs to a preset protocol type set, reading a request path contained in an interface call request; the method for processing the request provided by the embodiment detects whether the request protocol type corresponding to the request belongs to a preset protocol type set when any request is received, if so, the service logic object for processing the request is determined according to the request path contained in the request, and compared with the existing one-to-one mapping request response mode, the method for processing the request can effectively avoid response blocking caused by single protocol data transmission errors, and improves the request processing fault tolerance and processing efficiency.
Referring to fig. 3, fig. 3 is a flowchart illustrating a request processing method according to a second embodiment of the present invention.
Based on the first embodiment, the request processing method of the present embodiment further includes, before the step S30:
step S201: reading interface parameters contained in the request path, and determining object query parameters according to service identifiers and interface identifiers contained in the interface parameters;
it should be appreciated that the interface parameter may be data corresponding to a virtual directory portion and/or a file name portion in the request path, such as "/sysName/producName/mehodName/interfaceName/"; the service identifier may be service characteristic information capable of distinguishing different services, for example, "/sysName/product name/" service name/project name, or service number/project number, and the interface identifier may be interface characteristic information capable of distinguishing different interfaces, for example, "/i interface name/" interface name, interface number, etc.
In a specific implementation, a main system can read a service identifier and an interface identifier contained in the interface parameter, and searches a target node corresponding to the service identifier according to a pre-established service logic tree structure; and acquiring an interface path set corresponding to the target node, determining a target path from the interface path set according to the interface identifier, and taking the target path as an object query parameter.
The object query parameter, that is, the query basis of the service logic object, the service logic tree structure may be a data structure with a hierarchical relationship constructed according to service characteristics and service types of different services, and the service logic tree structure in this embodiment may be shown in fig. 4, and fig. 4 is a schematic diagram of the service logic tree structure in the second embodiment of the request processing method of the present invention.
In the service logic tree structure shown in fig. 4, the total service is a root node; the bank, insurance, internet, investment, etc. are father nodes, and each kind of father node may further include one or more child nodes such as "orange bank, birth risk, life risk", etc., and of course, the father node or child node in this embodiment may also be a leaf node or terminal node on the branch where the father node or child node is located.
In practical application, a developer may configure a corresponding interface path set for a leaf node (terminal node) in the tree structure, for example, a corresponding interface path set { automatic risk adding and asset querying interface-normal asset querying, automatic risk adding and asset querying interface-clientNo is null, automatic risk adding and asset querying interface-partyNo is null, automatic risk adding and asset querying interface-serviceId is null … … automatic risk adding and asset querying interface-asset returning value is null or null }, for a leaf node "automatic risk adding and asset querying interface" corresponding to a parent node "risk" so that a host system may determine a target path from the path set according to an interface identifier included in interface parameters, and use the target path as an object querying parameter.
Accordingly, the step S30 in this embodiment may specifically include:
step S30': searching a business logic object corresponding to the object query parameter in a mapping relation stored in a database, and sending the interface calling request to the business logic object.
It should be understood that, in order to improve the response efficiency of the request, a developer may pre-establish a correspondence between the object query parameter and the service logic object in the host system, that is, the mapping relationship, so that the host system determines the object query parameter, and then quickly determines the service logic object.
Further, the request processing method of this embodiment further includes, before the step S10:
the steps are as follows: acquiring service objects to be classified, and performing service logic classification on the service objects by adopting a tangent plane-oriented programming technology to acquire a plurality of service logic objects;
it should be noted that, the service object may be a service logic code/object written for a third-party external system or an associated system, and the tangent plane oriented programming (Aspect Oriented Programming, AOP) technology may be used to isolate each portion of the service logic, so that the coupling degree between each portion of the service logic is reduced.
The steps are as follows: reading a service identifier carried in the service logic object, and determining a service class to which the service logic object belongs according to the read service identifier;
it can be understood that after the service logic object is obtained, the main system may read the service identifier, such as a service name, a number, etc., carried in each service logic object, and then determine the service class to which the service logic object belongs according to the read service identifier, for example, determine that the service class to which the service logic object belongs is "insurance" according to the service identifier "risk" carried in the service logic object.
The steps are as follows: and establishing a service logic tree structure by taking the service identifier corresponding to each service logic object as a child node and the service class as a father node.
In a specific implementation, the main system can establish a service logic tree structure for a parent node by using service identifiers (such as "danger" and "life" for example) corresponding to each service logic object as child nodes and using the service category (such as insurance) as parent nodes, so as to obtain an interface path set corresponding to an interface call request according to the service logic attribute structure, thereby further improving the processing efficiency of the request.
According to the method and the device, the interface parameters contained in the request path are read, the object query parameters are determined according to the service identifiers contained in the interface parameters and the interface identifiers, the service logic objects corresponding to the object query parameters are searched in the mapping relation stored in the database, and the interface calling request is sent to the service logic objects, so that accurate searching of the service logic objects can be achieved, and the request processing efficiency is further improved.
Referring to fig. 5, fig. 5 is a flowchart of a third embodiment of a request processing method according to the present invention.
Based on the above embodiments, in this embodiment, the step S10 may specifically include:
step S101: when receiving an interface call request, intercepting the interface call request, and performing cross-domain access detection on the interface call request;
it should be understood that, in practical application, the interface call request received by the main system may be sent by a third-party external system, or may be sent by a front-end application program or a subsystem corresponding to the main system. Typically, when two domains have the same protocol (e.g., HTTP), the same port (e.g., 80), the same host (e.g., www.google.com), they are considered to be the same domain (i.e., protocol, domain name, port must be the same).
In a specific implementation, a host system can receive an interface call request, acquire a request path corresponding to the interface call request, and read a domain name field and a port field from the request path; detecting whether the domain name field is the same as the domain name field corresponding to the local domain name and/or detecting whether the port field is the same as the port field corresponding to the local port; and if the domain name field is different from the domain name field corresponding to the local domain name and/or the port field is different from the port field corresponding to the local port, judging that the interface call request belongs to a cross-domain access request.
It should be understood that the URL address generally includes several parts including a protocol, a domain name, a port, a virtual directory, a file name, an anchor, and a parameter, where in this embodiment, the domain name field is the character data corresponding to the domain name part in the URL address; the port field is character data positioned behind the domain name field in the URL address, and a separator is used between the domain name and the port. In addition, the port is not an essential part of a URL, and if the port part is omitted, a default port will be employed.
It is understood that the local domain name may be a local domain name corresponding to the host system, and the domain name may be configured by a developer according to a network protocol (Internet Protocol, IP) address corresponding to the host system; the local port may be preset by a developer and used for detecting cross-domain access to a local port of the host system.
Step S102: and when the interface call request is detected to belong to the cross-domain access request, acquiring a request protocol type corresponding to the interface call request.
In a specific implementation, when detecting that an interface call request belongs to a cross-domain access request, a main system acquires a request protocol type (such as HTTP, HTTPs, etc.) corresponding to the interface call request, and then detects whether the request protocol type belongs to a preset protocol type set.
Further, in this embodiment, if the host system detects that the interface call request does not belong to a cross-domain access request, a request parameter and a request path included in the interface call request are obtained; and determining a target interface to be called according to the request path, and sending the request parameter to a target service logic object corresponding to the target interface to be called, so that the target service logic object obtains parameter output data according to the request parameter and feeds back the parameter output data.
It should be noted that, the request parameter may be an input parameter (i.e. an input parameter data) carried in the interface call request, and the service logic object may obtain a corresponding output parameter (i.e. an output parameter data) according to the input parameter, and feed back the output parameter data to the request initiator.
According to the embodiment, when the interface call request is received, the interface call request is intercepted, cross-domain access detection is carried out on the interface call request, and when the interface call request is detected to belong to the cross-domain access request, the request protocol type corresponding to the interface call request is obtained.
In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a request processing program, and the request processing program realizes the steps of the request processing method when being executed by a processor.
Referring to fig. 6, fig. 6 is a block diagram of a first embodiment of a request processing apparatus according to the present invention.
As shown in fig. 6, a request processing apparatus according to an embodiment of the present invention includes:
the request receiving module 501 is configured to receive an interface call request, obtain a request protocol type corresponding to the interface call request, and detect whether the request protocol type belongs to a preset protocol type set;
a protocol detection module 502, configured to read a request path included in the interface call request when the request protocol type belongs to the preset protocol type set;
and the object searching module 503 is configured to search a database for a service logic object corresponding to the request path, and send the interface call request to the service logic object.
The method comprises the steps of obtaining a request protocol type corresponding to an interface call request by receiving the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set; when the request protocol type belongs to a preset protocol type set, reading a request path contained in an interface call request; the method for processing the request provided by the embodiment detects whether the request protocol type corresponding to the request belongs to a preset protocol type set when any request is received, if so, the service logic object for processing the request is determined according to the request path contained in the request, and compared with the existing one-to-one mapping request response mode, the method for processing the request can effectively avoid response blocking caused by single protocol data transmission errors, and improves the request processing fault tolerance and processing efficiency.
Based on the above-described first embodiment of the request processing apparatus of the present invention, a second embodiment of the request processing apparatus of the present invention is proposed.
In this embodiment, the request processing device further includes a parameter determining module, configured to read an interface parameter included in the request path, and determine an object query parameter according to a service identifier and an interface identifier included in the interface parameter; correspondingly, the object searching module 503 is further configured to search a mapping relationship stored in the database for a service logic object corresponding to the object query parameter, where the mapping relationship stores a correspondence between the object query parameter and the service logic object.
Further, the parameter determining module is further configured to read a service identifier and an interface identifier included in the interface parameter, and search a target node corresponding to the service identifier according to a pre-established service logic tree structure; and acquiring an interface path set corresponding to the target node, determining a target path from the interface path set according to the interface identifier, and taking the target path as an object query parameter.
Further, the request processing apparatus in this embodiment further includes: the tree structure module is used for acquiring service objects to be classified, and carrying out service logic classification on the service objects by adopting a tangent plane-oriented programming technology to acquire a plurality of service logic objects; reading a service identifier carried in the service logic object, and determining a service class to which the service logic object belongs according to the read service identifier; and establishing a service logic tree structure by taking the service identifier corresponding to each service logic object as a child node and the service class as a father node.
Further, the request receiving module 501 is further configured to intercept an interface call request and perform cross-domain access detection on the interface call request when receiving the interface call request; and when the interface call request is detected to belong to the cross-domain access request, acquiring a request protocol type corresponding to the interface call request.
Further, the request receiving module 501 is further configured to receive an interface call request, obtain a request path corresponding to the interface call request, and read a domain name field and a port field from the request path; detecting whether the domain name field is the same as the domain name field corresponding to the local domain name and/or detecting whether the port field is the same as the port field corresponding to the local port; and if the domain name field is different from the domain name field corresponding to the local domain name and/or the port field is different from the port field corresponding to the local port, judging that the interface call request belongs to a cross-domain access request.
Further, the object searching module 503 is further configured to obtain a request parameter and a request path included in the interface call request when it is detected that the interface call request does not belong to a cross-domain access request; and determining a target interface to be called according to the request path, and sending the request parameter to a target service logic object corresponding to the target interface to be called, so that the target service logic object obtains parameter output data according to the request parameter and feeds back the parameter output data.
Other embodiments or specific implementations of the request processing apparatus of the present invention may refer to the above method embodiments, and are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. read-only memory/random-access memory, magnetic disk, optical disk), comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (8)

1. A method of request processing, the method comprising:
receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set;
when the request protocol type belongs to the preset protocol type set, a request path contained in the interface call request is read;
searching a business logic object corresponding to the request path in a database, and sending the interface calling request to the business logic object;
before the step of searching the service logic object corresponding to the request path in the database, the method further includes:
reading interface parameters contained in the request path, acquiring service identifiers and interface identifiers contained in the interface parameters, and searching target nodes corresponding to the service identifiers according to a pre-established service logic tree structure, wherein the interface parameters comprise virtual directory data and/or file name data in the request path;
acquiring an interface path set corresponding to the target node, determining a target path from the interface path set according to the interface identifier, and taking the target path as an object query parameter;
the step of searching the business logic object corresponding to the request path in the database comprises the following steps:
searching a business logic object corresponding to the object query parameter in a mapping relation stored in a database, wherein the mapping relation stores the corresponding relation between the object query parameter and the business logic object;
wherein after detecting whether the request protocol type belongs to a preset protocol type set, the method further comprises:
if the request protocol type does not belong to the preset protocol type set, judging that the request protocol type is a second protocol type set;
and mapping the interface calling request to a preset public protocol management module according to the second protocol type set, so that the preset public protocol management module distributes the interface calling request to a corresponding service logic object according to an interface identifier contained in the interface calling request, and the service logic object performs request response processing according to the interface calling request, wherein the interface identifier comprises an interface name and an interface number.
2. The method of claim 1, wherein prior to the step of receiving an interface call request, obtaining a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set, the method further comprises:
acquiring service objects to be classified, and performing service logic classification on the service objects by adopting a tangent plane-oriented programming technology to acquire a plurality of service logic objects;
reading a service identifier carried in the service logic object, and determining a service class to which the service logic object belongs according to the read service identifier;
and establishing a service logic tree structure by taking the service identifier corresponding to each service logic object as a child node and the service class as a father node.
3. The method according to any one of claims 1 to 2, wherein the step of receiving an interface call request and obtaining a request protocol type corresponding to the interface call request includes:
when receiving an interface call request, intercepting the interface call request, and performing cross-domain access detection on the interface call request;
and when the interface call request is detected to belong to the cross-domain access request, acquiring a request protocol type corresponding to the interface call request.
4. The method of claim 3, wherein the step of receiving an interface call request, and performing cross-domain access detection on the interface call request, comprises:
receiving an interface call request, acquiring a request path corresponding to the interface call request, and reading a domain name field and a port field from the request path;
detecting whether the domain name field is the same as the domain name field corresponding to the local domain name and/or detecting whether the port field is the same as the port field corresponding to the local port;
and if the domain name field is different from the domain name field corresponding to the local domain name and/or the port field is different from the port field corresponding to the local port, judging that the interface call request belongs to a cross-domain access request.
5. The method of claim 3, wherein after the step of receiving an interface call request and cross-domain access detection of the interface call request, the method further comprises:
when the interface call request is detected not to belong to the cross-domain access request, acquiring a request parameter and a request path contained in the interface call request;
and determining a target interface to be called according to the request path, and sending the request parameter to a target service logic object corresponding to the target interface to be called, so that the target service logic object obtains parameter output data according to the request parameter and feeds back the parameter output data.
6. A request processing apparatus, the apparatus comprising:
the request receiving module is used for receiving an interface call request, acquiring a request protocol type corresponding to the interface call request, and detecting whether the request protocol type belongs to a preset protocol type set;
the protocol detection module is used for reading a request path contained in the interface call request when the request protocol type belongs to the preset protocol type set;
the object searching module is used for searching the business logic object corresponding to the request path in the database and sending the interface calling request to the business logic object;
the request processing device further comprises a parameter determining module, wherein the parameter determining module is used for reading interface parameters contained in the request path, acquiring service identifiers and interface identifiers contained in the interface parameters, and searching target nodes corresponding to the service identifiers according to a pre-established service logic tree structure, wherein the interface parameters comprise virtual directory data and/or file name data in the request path; acquiring an interface path set corresponding to the target node, determining a target path from the interface path set according to the interface identifier, and taking the target path as an object query parameter;
the object searching module is further configured to search a mapping relation stored in the database for a service logic object corresponding to the object query parameter, where the mapping relation stores a correspondence relation between the object query parameter and the service logic object;
the protocol detection module is further configured to determine that the request protocol type is a second protocol type set if the request protocol type does not belong to a preset protocol type set; and mapping the interface calling request to a preset public protocol management module according to the second protocol type set, so that the preset public protocol management module distributes the interface calling request to a corresponding service logic object according to an interface identifier contained in the interface calling request, and the service logic object performs request response processing according to the interface calling request, wherein the interface identifier comprises an interface name and an interface number.
7. A request processing apparatus, the apparatus comprising: a memory, a processor and a request processing program stored on the memory and executable on the processor, the request processing program being configured to implement the steps of the request processing method of any of claims 1 to 5.
8. A storage medium having stored thereon a request processing program which, when executed by a processor, implements the steps of the request processing method according to any one of claims 1 to 5.
CN201811246136.5A 2018-10-23 2018-10-23 Request processing method, device, equipment and storage medium Active CN109635019B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811246136.5A CN109635019B (en) 2018-10-23 2018-10-23 Request processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811246136.5A CN109635019B (en) 2018-10-23 2018-10-23 Request processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109635019A CN109635019A (en) 2019-04-16
CN109635019B true CN109635019B (en) 2023-08-22

Family

ID=66066645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811246136.5A Active CN109635019B (en) 2018-10-23 2018-10-23 Request processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109635019B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110099122B (en) * 2019-05-07 2020-05-15 北京字节跳动网络技术有限公司 Method and apparatus for sending network request
CN110298650A (en) * 2019-05-21 2019-10-01 深圳壹账通智能科技有限公司 Interface calls charging method, device, equipment and storage medium
CN111045750B (en) * 2019-12-19 2023-07-07 飞天诚信科技股份有限公司 Method for automatically matching application programs on multi-application device and electronic device
CN112351059B (en) * 2020-07-30 2021-09-10 中兴通讯股份有限公司 Request processing method and device, electronic equipment and computer-readable storage medium
CN112950370A (en) * 2021-02-25 2021-06-11 未鲲(上海)科技服务有限公司 Service processing method, device, equipment and storage medium
CN113079198B (en) * 2021-03-18 2022-07-01 青岛海信智慧生活科技股份有限公司 Method and device for converting cloud platform interface protocol
CN113722621B (en) * 2021-08-30 2023-11-14 康键信息技术(深圳)有限公司 URL-based service processing method, equipment and storage medium
CN114095585B (en) * 2022-01-21 2022-05-20 武汉中科通达高新技术股份有限公司 Data transmission method, device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286845A (en) * 2008-05-12 2008-10-15 华中科技大学 Control system for access between domains based on roles
CN101673272A (en) * 2008-09-08 2010-03-17 华为技术有限公司 Method, system and device for searching information and method for registering vertical search engine
CN105488172A (en) * 2015-11-30 2016-04-13 北京奇艺世纪科技有限公司 Location-based data query method and device
CN106790206A (en) * 2017-01-05 2017-05-31 厦门中控生物识别信息技术有限公司 The protocol analysis method and device of operation system
CN107835226A (en) * 2017-09-27 2018-03-23 五八有限公司 The HTTP interface processing method and processing device of application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8689276B2 (en) * 2004-08-25 2014-04-01 Adobe Systems Incorporated System and method for controlling access to files

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286845A (en) * 2008-05-12 2008-10-15 华中科技大学 Control system for access between domains based on roles
CN101673272A (en) * 2008-09-08 2010-03-17 华为技术有限公司 Method, system and device for searching information and method for registering vertical search engine
CN105488172A (en) * 2015-11-30 2016-04-13 北京奇艺世纪科技有限公司 Location-based data query method and device
CN106790206A (en) * 2017-01-05 2017-05-31 厦门中控生物识别信息技术有限公司 The protocol analysis method and device of operation system
CN107835226A (en) * 2017-09-27 2018-03-23 五八有限公司 The HTTP interface processing method and processing device of application program

Also Published As

Publication number Publication date
CN109635019A (en) 2019-04-16

Similar Documents

Publication Publication Date Title
CN109635019B (en) Request processing method, device, equipment and storage medium
US11677812B2 (en) Lightweight IoT information model
CN111314459B (en) Service request method, device, electronic equipment and storage medium
IL275042A (en) Self-adaptive application programming interface level security monitoring
TWI658418B (en) Business implementation method, device and system of financial information exchange (FIX) protocol
US11500904B2 (en) Local data classification based on a remote service interface
US7818752B2 (en) Interface for application components
CN111708619B (en) Distributed transaction processing method and system based on message queue and database
CN113259479B (en) Data processing method and equipment
CN112612595A (en) Method and device for establishing micro-service calling relationship, computer equipment and storage medium
WO2023050933A1 (en) Method and apparatus for determining lost host
CN114490268A (en) Full link monitoring method, device, equipment, storage medium and program product
CN114244654B (en) URL forwarding method, device, equipment and computer storage medium
CN112860507B (en) Control method and device for sampling rate of distributed link tracking system
CN108496157B (en) System and method for providing runtime trace using an extended interface
CN113779437A (en) Privacy detection method and device and computer storage medium
WO2023125755A1 (en) Service request processing method and apparatus based on large-scale cluster, and device and medium
US9503351B1 (en) Deployment feedback for system updates to resources in private networks
WO2021232860A1 (en) Communication method, apparatus and system
US11140183B2 (en) Determining criticality of identified enterprise assets using network session information
CN113726855A (en) Service aggregation method, device, electronic equipment and computer-readable storage medium
CN111782428B (en) Data calling system and method
CN115878396A (en) Interface testing method, device, equipment and medium for enterprise service bus
TWI702540B (en) Load control method
CN116302397A (en) Remote service calling method, system, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant