CN116132246B - Interaction method, device, gateway equipment and storage medium - Google Patents

Interaction method, device, gateway equipment and storage medium Download PDF

Info

Publication number
CN116132246B
CN116132246B CN202211074892.0A CN202211074892A CN116132246B CN 116132246 B CN116132246 B CN 116132246B CN 202211074892 A CN202211074892 A CN 202211074892A CN 116132246 B CN116132246 B CN 116132246B
Authority
CN
China
Prior art keywords
target
interaction
request
party
requester
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
CN202211074892.0A
Other languages
Chinese (zh)
Other versions
CN116132246A (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.)
Mashang Consumer Finance Co Ltd
Original Assignee
Mashang Consumer Finance 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 Mashang Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN202211074892.0A priority Critical patent/CN116132246B/en
Publication of CN116132246A publication Critical patent/CN116132246A/en
Application granted granted Critical
Publication of CN116132246B publication Critical patent/CN116132246B/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
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses an interaction method which is applied to gateway equipment and used for acquiring a predefined target interaction specification between an original target service party and a request party; processing interaction between the original target service party and the requester based on the target interaction specification; if the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification; the adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from each other, and the target service side has adapted to the target interaction specification. Therefore, the interaction method only needs the new service side to adapt to the interaction specification corresponding to the original service side, does not need any modification by the requesting side, reduces the adaptation time and improves the adaptation efficiency. The application also discloses an interaction device, gateway equipment and a storage medium, which have the same beneficial effects as the interaction method.

Description

