CN112839038A - Method and system for transmitting data through one-way communication between servers - Google Patents
Method and system for transmitting data through one-way communication between servers Download PDFInfo
- Publication number
- CN112839038A CN112839038A CN202110002646.3A CN202110002646A CN112839038A CN 112839038 A CN112839038 A CN 112839038A CN 202110002646 A CN202110002646 A CN 202110002646A CN 112839038 A CN112839038 A CN 112839038A
- Authority
- CN
- China
- Prior art keywords
- request
- data
- message
- message queue
- servers
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000004891 communication Methods 0.000 title claims abstract description 45
- 230000004044 response Effects 0.000 claims abstract description 24
- 230000005540 biological transmission Effects 0.000 claims abstract description 15
- 238000004590 computer program Methods 0.000 claims description 15
- 238000012544 monitoring process Methods 0.000 claims description 8
- 230000002085 persistent effect Effects 0.000 claims description 7
- 238000002955 isolation Methods 0.000 abstract description 4
- 238000012545 processing Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 230000002159 abnormal effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/02—Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
- H04L63/0281—Proxies
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24553—Query execution of query operations
- G06F16/24561—Intermediate data storage techniques for performance improvement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/2866—Architectures; Arrangements
- H04L67/2876—Pairs of inter-processing entities at each side of the network, e.g. split proxies
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/562—Brokering proxy services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
The application relates to a method and a system for transmitting data through one-way communication between servers, which comprises the following steps: the method comprises the steps that a request proxy service receives a data request, converts the data request into a serializable request object, serializes the request object to obtain a request stream and sends the request stream to message middleware, wherein the request proxy service is configured in a first network area; the message middleware transmits the request flow to a message queue in an asynchronous message mode; and the response agent service responds to the request flow in the message queue, deserializes the request flow to obtain the request object, wherein the response agent service is configured in a second network area, and the first network area and the second network area are communicated in a one-way mode. By the method and the device, the data transmission of the network environment under specific isolation among the servers can be realized under the condition that the network environment is not broken.
Description
Technical Field
The present application relates to the technical field of server communication and data transmission, and in particular, to a method and system for transmitting data through unidirectional communication between servers.
Background
At present, in various industry organizations of governments, enterprises and banks, the data security problem of various service information systems is a serious issue, so that the information system construction can select an isolated network environment to isolate important service data from an intranet environment which cannot be accessed by an external network, such as network protocols such as VPN (virtual private network protocol) and NAT (network address translation protocol). However, in many cases, such a network environment needs to consider both confidentiality of data and service system usage, which may bring certain technical difficulties to the service analysis of data acquisition operations of the client-oriented service system.
In summary, no effective solution is proposed at present for the problem of cross-server data transmission in a specific isolated network environment.
Disclosure of Invention
The embodiment of the application provides a method and a system for transmitting data through unidirectional communication between servers, so as to at least solve the problem of cross-server data transmission in a specific isolated network environment in the related technology, and ensure that a service system can normally acquire data stored in a network isolation area without breaking the network environment.
In a first aspect, an embodiment of the present application provides a method for transmitting data through unidirectional communication between servers, including the following steps: the method comprises the steps that a request proxy service receives a data request, converts the data request into a serializable request object, serializes the request object to obtain a request stream and sends the request stream to message middleware, wherein the request proxy service is configured in a first network area; the message middleware transmits the request flow to a message queue in an asynchronous message mode; and the response agent service responds to the request flow in the message queue, deserializes the request flow to obtain the request object, wherein the response agent service is configured in a second network area, and the first network area and the second network area are communicated in a one-way mode.
In some embodiments, after deserializing the request stream to obtain the request object, the method includes: and analyzing a request data source address in the request object, and forwarding the request object to a data source interface of a response to execute data query according to the request data source address to obtain a query result.
In some of these embodiments, the method further comprises: and monitoring the message queue, receiving the query result, and gradually returning the query result to the client.
In some embodiments, the message middleware transmitting the request stream in an asynchronous message to a message queue includes: connecting to the message middleware, establishing a connection, and opening a channel; declaring a switch, setting switch attributes, wherein the switch attributes comprise: one or more of switch type, whether persistent; declaring a message queue, setting message queue attributes, the message queue attributes comprising: one or more of whether exclusive, persistent, auto-delete; binding the switch and the message queue through a routing key; the request flow is sent to the switch, and the request flow is distributed to the bound message queue according to a routing rule through the switch; closing the channel and the connection.
In some of these embodiments, the request object includes: one or more of a request data source address, a request method, a content type, a service name, a request header, a request parameter, a payload, whether or not cache lookup is supported.
In some of these embodiments, the method further comprises: judging whether the request object supports cache query, if so, splicing the request data source address, the request method, the request head and the request parameter of the request object into a character string as a cache key, querying whether a query result of the data request exists in cache middleware based on the cache key, and if so, taking out the query result from the cache middleware.
In some of these embodiments, "responding to the stream of requests in the message queue" includes: connecting to the message middleware, establishing a connection, and opening a channel; monitoring the message queue, responding to the request flow in the message queue, wherein the acquired request flow is deleted from the message queue; closing the channel and the connection.
In some of these embodiments, the method further comprises: and receiving a data request of a client, and forwarding the data request to a request proxy service, wherein the data request is used for requesting to acquire data from the second network area.
In a second aspect, an embodiment of the present application provides a system for transmitting data through unidirectional communication between servers, where the system includes: the request proxy service is used for receiving a data request, converting the data request into a serializable request object, serializing the request object to obtain a request stream, and sending the request stream to the message middleware; message middleware for transmitting the request flow to a message queue in an asynchronous message mode; and the response agent service is used for responding to the request flow in the message queue and deserializing the request flow to obtain the request object.
In some of these embodiments, the system further comprises: and the service system gateway is used for receiving a data request of a client and forwarding the data request to a request proxy service, wherein the data request is used for requesting the second network area to acquire data.
In some of these embodiments, the system further comprises: and the data query gateway is used for analyzing a request data source address in the request object, forwarding the request object to a data source interface responding to the request data source address to perform data query, and obtaining a query result.
In some of these embodiments, the system further comprises: and the cache middleware is used for storing the query result of the data query gateway into a cache and directly obtaining the query result from the cache when the service system requests the same data next time.
In some embodiments, the data query gateway concatenates the service addresses according to the configured back-end service ip address and the port number, constructs the request header and the request parameters of the request object into the request header and the request body of the gateway service, and performs data query to obtain a query result.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the method for transmitting data through unidirectional communication between servers as described in the first aspect.
In a fourth aspect, the present application provides a storage medium, on which a computer program is stored, where the program is executed by a processor to implement the method for transmitting data through unidirectional communication between servers as described in the first aspect.
Compared with the related art, the method for transmitting data through one-way communication between the servers, provided by the embodiment of the application, solves the problem of cross-server data transmission in a specific isolated network environment in the related art. Message middleware supporting the AMQP protocol is used as a communication broker across gatekeepers, which receives messages from producers (business services) and sends the received messages to consumers (response broker services) that process the messages according to established routing rules. The data in the network isolation area is subscribed to the message middleware, the request stream is deserialized to obtain a request object, data query is performed according to the request object, and a query result is obtained and returned to the message queue. The invention can safely, accurately and efficiently transmit the data required by the service system without breaking the network environment.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a schematic diagram of a method for unidirectional data communication between servers according to an embodiment of the present application;
FIG. 2 is an architecture diagram of a method and system for unidirectional data communication between servers according to an embodiment of the present application;
FIG. 3 is a typical application scenario of the method and system for one-way communication data transmission between servers;
FIG. 4 is a webflux flowchart of a method and system for unidirectional communication of data between servers;
FIG. 5 is an AMQP flow diagram of a method and system for one-way communication of data between servers;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
The embodiment provides a method for transmitting data through unidirectional communication between servers, and the flow of the method is shown in fig. 1, and the method comprises the following steps:
102, a request proxy service receives a data request, converts the data request into a serializable request object, serializes the request object to obtain a request stream, and sends the request stream to a message middleware, wherein the request proxy service is configured in a first network area;
103, the message middleware transmits the request flow to a message queue in an asynchronous message mode;
104, responding to the request flow in the message queue by the response agent service, deserializing the request flow to obtain a request object, wherein the response agent service is configured in a second network area, and the first network area and the second network area are in one-way communication;
In step 101, the client initiates an interface call through the service system, and forwards the data request of the client to the service system gateway, and the service system gateway forwards the data request to the request proxy service.
In step 102, referring to fig. 2, a request broker service is deployed in the first network region to convert the data request forwarded by the business system gateway into a serializable request object.
In one embodiment, the request object includes: one or more of a request data source address, a request method, a content type, a service name, a request header, a request parameter, a payload, whether or not cache lookup is supported.
In step 103, a manner of processing the request by using the responsive asynchronous framework webflux is used, and the embodiment of the present application extracts the data request by overwriting a handler method of the WebHandler, converts the data request into a request object, including the request path, the request method, the request header, the request body, the request parameter, and the like, and sends the request object to the message queue in an asynchronous call manner after serializing the request object. The flow chart of the implementation of the framework is shown in fig. 4, when a program processes a request, a main thread directly hands over a task to a sub-thread for processing, and the main thread does not need to wait. Through the active framework constructed based on SpringWebFlux, data requests are processed asynchronously, so that various functions under a synchronous environment are executed in a parallel mode, the generation of a large number of threads in a high concurrency state is avoided, the blocking probability is reduced, the condition of thread queuing is avoided, the processing of a large number of requests can be processed by a small number of fixed threads, the follow-up upgrading is facilitated, and the concurrency processing capability of data transmission access is improved to a great extent.
In one embodiment, "transmitting a request stream through a switch to a message queue in an asynchronous message" includes: connecting to message middleware, establishing a connection, and opening a channel;
declaring a switch and setting switch attributes, wherein the switch attributes comprise: one or more of switch type, whether persistent;
declaring a message queue, setting message queue attributes, the message queue attributes comprising: one or more of whether exclusive, persistent, auto-delete;
binding the exchanger and the message queue through a routing key;
the request flow is sent to the exchanger, and the exchanger distributes the request flow to the bound message queue according to the routing rule;
the channel and connection are closed.
In this embodiment, the request data is converted into an AMQP serializable request object, sent to message middleware that supports the AMQP protocol, which is a network protocol. It supports communication between a compliant server and message middleware (messaging middleware broker). A message queue supporting AMQP is deployed in the first network region, the process flow is shown in figure 5,
the producer sends the message process:
(1) the producer connects to the message middleware (AMQP Broker), establishes a Connection (Connection), opens a Channel (Channel)
(2) The producer declares a switch and sets the relevant attributes, such as switch type, whether to persist, etc
(3) The producer declares a queue well to set up related attributes such as exclusive, persistent, auto-delete, etc
(4) The producer binds the switch and queue by a binding key (routing key)
(5) The producer sends the message to the message middleware (AMQP Broker) which contains information such as routing keys, switches, etc
(6) The corresponding switch looks up the matching queue according to the received routing key.
(7) If so, the message sent from the producer is stored in the corresponding queue.
(8) If not, then either discard or rollback to the producer is selected based on the attributes configured by the producer
(9) The channel is closed.
(10) The connection is closed.
In step 104, in response to the proxy service being deployed in the second network region, the proxy service listens to the message queue and receives the request message, and deserializes the request message into a request object.
In one embodiment, "listening to a message queue and receiving a request stream" includes:
connecting to message middleware, establishing a connection, and opening a channel;
monitoring a message queue, and acquiring a request stream in the message queue, wherein the acquired request stream is deleted from the message queue;
the channel and connection are closed.
In the present embodiment, the flow of the process is as shown in fig. 5,
the consumer receives the message process:
(1) the consumer connects to the message middleware (AMQP Broker), establishes a Connection (Connection), and opens a Channel (Channel).
(2) The consumer requests the message middleware (AMQP Broker) to consume the message in the corresponding queue, may set the corresponding callback function, and do some preparation.
(3) Waiting for the message middleware (AMQP Broker) to reply and post the message in the corresponding queue, the consumer receives the message.
(4) The consumer acknowledges (ack) the received message.
(5) The message queue removes the corresponding acknowledged message from the queue.
(6) The channel is closed.
(7) The connection is closed.
In step 105, after receiving the request message, the data query gateway concatenates the service address according to the configured back-end service ip address and the port number, constructs the request header and the request parameter of the request object into the request header and the request body of the gateway service, and then starts to execute the query.
In other embodiments, results may also be queried directly from the cache based on whether cache queries are supported. Specifically, the method comprises the following steps:
judging whether the request object supports cache query, if so, splicing a request data source address, a request method (GET/POST/PUT/DELETE), a request head and a request parameter of the request object into a character string as a cache key, querying whether a query result of the data request exists in the cache middleware or not based on the cache key, and if so, taking the query result out of the cache middleware.
In this embodiment, the attributes of the request object are as follows:
{
"requestPath":"",
"requestMethod":"",
"contentType":"",
"serviceName":"",
"httpHeaders":{},
"queryParams":{},
"payload":"":
"allowCache":"":
}
and querying whether the cache middleware has a query result of the request through the cache key, if so, directly taking out the query result from the cache and returning the result, and if not, acquiring a service address of the data query gateway according to gateway configuration, and executing the step 105. The data is read from the database only when the data is accessed for the first time through the Query Cache (Query Cache), and the same data is directly returned from the storage medium after being queried, so that the Query response time of a user is shortened, and the background calculation amount is reduced.
After step 105, the method further comprises: and 106, monitoring the message queue, receiving the query result, and gradually returning the query result to the client.
In this step, the data query gateway returns the query result to the response proxy service, the response proxy service transmits the query result to the message queue, the request proxy service monitors the query result and returns the query result to the service system gateway, and the service system takes out the response result from the service system gateway and then performs service operation.
For example, fig. 3 illustrates a typical application scenario of the method and system described in the embodiment of the present application: in a suite of applications deployed in a first network area 202 and a second network area 205, wherein the first network area 202 does not have access to the second network area 205 and the second network area 205 has access to the first network area 202; the first network area 202 is deployed with a backend service facing a public network environment, when a user needs to query private data of the individual when performing an operation, the data is stored in the second network area 205, and a request enters the backend service 203 through the slb public network entrance 201, wherein the service a determines that the data of the second network area 205 needs to be queried, forwards the request to the message queue data synchronization system 204 described in the present application, and then the system forwards the request to the backend service 206 of the second network area, and the backend service 206 returns a query result or an abnormal result according to the interface query database 207 and gradually returns the query result or the abnormal result to the client.
Through the steps 101 to 106, the invention provides a method for transmitting data through unidirectional communication between servers, which solves the problem of cross-server data transmission in a specific isolated network environment in the related art. Specifically, the message middleware supporting the AMQP protocol is used as a communication medium at two ends of the gatekeeper, and the AMQP agent delivers the message to the consumers who subscribe to the queue or the consumers obtain the message according to the requirements. The communication intermediary receives messages from the producer (business service) and sends the received messages to the consumer (response broker service) that processes the messages according to established routing rules. The data in the network isolation area is subscribed to the message middleware, the request stream is deserialized to obtain a request object, data query is performed according to the request object, and a query result is obtained and returned to the message queue. The method has the advantages that the message queue conforming to the AMQP protocol is used, the channel communication is adopted, a plurality of threads and a plurality of channels are adopted, the performance bottleneck is improved, the webflux response type programming technology is used by the request server, and a large amount of time can be saved by asynchronously processing the request. The invention can safely, accurately and efficiently transmit the data required by the service system without breaking the network environment.
Based on the same conception, the application provides a system for transmitting data through one-way communication between servers, which comprises the following steps:
and the service system gateway is used for receiving a data request of a client and forwarding the data request to a request proxy service, wherein the data request is used for requesting the second network area to acquire data.
The request proxy service is used for receiving a data request, converting the data request into a serializable request object, serializing the request object to obtain a request stream, and sending the request stream to the message middleware.
And the message middleware is used for transmitting the request flow to a message queue in an asynchronous message mode.
And the response agent service is used for responding to the request flow in the message queue and deserializing the request flow to obtain the request object.
And the data query gateway is used for analyzing a request data source address in the request object, forwarding the request object to a data source interface responding to the request data source address to perform data query, and obtaining a query result.
In one embodiment, the business system gateway, the request broker service, the message middleware, and the data query gateway are further configured to perform step 106 in response to the broker service.
In one embodiment, the system further comprises: and the cache middleware is used for storing the query result of the data query gateway into a cache and directly obtaining the query result from the cache when the service system requests the same data next time.
In one embodiment, the data query gateway splices the service address according to the configured back-end service ip address and the port number, constructs the request head and the request parameters of the request object into the request head and the request body of the gateway service, and executes data query to obtain a query result;
the present embodiment also provides an electronic device comprising a memory 304 and a processor 302, wherein the memory 304 stores a computer program, and the processor 302 is configured to execute the computer program to perform the steps of any of the above method embodiments.
Specifically, the processor 302 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
The processor 302 reads and executes the computer program instructions stored in the memory 304 to implement the method for transmitting data in one-way communication between any of the servers in the above-described embodiments.
Optionally, the electronic apparatus may further include a transmission device 306, wherein the transmission device 306 is connected to the processor 302.
The transmitting device 306 may be used to receive or transmit data via a network. Specific examples of the network described above may include wired or wireless networks provided by communication providers of the electronic devices. In one example, the transmission device includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmitting device 306 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Alternatively, in this embodiment, the processor 302 may be configured to execute the following steps by a computer program:
s101, receiving a data request of a client, and forwarding the data request to a request proxy service, wherein the data request is used for requesting a second network area to acquire data.
S102, converting the data request into a request object, serializing the request object into a request stream, and sending the request stream to a message middleware supporting an AMQP protocol.
S103, serializing the request object to obtain a request stream, and transmitting the request stream to a message queue through a switch in an asynchronous message mode.
S104, monitoring the message queue and receiving the request stream, performing reverse sequence on the request stream to obtain a request object, and forwarding the request object to the data query gateway.
S105, analyzing a request data source address in the request object, and forwarding the request object to a data source interface of the response according to the request data source address to execute data query to obtain a query result.
S106, monitoring the message queue, receiving the query result, and gradually returning the query result to the client.
It should be noted that, for specific examples in this embodiment, reference may be made to examples described in the foregoing embodiments and optional implementations, and details of this embodiment are not described herein again.
In addition, in combination with the method for transmitting data through unidirectional communication between servers in the foregoing embodiments, the embodiments of the present application may provide a storage medium to implement. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements a method for transmitting data in one-way communication between any of the servers in the above embodiments.
It should be understood by those skilled in the art that various features of the above embodiments can be combined arbitrarily, and for the sake of brevity, all possible combinations of the features in the above embodiments are not described, but should be considered as within the scope of the present disclosure as long as there is no contradiction between the combinations of the features. The above examples are merely illustrative of several embodiments of the present application, and the description is more specific and detailed, but not to be construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims (15)
1. A method for transmitting data through one-way communication between servers is characterized by comprising the following steps:
the method comprises the steps that a request proxy service receives a data request, converts the data request into a serializable request object, serializes the request object to obtain a request stream and sends the request stream to message middleware, wherein the request proxy service is configured in a first network area;
the message middleware transmits the request flow to a message queue in an asynchronous message mode;
and the response agent service responds to the request flow in the message queue, deserializes the request flow to obtain the request object, wherein the response agent service is configured in a second network area, and the first network area and the second network area are communicated in a one-way mode.
2. The method for transmitting data through unidirectional communication between servers as claimed in claim 1, wherein after "deserializing the request stream to obtain the request object", the method comprises:
and analyzing a request data source address in the request object, and forwarding the request object to a data source interface of a response to execute data query according to the request data source address to obtain a query result.
3. The method for transmitting data in one-way communication between servers according to claim 2, wherein the method further comprises:
and monitoring the message queue, receiving the query result, and gradually returning the query result to the client.
4. The method for transmitting data in one-way communication between servers according to claim 1, wherein the message middleware transmits the request stream to a message queue in an asynchronous message mode comprises:
connecting to the message middleware, establishing a connection, and opening a channel;
declaring a switch, setting switch attributes, wherein the switch attributes comprise: one or more of switch type, whether persistent;
declaring a message queue, setting message queue attributes, the message queue attributes comprising: one or more of whether exclusive, persistent, auto-delete;
binding the switch and the message queue through a routing key;
the request flow is sent to the switch, and the request flow is distributed to the bound message queue according to a routing rule through the switch;
closing the channel and the connection.
5. The method for transmitting data through one-way communication between servers according to claim 2, wherein the request object comprises: one or more of a request data source address, a request method, a content type, a service name, a request header, a request parameter, a payload, whether or not cache lookup is supported.
6. The method for transmitting data through one-way communication between servers according to claim 5, further comprising:
judging whether the request object supports cache query, if so, splicing the request data source address, the request method, the request head and the request parameter of the request object into a character string as a cache key, querying whether a query result of the data request exists in cache middleware based on the cache key, and if so, taking out the query result from the cache middleware.
7. The method for transmitting data through one-way communication between servers according to claim 1, wherein "responding to the request flow in the message queue" comprises:
connecting to the message middleware, establishing a connection, and opening a channel;
monitoring the message queue, responding to the request flow in the message queue, wherein the acquired request flow is deleted from the message queue;
closing the channel and the connection.
8. The method for unidirectional data communication and transmission between servers as claimed in claim 1, wherein the method further comprises:
and receiving a data request of a client, and forwarding the data request to a request proxy service, wherein the data request is used for requesting to acquire data from the second network area.
9. A system for one-way communication of data between servers, comprising:
the request proxy service is used for receiving a data request, converting the data request into a serializable request object, serializing the request object to obtain a request stream, and sending the request stream to the message middleware;
message middleware for transmitting the request flow to a message queue in an asynchronous message mode;
and the response agent service is used for responding to the request flow in the message queue and deserializing the request flow to obtain the request object.
10. The system for unidirectional data communication and transmission between servers as claimed in claim 9, wherein the system further comprises: and the service system gateway is used for receiving a data request of a client and forwarding the data request to a request proxy service, wherein the data request is used for requesting the second network area to acquire data.
11. The system for unidirectional data communication and transmission between servers as claimed in claim 9, wherein the system further comprises: and the data query gateway is used for analyzing a request data source address in the request object, forwarding the request object to a data source interface responding to the request data source address to perform data query, and obtaining a query result.
12. The system for unidirectional data communication and transmission between servers as claimed in claim 9, wherein the system further comprises: and the cache middleware is used for storing the query result of the data query gateway into a cache and directly obtaining the query result from the cache when the service system requests the same data next time.
13. The system for transmitting data through unidirectional communication between servers as claimed in claim 11, wherein the data query gateway concatenates the service addresses according to the configured ip address and port number of the backend service, constructs the request header and the request parameters of the request object into the request header and the request body of the gateway service, and performs data query to obtain the query result.
14. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the method for transmitting data in one-way communication between servers according to any one of claims 1 to 8.
15. A storage medium, in which a computer program is stored, wherein the computer program is configured to execute a method for transmitting data via unidirectional communication between servers according to any one of claims 1 to 8 when the computer program is executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110002646.3A CN112839038A (en) | 2021-01-04 | 2021-01-04 | Method and system for transmitting data through one-way communication between servers |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110002646.3A CN112839038A (en) | 2021-01-04 | 2021-01-04 | Method and system for transmitting data through one-way communication between servers |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112839038A true CN112839038A (en) | 2021-05-25 |
Family
ID=75927349
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110002646.3A Pending CN112839038A (en) | 2021-01-04 | 2021-01-04 | Method and system for transmitting data through one-way communication between servers |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112839038A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113364842A (en) * | 2021-05-31 | 2021-09-07 | 河南光悦网络科技有限公司 | Network data transmission method |
CN113596118A (en) * | 2021-07-16 | 2021-11-02 | 上海淇玥信息技术有限公司 | Communication method and device for bridging two isolated network domains and electronic equipment |
CN114050896A (en) * | 2021-11-26 | 2022-02-15 | 浩云科技股份有限公司 | Internal and external butt-joint service method, system, equipment and medium |
CN114124976A (en) * | 2021-11-30 | 2022-03-01 | 北京中电普华信息技术有限公司 | Service request processing system and method for realizing internal and external network penetration |
CN115665191A (en) * | 2022-10-09 | 2023-01-31 | 浪潮云信息技术股份公司 | User information synchronization method and system based on cloud storage system |
CN116634020A (en) * | 2023-07-25 | 2023-08-22 | 北京中科心研科技有限公司 | Data transmission module, data transmission method, and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070168301A1 (en) * | 2005-12-01 | 2007-07-19 | Firestar Software, Inc. | System and method for exchanging information among exchange applications |
CN106844784A (en) * | 2017-03-14 | 2017-06-13 | 上海网易小额贷款有限公司 | Data cache method, device and computer-readable recording medium |
CN109885410A (en) * | 2019-01-09 | 2019-06-14 | 广州视源电子科技股份有限公司 | Message sending method, device, computer equipment and storage medium |
CN110851248A (en) * | 2019-10-12 | 2020-02-28 | 中国平安财产保险股份有限公司 | Asynchronous task data processing method and device and computer readable storage medium |
CN111741017A (en) * | 2020-07-23 | 2020-10-02 | 平安国际智慧城市科技股份有限公司 | Data transmission method between internal network and external network and related equipment |
-
2021
- 2021-01-04 CN CN202110002646.3A patent/CN112839038A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070168301A1 (en) * | 2005-12-01 | 2007-07-19 | Firestar Software, Inc. | System and method for exchanging information among exchange applications |
CN106844784A (en) * | 2017-03-14 | 2017-06-13 | 上海网易小额贷款有限公司 | Data cache method, device and computer-readable recording medium |
CN109885410A (en) * | 2019-01-09 | 2019-06-14 | 广州视源电子科技股份有限公司 | Message sending method, device, computer equipment and storage medium |
CN110851248A (en) * | 2019-10-12 | 2020-02-28 | 中国平安财产保险股份有限公司 | Asynchronous task data processing method and device and computer readable storage medium |
CN111741017A (en) * | 2020-07-23 | 2020-10-02 | 平安国际智慧城市科技股份有限公司 | Data transmission method between internal network and external network and related equipment |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113364842A (en) * | 2021-05-31 | 2021-09-07 | 河南光悦网络科技有限公司 | Network data transmission method |
CN113364842B (en) * | 2021-05-31 | 2022-12-16 | 深圳市光网世纪科技有限公司 | Network data transmission method |
CN113596118A (en) * | 2021-07-16 | 2021-11-02 | 上海淇玥信息技术有限公司 | Communication method and device for bridging two isolated network domains and electronic equipment |
CN113596118B (en) * | 2021-07-16 | 2023-07-21 | 上海淇玥信息技术有限公司 | Communication method and device for bridging two isolated network domains and electronic equipment |
CN114050896A (en) * | 2021-11-26 | 2022-02-15 | 浩云科技股份有限公司 | Internal and external butt-joint service method, system, equipment and medium |
CN114124976A (en) * | 2021-11-30 | 2022-03-01 | 北京中电普华信息技术有限公司 | Service request processing system and method for realizing internal and external network penetration |
CN115665191A (en) * | 2022-10-09 | 2023-01-31 | 浪潮云信息技术股份公司 | User information synchronization method and system based on cloud storage system |
CN116634020A (en) * | 2023-07-25 | 2023-08-22 | 北京中科心研科技有限公司 | Data transmission module, data transmission method, and storage medium |
CN116634020B (en) * | 2023-07-25 | 2023-10-03 | 北京中科心研科技有限公司 | Data transmission module, data transmission method, and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112839038A (en) | Method and system for transmitting data through one-way communication between servers | |
US20200228433A1 (en) | Computer-readable recording medium including monitoring program, programmable device, and monitoring method | |
CN110351283B (en) | Data transmission method, device, equipment and storage medium | |
US6865605B1 (en) | System and method for transparently redirecting client requests for content using a front-end indicator to preserve the validity of local caching at the client system | |
CN111917900B (en) | Domain name agent request processing method and device | |
TW201029422A (en) | Methods, apparatuses, and computer program products for determining a network interface to access a network resource | |
US9015344B2 (en) | Method, apparatus and system for managing private network remotely using session initiation protocol | |
CN112073545B (en) | MP-TCP capability for transmitting server devices using DNS | |
US20230239326A1 (en) | Microservice-Based Service Mesh System and Service Oriented Architecture Governance Method | |
CN114501593B (en) | Network slice access method, device, system and storage medium | |
CN112612595A (en) | Method and device for establishing micro-service calling relationship, computer equipment and storage medium | |
CN113626208B (en) | Server communication method based on NIO asynchronous thread model | |
CN115297098A (en) | Edge service acquisition method and device, edge computing system, medium and equipment | |
WO2023273240A1 (en) | Micro-service calling method and apparatus, electronic device, and readable storage medium | |
CN114710560A (en) | Data processing method and system, proxy equipment and terminal equipment | |
CN113613279B (en) | Routing policy generation method and related equipment | |
WO2023186109A1 (en) | Node access method and data transmission system | |
CN114928638B (en) | Analysis method, device and monitoring equipment for network behaviors | |
KR20050112912A (en) | System and method for relaying data by use of socket applicaton program | |
CN112202780B (en) | Data transmission method, device, equipment and medium based on double sockets | |
WO2024067148A1 (en) | Edge interconnection service execution method, apparatus and system, electronic device, and medium | |
CN112181789B (en) | Equipment end log collection method based on AWS | |
US12079136B1 (en) | Cache look up during packet processing by uniformly caching non-uniform lengths of payload data in a dual-stage cache of packet processors | |
CN114390088B (en) | Interaction method and device of EDPS (electronic data transfer protocol) through OPC UA client and OPC UA server | |
EP4311280A1 (en) | Communication method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210525 |
|
RJ01 | Rejection of invention patent application after publication |