Interaction method, device, gateway equipment and storage medium
Technical Field
The present application relates to the field of micro services, and in particular, to an interaction method, apparatus, gateway device, and storage medium.
Background
In the existing micro-service system, each service side provides a set of service interfaces to provide services for the requesting side, for example, the requesting side sends a query request to the service side, and the service side can query corresponding information according to the query request and return the information to the requesting side. When a certain service party needs to be upgraded, the service party is replaced by a new service party, and the new service party also provides a set of service interfaces for providing services for the requesting party. However, the new service party and the original service party may provide service interfaces of different designs, so that the original corresponding request party needs to be re-adapted to the new service party, and the new service party can successfully provide services for the request party.
For example, as shown in fig. 1, the requesters 1 and 2 need to access the service 1 in their own service, that is, the service 1 provides services for the requesters 1 and 2, in this case, if the service 2 is used to replace the original service 1, the requesters 1 and 2 need to modify the access targets to the service 2 and adapt the service interfaces of the service 2.
However, the touch-and-line work of the original corresponding requester is difficult to be carried out, and the requester needing to be re-adapted is easily missed, so that the follow-up work of the requester is influenced; moreover, all requesters originally corresponding to the original service side need to perform the adaptation work respectively, so that the adaptation time is longer and the adaptation efficiency is lower.
Disclosure of Invention
The application provides an interaction method, an interaction device, gateway equipment and a storage medium, which only need a new service side to adapt to the interaction specification corresponding to an original service side and do not need a requester to make any modification, thereby reducing the adaptation time and improving the adaptation efficiency.
In a first aspect, the present application provides an interaction method, applied to a gateway device, including:
the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester;
Processing interactions between the original target server and the requestor based on the target interaction specification;
If the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from communication connection, and the target service side has adapted the target interaction specification.
In a second aspect, the present application provides an interaction device, comprising:
The acquisition module is used for acquiring a predefined target interaction specification between the original target service party and the requester;
The interaction module is used for processing interaction between the original target service party and the requester based on the target interaction specification;
The interaction updating module is used for updating the service side information corresponding to the target interaction specification if the adaptation completion information sent by the target service side is received, and processing the interaction between the target service side and the requesting side based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through gateway equipment, the original target service side and the requesting side are disconnected from communication connection, and the target service side is adapted to the target interaction specification.
In a third aspect, the present application provides a gateway device, comprising:
a memory for storing a computer program;
A processor for implementing the steps of any of the interaction methods described above when executing the computer program.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of any of the above-described interaction methods.
In summary, the present application provides an interaction method, which is applied to a gateway device, and includes: the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester; processing interaction between the original target service party and the requester based on the target interaction specification; if the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification; the adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway equipment, the original target service side and the requesting side are disconnected from each other, and the target service side has adapted to the target interaction specification. Therefore, in the interaction method, the new service side establishes communication connection with the requesting side through the gateway equipment, so that the new service side is only required to adapt to the interaction specification corresponding to the original service side, and the requesting side does not need to make any modification, thereby reducing the adaptation time and improving the adaptation efficiency.
The application also provides an interaction device, gateway equipment and a storage medium, and the interaction device and the gateway equipment have the same beneficial effects as the interaction method.
Drawings
In order to more clearly illustrate one or more embodiments of the present application or the prior art solutions, the drawings that are required in the embodiments or the prior art descriptions will be briefly described below, it being obvious that the drawings in the following description are only some embodiments described in the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a schematic diagram of an interaction scenario between a server and a requestor in the prior art;
FIG. 2 is a schematic diagram of an interaction scenario between a server and a requester according to an embodiment of the present application;
FIG. 3 is a flowchart of an interaction method according to an embodiment of the present application;
Fig. 4 is a schematic structural diagram of an interaction device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a gateway device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the technical solutions of one or more embodiments of the present application, the technical solutions of one or more embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in one or more embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from one or more embodiments of the application, are intended to be within the scope of this document.
The terms "first," "second," and the like in this specification are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the application may be practiced otherwise than as specifically illustrated or described herein. Furthermore, in the present specification and claims, "and/or" means at least one of the connected objects, and the character "/" generally means a relationship in which the associated object is an "or" before and after.
The technical terms related to the embodiment of the application include:
JSON: javaScript Object Notation is a lightweight data exchange format, which is easy for a person to read and write, and is easy for a machine to analyze and generate.
API (Application Programming Interface), application programming interface) gateway: is the only entry in the system to handle the request, and all external API requests entering the system need to go through the API gateway. The gateway carries out routing according to the definition of the API, selects a correct back-end server side for forwarding, returns a processing result to the API gateway after the back-end server side finishes processing, and returns the processing result to the requester.
Referring to fig. 2, fig. 2 is a schematic diagram of an interaction scenario between a server and a requester according to an embodiment of the present application. The interaction scene comprises: n requesters, M service partners, a gateway device (N and M are positive integers); the gateway device serves as an intermediary interaction medium between the requester and the service party, and the gateway device can be an API gateway. When any service party needs to be upgraded, a new service party can be used for replacing the service party needing to be upgraded. For example, as shown in fig. 2, when the service party 1 needs to be upgraded, a new service party 2 is used to replace the original service party 1.
Based on the above interaction scenario architecture, considering that the service side 2 and the service side 1 may provide service interfaces with different designs, the original interaction scenario between the service side 2 and the service side 1 is not adapted, so that the provision of subsequent services is affected. Referring to fig. 3, fig. 3 is a flowchart of an interaction method provided in an embodiment of the present application, where the method in fig. 3 can be performed by the gateway device in fig. 2, and as shown in fig. 3, the method includes the following steps:
Step S102: and acquiring a predefined target interaction specification between the original target service party and the requesting party.
In the embodiment of the application, the gateway equipment is connected with a plurality of service parties, and each time the service party interacts with the requesting party, the service party which interacts with the requesting party is called a target service party. The gateway device is predefined with an interaction specification between each server and the requesting party. The predefined interaction specification between the service and the requestor (the predefined interaction specification between the target service and the requestor is referred to as a target interaction specification) may include, but is not limited to: a request mode of a request body sent to a service party by a request party, a response mode of a response body returned to the request party by the service party, and a transmission protocol between the service party and the request party; the request mode of the request body may include, but is not limited to: format requirements of the requestor and content requirements of the requestor; the response patterns of the response body may include, but are not limited to: format requirements of the response body, and content requirements of the response body. It should be noted that, the request mode of the request body sent by the requesting party to the service party is determined according to the parameter entering requirement of the service party, and the parameter entering requirements of different service parties may be different; the response mode of the response body of the service side to the request side is determined according to the parameter-out requirement of the service side, and the parameter-out requirements of different service sides can be different.
In a specific application, the gateway device obtains a predefined target interaction specification between the original target service party (the target service party before being replaced) and the requester, so as to provide a basis for subsequent processing of interaction between the original target service party and the requester.
Step S104: interactions between the original target server and the requestor are processed based on the target interaction specification.
In a specific application, taking a first service party (any service party) as an example, if the gateway device detects that a request party needs to interact with the first service party, the first service party is taken as a target service party, and interaction between the target service party and the request party is processed based on a predefined target interaction specification between the target service party and the request party.
More specifically, the gateway device may determine, based on the request sent by the requesting party, a service party (one of the plurality of service parties connected by the gateway device) that can process the request, that is, a target service party to which the requesting party is to interact. The process of the gateway device processing the interaction between the target service party and the requesting party comprises the following steps: and carrying out request specification verification on the request sent by the requester based on a target interaction specification (comprising a request specification and a response specification) predefined between the target service side and the requester, if the verification is passed, forwarding the request sent by the requester to the target service side, waiting for a response body returned by the target service side, after receiving the response body returned by the target service side, carrying out response specification verification on the response body returned by the target service side, and if the verification is passed, forwarding the response body returned by the target service side to the requester, wherein one interaction between the requester and the target service side is completed.
Step S106: and if the adaptation completion information sent by the target service party is received, updating the service party information corresponding to the target interaction specification, and processing the interaction between the target service party and the requester based on the target interaction specification.
It should be noted that, the adaptation completion information herein indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from each other, and the target service side has adapted to the target interaction specification.
In a specific application, when a first service party (any service party) needs to be upgraded, a new second service party can be adopted to replace the original first service party. In this case, in order to adapt the original interaction scenario between the second service party and the first service party, the second service party needs to adapt the original interaction specification between the first service party and the requesting party, and if the second service party does not adapt the original interaction specification between the first service party and the requesting party, the second service party can adapt by modifying its own service logic, so that the subsequent service is normally provided. After the second service side replaces the first service side (i.e. the second service side and the requesting side establish communication connection through the gateway device, the first service side and the requesting side are disconnected from each other) and the original interaction specification between the first service side and the requesting side is adapted, the second service side actively reports to the gateway device that the second service side has completed adapting the message (i.e. the adaptation completion information) of the original interaction specification between the first service side and the requesting side.
Based on the above, if the gateway device receives the adaptation completion information sent by the new target service side, it indicates that the new target service side replaces the original target service side, and the new target service side has adapted the target interaction specification, the service side information corresponding to the target interaction specification is updated. In this case, the gateway device processes interactions between the new target server and the requesting party based on the target interaction specification if it detects that there is a requesting party to interact with the new target server.
The interaction method provided by the embodiment of the application is applied to gateway equipment and comprises the following steps: the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester; processing interaction between the original target service party and the requester based on the target interaction specification; and if the adaptation completion information sent by the target service party is received, updating the service party information corresponding to the target interaction specification, and processing the interaction between the target service party and the requester based on the target interaction specification. Therefore, the interaction method only needs the new service side to adapt to the interaction specification corresponding to the original service side, and does not need any modification by the requesting side, so that the adaptation time is shortened, and the adaptation efficiency is improved.
In an alternative embodiment, the number of service parties is a plurality; the processing the interaction between the target server and the requester based on the target interaction specification in the above steps may include the following steps:
Determining a target server for processing the target request in response to the target request sent by the requester;
If the target request meets the request specification in the target interaction specification corresponding to the target server, forwarding the target request to the target server;
and receiving a target response body returned by the target service side, and if the target response body meets the response specification in the target interaction specification, returning the target response body to the requesting side.
Specifically, taking any one of the requesters (referred to as a target requester) as an example, the target requester sends a request (referred to as a target request) to the gateway device. The gateway device determines a target service party which can process the target request in response to the target request sent by the target request party, i.e. the gateway device determines that the target request party is to interact with the target service party. Then, the gateway equipment judges whether the target request meets the request specification in the target interaction specification corresponding to the target server, and if the target request meets the request specification in the target interaction specification, the target request is forwarded to the target server; if the target request does not meet the request specification in the target interaction specification, the target request is not forwarded to the target service side, and a request error alarm is carried out.
And the target server processes the target request after receiving the target request forwarded by the gateway equipment to obtain a target response body, and returns the target response body to the gateway equipment. After receiving a target response body returned by the target service side, the gateway equipment judges whether the target response body meets the response specification in the target interaction specification corresponding to the target service side, and if the target response body meets the response specification in the target interaction specification, the gateway equipment returns the target response body to the target request side; if the target response body does not meet the response specification in the target interaction specification, the target response body is not returned to the target requester, and response error warning is carried out.
In an alternative embodiment, the predefined interaction specification between the server and the requestor may include: a request mode of a request body sent to a service party by a request party, a response mode of a response body returned to the request party by the service party, and a transmission protocol between the service party and the request party;
The gateway device in the above step determines whether the target request meets the request specification in the target interaction specification corresponding to the target service party, and may include the following steps:
judging whether a request mode of the target request meets a request mode specification in the target interaction specification, and judging whether transmission protocol content contained in the target request meets the transmission protocol specification in the target interaction specification;
if both conditions are satisfied, determining that the target request satisfies a request specification in the target interaction specification;
if either of the conditions is not satisfied, it is determined that the target request does not satisfy the request specification in the target interaction specification.
Similarly, the step of determining, by the gateway device, whether the target response body meets the response specification in the target interaction specification corresponding to the target service party may include the following steps:
Judging whether the response mode of the target response body meets the response mode specification in the target interaction specification, and whether the transmission protocol content contained in the target response body meets the transmission protocol specification in the target interaction specification;
if both conditions are met, determining that the target response body meets the response specification in the target interaction specification;
If either of the cases is not satisfied, determining that the target response body does not satisfy the response specification in the target interaction specification.
An embodiment of the application is shown here as a specific embodiment of the steps described above. Of course, it should be understood that the steps described above may be implemented in other manners, and embodiments of the present application are not limited thereto.
In an alternative embodiment, in response to the target request sent by the requester, the determining the target server for processing the target request in the above steps may include the following steps:
determining a target function for processing the target request in response to the target request sent by the requester;
And determining a target service party corresponding to the target function based on the corresponding relation between the preset function and the service party.
In the embodiment of the present application, in the corresponding relationship between the preset function and the service side, the function corresponding to the service side is a function that the service side can provide, for example, the function that the target service side can provide is a function for querying user information (referred to as a user information query function), and then the corresponding relationship between the user information query function and the target service side can be set.
Specifically, taking the target requester as an example, the target requester sends a target request to the gateway device. The gateway device responds to the target request sent by the target requesting party, determines a function (called a target function) capable of processing the target request, and then determines a target serving party corresponding to the target function based on the corresponding relation between the preset function and the serving party, namely the gateway device determines that the target requesting party is to interact with the target serving party.
For example, the target requester sends a request for querying the user information (referred to as a user information query request) to the gateway device. The gateway device responds to the user information inquiry request, determines that the function capable of processing the user information inquiry request is a user information inquiry function, and then determines that the service party corresponding to the user information inquiry function is a target service party based on the corresponding relation between the preset function and the service party.
An embodiment of the application is shown here as a specific embodiment of the steps described above. Of course, it should be understood that the steps described above may be implemented in other manners, and embodiments of the present application are not limited thereto.
In an optional embodiment, after receiving the adaptation completion information sent by the target service party, the gateway device further includes:
And updating the original target service party in the corresponding relation between the preset function and the original target service party to be the target service party.
Specifically, if the gateway device receives the adaptation completion information sent by the new target server, the gateway device updates the server information corresponding to the target interaction specification, and updates the original target server in the corresponding relationship between the preset function and the original target server to be the new target server.
That is, if the first function originally provided by the original target service party is provided by the new target service party after replacement, before the original target service party is replaced, if the gateway device determines that the function capable of processing the target request is the first function, determining that the service party corresponding to the first function is the original target service party based on the corresponding relation between the preset function and the service party; after the original target service party is replaced, if the function capable of processing the target request is determined to be the first function, the service party corresponding to the first function is determined to be a new target service party based on the corresponding relation between the preset function and the service party.
In an optional embodiment, the interaction method provided by the embodiment of the application may further include:
If the request mode of the target request sent by the requester does not meet the request mode specification in the target interaction specification and/or the transmission protocol content contained in the target request does not meet the transmission protocol specification in the target interaction specification, the request error information is returned to the requester;
And if the response mode of the target response body returned by the target service side does not meet the response mode specification in the target interaction specification, and/or the transmission protocol content contained in the target response body does not meet the transmission protocol specification in the target interaction specification, returning response error information to the target service side.
Specifically, taking the target requester as an example, the target requester sends a target request to the gateway device. The gateway equipment judges whether a request mode of the target request meets the request mode specification in the target interaction specification corresponding to the target service side, and if the request mode of the target request does not meet the request mode specification in the target interaction specification, returns request error information to the target request side so as to carry out request error warning; if the request mode of the target request meets the request mode specification in the target interaction specification, judging whether the transmission protocol content contained in the target request meets the transmission protocol specification in the target interaction specification, and if the transmission protocol content contained in the target request does not meet the transmission protocol specification in the target interaction specification, returning request error information to the target requester so as to carry out request error warning; and if the transmission protocol content contained in the target request meets the transmission protocol specification in the target interaction specification, forwarding the target request to the target service side.
Similarly, after receiving the target response body returned by the target service side, the gateway device judges whether the response mode of the target response body meets the response mode specification in the target interaction specification corresponding to the target service side, and if the response mode of the target response body does not meet the response mode specification in the target interaction specification, returns response error information to the target service side so as to respond to error warning; if the response mode of the target response body meets the response mode specification in the target interaction specification, judging whether the transmission protocol content contained in the target response body meets the transmission protocol specification in the target interaction specification, and if the transmission protocol content contained in the target response body does not meet the transmission protocol specification in the target interaction specification, returning response error information to the target server so as to respond error alarm; and if the transmission protocol content contained in the target response body meets the transmission protocol specification in the target interaction specification, returning the target response body to the target requester.
More specifically, the request pattern of the request body and the response pattern of the response body are patterns defined based on the JSON data structure. The transmission protocol between the service party and the requesting party may employ Http (Hypertext Transfer Protocol ) protocol.
For example, the request mode corresponding to the target server is defined as follows:
The response mode of the response body corresponding to the target service side is defined as follows:
the transmission protocol Http corresponding to the target service party is defined as follows:
URI:/userService/v1/getUser
Method:POST。
if the function provided by the target service side is the function of inquiring the user information, the requesting side can request the target service side to acquire the user information of the current user. If the request parameter input of the requesting party is wrong, submitting the work number according to the character string format:
{
"no": "10043"// correct mode being of the int type
};
The gateway equipment matches the request parameters of the requester with the request modes corresponding to the target service party, and returns request error information to the requester until the requester is modified to be of the correct request parameter type when the data format of the no field is found to be wrong, so that the request mode of the requester is standardized.
After the request parameters of the requesting party are successfully matched, the gateway equipment forwards the request to the target service party, and the target service party starts to process the request after receiving the gateway request, namely, user information is acquired from the database for returning:
Based on this, step S102 described above: the obtaining of the predefined target interaction specification between the original target service party and the requesting party may comprise the following steps:
Describing a standard expansion point for each service side in advance through JSON mode and Http definition;
acquiring a target interaction specification between an original target service party and a requesting party from description information of a standard expansion point corresponding to the original target service party;
the standard expansion point is used for representing a standard function interface provided in the service party pair, and the standard function interface is registered in the gateway equipment.
In an alternative embodiment, the target server interacts with multiple requesters; each request sent by the requesting party comprises request content and request processing permission time;
The processing the interaction between the target server and the requester based on the target interaction specification in the above steps may include the following steps:
Analyzing a to-be-processed request sent by each requester in the same time period to obtain a request processing permission time corresponding to each requester in the same time period;
And processing the interaction between the target service party and each requester according to the duration of the request processing permission time corresponding to each requester based on the predefined target interaction specification between the target service party and each requester.
Specifically, if multiple requesters interacting with the target service party send requests to the gateway device in the same time period, the gateway device firstly analyzes the request sent by each requester to obtain the request processing permission time of each requester, and then preferentially processes the request of the requester with shorter request processing permission time, i.e. preferentially verifies the request of the requester with shorter request processing permission time and then forwards the request to the target service party for processing, so as to ensure that the request of the requester can be processed within the corresponding request processing permission time.
In summary, the interaction method provided by the embodiment of the application can check the validity of the request parameters in advance in the gateway equipment, and can reduce the influence range of the error request on the service side; all URIs (Universal Resource Identifier, universal resource identifiers), http methods (Http request methods), access parameters and the like which can centrally define standard extension points, and once the standard extension points are determined, a server cannot change automatically; the gateway device takes over all external requests and all tangential operations are performed at the gateway device.
Corresponding to the above-described interaction method, one or more embodiments of the present application further provide an interaction device based on the same technical concept. Referring to fig. 4, fig. 4 is a schematic structural diagram of an interaction device according to an embodiment of the present application. The interaction device comprises:
an obtaining module 201, configured to obtain a predefined target interaction specification between an original target service party and a requester;
an interaction module 202, configured to process interactions between the original target service party and the requester based on the target interaction specification;
The interaction updating module 203 is configured to update, if receiving the adaptation completion information sent by the target server, server information corresponding to the target interaction specification, and process interaction between the target server and the requester based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from communication connection, and the target service side has adapted the target interaction specification.
The interaction device provided by the embodiment of the application acquires the predefined target interaction specification between the original target service party and the requester; processing interaction between the original target service party and the requester based on the target interaction specification; and if the adaptation completion information sent by the target service party is received, updating the service party information corresponding to the target interaction specification, and processing the interaction between the target service party and the requester based on the target interaction specification. Therefore, the interaction device only needs the new service side to adapt to the interaction specification corresponding to the original service side, and does not need the requester to make any modification, so that the adaptation time is shortened, and the adaptation efficiency is improved.
In an alternative embodiment, the interaction module 202 includes:
A determining unit, configured to determine a target server that processes the target request in response to the target request sent by the requester;
a forwarding unit, configured to forward the target request to the target server if a request specification of the target request is satisfied in target interaction specifications corresponding to the target server; that is, if the target request meets a request specification in target interaction specifications corresponding to the target server, forwarding the target request to the target server;
And the return unit is used for receiving the target response body returned by the target service side, and returning the target response body to the requesting side if the target response body meets the response specification in the target interaction specification.
In an alternative embodiment, the determining unit is specifically configured to:
Determining a target function for processing the target request in response to the target request sent by the requester;
And determining a target service party corresponding to the target function based on the corresponding relation between the preset function and the service party.
In an alternative embodiment, the interaction update module 203 is further configured to, after receiving the adaptation completion information sent by the target service party:
And updating the original target server in the corresponding relation between the preset function and the original target server to the target server.
In an alternative embodiment, the predefined interaction specification between the service party and the requesting party comprises: the request pattern of the request body sent by the request party to the service party, and/or the response pattern of the response body returned by the service party to the request party, and/or the transmission protocol between the service party and the request party.
In an alternative embodiment, the request pattern or the response pattern is a pattern defined based on a JSON data structure.
In an alternative embodiment, the interaction device further comprises:
A request alarm module, configured to return request error information to the requester if a request mode of the target request sent by the requester does not meet a request mode specification in the target interaction specification, and/or a transport protocol content included in the target request does not meet a transport protocol specification in the target interaction specification;
And the response alarm module is used for returning response error information to the target server if the response mode of the target response body returned by the target server does not meet the response mode specification in the target interaction specification and/or the transmission protocol content contained in the target response body does not meet the transmission protocol specification in the target interaction specification. In an alternative embodiment, the target service party communicates with a plurality of the requests Fang Jiaohu; each request sent by the requesting party comprises request content and request processing permission time;
The interaction module 202 includes:
The analyzing unit is used for analyzing the to-be-processed request sent by each requester in the same time period to acquire the request processing permission time corresponding to each requester in the same time period;
And the interaction unit is used for processing the interaction between the target service party and each requester according to the duration of the request processing permission time corresponding to each requester based on the predefined target interaction specification between the target service party and each requester.
It should be noted that, in the embodiment of the present application, the embodiment related to the interaction device and the embodiment related to the interaction method in the embodiment of the present application are based on the same inventive concept, so that the specific implementation of the embodiment may refer to the implementation of the corresponding interaction method, and the repetition is omitted.
Further, the present application provides a gateway device, corresponding to the above-described interaction method, based on the same technical concept, where the gateway device is configured to perform the steps of any one of the above-described interaction methods. Referring to fig. 5, fig. 5 is a schematic structural diagram of a gateway device according to an embodiment of the present application.
As shown in fig. 5, the gateway device may have a relatively large difference due to different configurations or performances, and may include one or more processors 301 and a memory 302, where the memory 302 may store one or more storage applications or data. Wherein the memory 302 may be transient storage or persistent storage. The application programs stored in memory 302 may include one or more modules (not shown) each of which may include a series of computer executable instructions in the gateway device. Still further, the processor 301 may be arranged to communicate with the memory 302, executing a series of computer executable instructions in the memory 302 on the gateway device. The gateway device may also include one or more power supplies 303, one or more wired or wireless network interfaces 304, one or more input output interfaces 305, and the like.
In a particular embodiment, a gateway device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the gateway device, and configured to be executed by one or more processors, the one or more programs comprising computer-executable instructions for:
the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester;
Processing interactions between the original target server and the requestor based on the target interaction specification;
If the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from communication connection, and the target service side has adapted the target interaction specification.
The gateway equipment provided by the embodiment of the application acquires the predefined target interaction specification between the original target service party and the requester; processing interaction between the original target service party and the requester based on the target interaction specification; and if the adaptation completion information sent by the target service party is received, updating the service party information corresponding to the target interaction specification, and processing the interaction between the target service party and the requester based on the target interaction specification. Therefore, the interaction method only needs the new service side to adapt to the interaction specification corresponding to the original service side, and does not need any modification by the requesting side, so that the adaptation time is shortened, and the adaptation efficiency is improved.
It should be noted that, the embodiment of the gateway device in the present application and the embodiment of the interaction method in the present application are based on the same inventive concept, so the specific implementation of this embodiment may refer to the implementation of the corresponding interaction method, and the repetition is not repeated.
Further, in accordance with the above-described interaction method, based on the same technical concept, the present application further provides a computer-readable storage medium, for storing computer-executable instructions, where in a specific embodiment, the storage medium may be a usb disk, an optical disc, a hard disk, etc., and the computer-executable instructions stored in the storage medium when executed by a processor can implement the following procedures:
the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester;
Processing interactions between the original target server and the requestor based on the target interaction specification;
If the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway device, the original target service side and the requesting side are disconnected from communication connection, and the target service side has adapted the target interaction specification.
When being executed by a processor, the computer executable instructions stored by the storage medium provided by the embodiment of the application acquire a predefined target interaction specification between an original target service party and a requester; processing interaction between the original target service party and the requester based on the target interaction specification; and if the adaptation completion information sent by the target service party is received, updating the service party information corresponding to the target interaction specification, and processing the interaction between the target service party and the requester based on the target interaction specification. Therefore, the interaction method only needs the new service side to adapt to the interaction specification corresponding to the original service side, and does not need any modification by the requesting side, so that the adaptation time is shortened, and the adaptation efficiency is improved.
It should be noted that, the embodiments related to the storage medium and the embodiments related to the interaction method in the present application are based on the same inventive concept, so the specific implementation of this embodiment may refer to the implementation of the corresponding interaction method, and the repetition is not repeated.
The foregoing describes certain embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable GATE ARRAY, FPGA)) is an integrated circuit whose logic functions are determined by user programming of the device. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented with "logic compiler (logic compiler)" software, which is similar to the software compiler used in program development and writing, and the original code before being compiled is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but HDL is not just one, but a plurality of kinds, such as ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language), and VHDL (Very-High-SPEED INTEGRATED Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application SPECIFIC INTEGRATED Circuits (ASICs), programmable logic controllers, and embedded microcontrollers, examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each unit may be implemented in the same piece or pieces of software and/or hardware when implementing the embodiments of the present application.
It will be appreciated by those skilled in the art that one or more embodiments of the application may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. 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 apparatus that comprises the element.
One or more embodiments of the application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is by way of example only and is not intended to limit the present disclosure. Various modifications and changes may occur to those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. that fall within the spirit and principles of the present document are intended to be included within the scope of the claims of the present document.

Claims (9)

1. An interaction method, applied to a gateway device, comprising:
the method comprises the steps of obtaining a predefined target interaction specification between an original target service party and a requester;
Processing interactions between the original target server and the requestor based on the target interaction specification;
If the adaptation completion information sent by the target service side is received, updating the service side information corresponding to the target interaction specification, and processing the interaction between the target service side and the requester based on the target interaction specification;
the adaptation completion information indicates that the target service side and the requesting side establish communication connection through the gateway equipment, the original target service side and the requesting side are disconnected from communication connection, and the target service side is adapted to the target interaction specification;
the number of the service parties is a plurality of;
The processing interactions between the target server and the requestor based on the target interaction specification includes:
Determining a target server for processing the target request in response to the target request sent by the requester;
if the target interaction specification corresponding to the target server meets the request specification of the target request, forwarding the target request to the target server;
and receiving a target response body returned by the target service side, and returning the target response body to the requesting side if the target response body meets the response specification in the target interaction specification.
2. The interaction method of claim 1, wherein the determining a target server that processes the target request in response to the target request sent by the requestor comprises:
Determining a target function for processing the target request in response to the target request sent by the requester;
And determining a target service party corresponding to the target function based on the corresponding relation between the preset function and the service party.
3. The interaction method of claim 2, wherein after receiving the adaptation completion information transmitted by the target service side, the interaction method further comprises:
And updating the original target server in the corresponding relation between the preset function and the original target server to the target server.
4. The interaction method of claim 1, wherein the predefined interaction specification between the service party and the requestor comprises: the request pattern of the request body sent by the request party to the service party, and/or the response pattern of the response body returned by the service party to the request party, and/or the transmission protocol between the service party and the request party.
5. The interaction method of claim 4, wherein the interaction method further comprises:
If the request mode of the target request sent by the requester does not meet the request mode specification in the target interaction specification, and/or the transmission protocol content contained in the target request does not meet the transmission protocol specification in the target interaction specification, returning request error information to the requester;
And if the response mode of the target response body returned by the target service side does not meet the response mode specification in the target interaction specification, and/or the transmission protocol content contained in the target response body does not meet the transmission protocol specification in the target interaction specification, returning response error information to the target service side.
6. The interaction method of any of claims 1-5, wherein said target server interacts with a plurality of said requests Fang Jiaohu; each request sent by the requesting party comprises request content and request processing permission time;
The processing interactions between the target server and the requestor based on the target interaction specification includes:
analyzing a request to be processed sent by each requester in the same time period to obtain a request processing permission time corresponding to each requester in the same time period;
and processing the interaction between the target service party and each requester according to the duration of the request processing permission time corresponding to each requester based on the predefined target interaction specification between the target service party and each requester.
7. An interactive apparatus, comprising:
The acquisition module is used for acquiring a predefined target interaction specification between the original target service party and the requester;
The interaction module is used for processing interaction between the original target service party and the requester based on the target interaction specification;
The interaction updating module is used for updating the service side information corresponding to the target interaction specification if the adaptation completion information sent by the target service side is received, and processing the interaction between the target service side and the requesting side based on the target interaction specification;
The adaptation completion information indicates that the target service side and the requesting side establish communication connection through gateway equipment, the original target service side and the requesting side are disconnected from communication connection, and the target service side is adapted to the target interaction specification;
the interaction module comprises:
A determining unit, configured to determine a target server that processes the target request in response to the target request sent by the requester;
a forwarding unit, configured to forward the target request to the target server if a request specification of the target request is satisfied in target interaction specifications corresponding to the target server;
And the return unit is used for receiving the target response body returned by the target service side, and returning the target response body to the requesting side if the target response body meets the response specification in the target interaction specification.
8. A gateway device, comprising:
a memory for storing a computer program;
Processor for implementing the steps of the interaction method according to any of the claims 1-6 when executing said computer program.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the interaction method according to any of claims 1-6.
CN202211074892.0A 2022-09-02 2022-09-02 Interaction method, device, gateway equipment and storage medium Active CN116132246B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211074892.0A CN116132246B (en) 2022-09-02 2022-09-02 Interaction method, device, gateway equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211074892.0A CN116132246B (en) 2022-09-02 2022-09-02 Interaction method, device, gateway equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116132246A CN116132246A (en) 2023-05-16
CN116132246B true CN116132246B (en) 2024-07-09

Family

ID=86294403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211074892.0A Active CN116132246B (en) 2022-09-02 2022-09-02 Interaction method, device, gateway equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116132246B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667865A (en) * 2017-03-29 2018-10-16 贵州白山云科技有限公司 A kind of API request processing method and processing device
CN113315842A (en) * 2021-05-31 2021-08-27 中国民航信息网络股份有限公司 Information interaction method and related equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6594700B1 (en) * 1999-06-14 2003-07-15 International Business Machines Corporation System and method for implementing a universal service broker interchange mechanism
JP2006350729A (en) * 2005-06-16 2006-12-28 Hitachi Ltd Application software construction method, application software construction processing program, and application software construction system
US20080240385A1 (en) * 2007-03-30 2008-10-02 Veraz Networks, Inc. Black phone presence services
US8775577B1 (en) * 2007-12-18 2014-07-08 Amazon Technologies, Inc. System and method for configuration management service
CN102255933B (en) * 2010-05-20 2016-03-30 中兴通讯股份有限公司 Cloud service intermediary, cloud computing method and cloud system
CN110519254A (en) * 2019-08-21 2019-11-29 科大国创软件股份有限公司 A kind of interactive interfacing protocol fitting method and its system based on script
CN112054998A (en) * 2020-08-10 2020-12-08 中粮招商局(深圳)粮食电子交易中心有限公司 Proxy service method, device, equipment and computer readable storage medium
CN114390108B (en) * 2021-12-07 2024-03-12 新浪技术(中国)有限公司 Method and system for processing user service request
CN114531289A (en) * 2022-02-21 2022-05-24 平安普惠企业管理有限公司 System interaction method based on artificial intelligence and related equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667865A (en) * 2017-03-29 2018-10-16 贵州白山云科技有限公司 A kind of API request processing method and processing device
CN113315842A (en) * 2021-05-31 2021-08-27 中国民航信息网络股份有限公司 Information interaction method and related equipment

Also Published As

Publication number Publication date
CN116132246A (en) 2023-05-16

Similar Documents

Publication Publication Date Title
US10797886B2 (en) Blockchain consensus method and device
TWI696083B (en) A consensus method and device based on blockchain
CN108418851B (en) Policy issuing system, method, device and equipment
US11005947B2 (en) Network information processing
CN108595234A (en) Five application page switching method, device and equipment
CN110765165B (en) Method, device and system for synchronously processing cross-system data
CN112597013A (en) Online development and debugging method and device
CN115841335B (en) Data processing method, device and equipment
CN110430255A (en) The processing method of service request, system and electronic equipment in distributed type assemblies
CN117478725A (en) Method, device, medium and electronic equipment for managing micro-service API
CN116132246B (en) Interaction method, device, gateway equipment and storage medium
CN113436007B (en) Transaction processing method, device, system and equipment based on block chain
CN110245166B (en) Data checking method and device
CN110022351B (en) Service request processing method and device
CN111796864A (en) Data verification method and device
CN115396375B (en) Service processing method, device and equipment
CN111324778B (en) Data and service processing method and device and electronic equipment
CN115033350A (en) Execution method and device of distributed transaction
CN113761400A (en) Access request forwarding method, device and equipment
TWI714017B (en) Data processing method, device and server
CN111931797B (en) Method, device and equipment for identifying network to which service belongs
CN111984720A (en) Data acquisition method and device, electronic equipment and interface adaptation device
CN117041980B (en) Network element management method and device, storage medium and electronic equipment
CN107196711B (en) The method and device of signal transmission
CN111552977A (en) Method, device and system for determining application permission

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