CN114268667A - Data forwarding method and device, computer equipment and storage medium - Google Patents

Data forwarding method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114268667A
CN114268667A CN202111567114.0A CN202111567114A CN114268667A CN 114268667 A CN114268667 A CN 114268667A CN 202111567114 A CN202111567114 A CN 202111567114A CN 114268667 A CN114268667 A CN 114268667A
Authority
CN
China
Prior art keywords
client
message
long connection
target
server
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.)
Granted
Application number
CN202111567114.0A
Other languages
Chinese (zh)
Other versions
CN114268667B (en
Inventor
王晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202111567114.0A priority Critical patent/CN114268667B/en
Publication of CN114268667A publication Critical patent/CN114268667A/en
Application granted granted Critical
Publication of CN114268667B publication Critical patent/CN114268667B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The application relates to the field of data forwarding, and provides a data forwarding method, a device, equipment and a computer storage medium, wherein the method comprises the following steps: acquiring a first target message sent by a client through long connection, and sending the first target message to a message middleware; acquiring a second target message sent by the service server through the message middleware; and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection. The application also relates to artificial intelligence, and the data forwarding method can be applied to cloud servers of big data and artificial intelligence platform cloud computing services.

Description

Data forwarding method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of load allocation, and in particular, to a data forwarding method and apparatus, a computer device, and a storage medium.
Background
Connections in the hypertext Transfer Protocol (HTTP) include short connections and long connections. In contrast to the short connection, which establishes a new connection for each new request or response, the long connection sends multiple requests and responses through the same connection, and the long connection does not disconnect after the request or response is sent, but waits for the next request or response within a certain time. The long connection can save the time for establishing the short connection for many times, reduce the delay of sending the message and improve the message sending efficiency. However, the long connection cannot be automatically disconnected after the request or the response is completed, and the forwarding of the long connection between the services may occupy a large number of ports of the server, so that the ports are exhausted, and the problem of service unavailability is caused.
Disclosure of Invention
The present application mainly aims to provide a data forwarding method, an apparatus, a computer device, and a storage medium, and aims to solve the problem of insufficient server ports caused by a large number of long connections.
In a first aspect, the present application provides a data forwarding method, where the data forwarding method includes the following steps:
acquiring a first target message sent by a client through long connection;
sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware;
acquiring a second target message sent by the service server through the message middleware, wherein the second target message is obtained by performing preset processing on the first target message;
and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
In a second aspect, the present application further provides a data forwarding apparatus, including:
the first target message acquisition module is used for acquiring a first target message sent by a client through long connection;
a first target message forwarding module, configured to send the first target message to a message middleware, so that a service server obtains the first target message through the message middleware;
a second target message obtaining module, configured to obtain, through the message middleware, a second target message sent by the service server, where the second target message is obtained by performing preset processing on the first target message;
and the second target message forwarding module is used for sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
In a third aspect, the present application also provides a computer device, which includes a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein when the computer program is executed by the processor, the data forwarding method as described above is implemented.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the data forwarding method as described above.
The application provides a data forwarding method, a data forwarding device, data forwarding equipment and a computer storage medium, and acquires a first target message sent by a client through long connection; sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware; acquiring a second target message sent by the service server through the message middleware, wherein the second target message is obtained by performing preset processing on the first target message; and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection. The target server and the service server are decoupled through the message middleware, so that the problem that server ports of the target server or the service server are insufficient due to the fact that a large number of long connections are established is solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a data forwarding method according to an embodiment of the present application;
fig. 2 is a usage scenario diagram of a data forwarding method according to an embodiment of the present application;
fig. 3 is a schematic block diagram of a data forwarding apparatus according to an embodiment of the present application;
fig. 4 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides a data forwarding method, a data forwarding device, computer equipment and a computer readable storage medium.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart of a data forwarding method according to an embodiment of the present application. The data forwarding method can be used in a terminal or a server to realize the forwarding of the target message generated by the terminal device or the server. The terminal can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device; the server may be an independent server, a server cluster, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Referring to fig. 2, fig. 2 is a usage scenario diagram according to an embodiment of the present application. As shown in fig. 2, a client sends a first target message to a target server through a long connection, so that the target server forwards the first target message to a service server through a message middleware, and obtains a second target message of the service server through the message middleware, so that the target server forwards the second target message to the client.
As shown in fig. 1, the data forwarding method includes steps S101 to S104.
Step S101, acquiring a first target message sent by a client through long connection.
Illustratively, since the long connection can send and receive messages for multiple times, establishing the long connection can effectively reduce the time spent in establishing the short connection for multiple times, and improve the efficiency of sending messages through the established connection.
In some embodiments, the method further comprises: and acquiring a long connection request of the client, establishing long connection with the client according to the long connection request, and storing the corresponding relation between the client and the long connection.
Illustratively, the client establishes a connection with the target server by means of initiating a request. Specifically, when a long connection needs to be established, the client initiates a long connection request to the target server.
In some embodiments, the obtaining the long connection request of the client and establishing the long connection with the client according to the long connection request includes: acquiring a long connection request of the client, wherein the long connection request comprises authentication information of the client; and authenticating the long connection request according to the authentication information, and if the long connection request passes the authentication, establishing long connection with the client.
Illustratively, in order to prevent the target server from establishing a connection with a client without permission, the target server authenticates the long connection request according to the authentication information in the long connection request before establishing the long connection with the client.
For example, the authentication information may be a user name and a password input by a user at the client, and the client sends a long connection request carrying the user name and the password to the target server, so that the target server performs authentication. Or, the authentication information may also be an identification number corresponding to the client, and the client sends a long connection request carrying the identification number to the target server, so that the target server performs authentication, specifically, the target server may authenticate the identification number in the long connection request by searching a pre-stored identification number list corresponding to the client having the permission to establish long connection. The authentication of the long connection request according to the authentication information in the long connection request may also be performed by other manners, which is not limited herein.
By authenticating the authentication information in the long connection request, the connection between the client without permission and the target server is prevented, and the safety of long connection is improved.
In some embodiments, the obtaining the long connection request of the client and establishing the long connection with the client according to the long connection request includes: the method comprises the steps of obtaining a long connection request of a client sent by a load balancer, and establishing long connection with the client according to the long connection request, wherein the load balancer is used for determining that the long connection request is forwarded to a target server when receiving the long connection request of the client based on a preset load balancing strategy.
Illustratively, the load balancer is configured to obtain the long connection request and send the long connection request to a target server in a distributed server cluster.
Illustratively, the load balancer may be, for example, an F5 load balancer, but is not limited thereto.
For example, the load balancing policy may be a polling policy, and the received long connection requests are distributed to different target servers in the receiving time sequence; the method can also be a weighted distribution strategy, and distributes the received long connection requests to different target servers according to preset distribution weights, and the target server with high distribution weight can obtain more long connection requests; of course, the load balancing policy is not limited thereto, and the load balancing policy may also be other allocation policies, which are not limited herein.
Illustratively, the load balancer can distribute the long connection request to different servers in the distributed server cluster, so as to prevent the processing capacity of a single server node from being too large, ensure stable operation of each target server, and achieve the effect of load balancing.
For example, in order to enable the target server to send a message to the client through the long connection, the corresponding relationship between the client and the long connection is stored, so that when the target server needs to send a message to the client, the long connection for sending the message can be determined according to the client receiving the message based on the corresponding relationship between the client and the long connection.
In some embodiments, the saving the correspondence between the client and the long connection includes: and storing the corresponding relation between the client and the long connection into a memory of a target server so that the target server can quickly determine the corresponding relation between the client and the long connection.
Illustratively, because the memory has the characteristic of high access rate, the corresponding relationship between the client and the long connection is stored in the memory of the target server, when the target server needs to send a message to the client, the corresponding long connection can be quickly determined, and the data forwarding efficiency of the target server is improved.
Step S102, the first target message is sent to a message middleware, so that the service server can obtain the first target message through the message middleware.
Illustratively, the message transmission is performed between the target server and the service server through message middleware.
Illustratively, the Message middleware may be a Message Queue (MQ).
In some embodiments, the message middleware comprises a first message queue; the sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware comprises: and sending the first target message to a first message queue so that a service server acquires the first target message through the first message queue.
Specifically, the target server sends the first target message to the first message queue, and the business server consumes the first target message from the first message queue.
Illustratively, by the message middleware, the decoupling between the target server and the service server is realized, and the coupling degree between the target server and the service server is reduced; in addition, the message middleware can also play a role in traffic peak clipping, so that the stability of the service server in response to a large number of messages is improved.
Step S103, obtaining a second target message sent by the service server through the message middleware, where the second target message is obtained by performing preset processing on the first target message.
Illustratively, after consuming the first target message through the message middleware, the service server processes the first target message according to its own service processing logic to obtain a second target message.
In some embodiments, the message middleware further comprises a second message queue; the obtaining, by the message middleware, the second target message sent by the service server includes: and acquiring a second target message sent by the service server through a second message queue.
For example, the first message queue and the second message queue may be the same message queue or different message queues, which is not limited herein.
Specifically, the service server sends the second target message to the second message queue, so that the target server consumes the second target message through the second message queue, and sends the second target message to the client.
In some embodiments, the method further comprises: and storing the corresponding relation between the client and the target server so as to determine the target server connected with the client.
Illustratively, the target server belongs to a distributed server cluster, and when a service server needs to send the second target message to the client, the service server first sends the second target message to the message middleware. In this case, the second target message consumed by the message middleware may be any server in the distributed server cluster, and therefore, the second target message needs to be sent to the target server that establishes a long connection with the client according to the correspondence between the client and the target server.
In some embodiments, the obtaining, by the message middleware, the second target message sent by the service server includes: and acquiring a second target message sent by a message consumption server according to the corresponding relation between the client and the target server, wherein the message consumption server and the target server belong to the same distributed server cluster.
Illustratively, the message consumption server is a server that consumes the second target message from the message middleware in the distributed server cluster, and according to the correspondence between the client and the target server, the message consumption server sends the second target message to the target server, so that the target server sends the second target message to the client.
In some embodiments, the saving the correspondence between the client and the target server includes: and storing the corresponding relation between the client and the target server into a distributed storage system so that the message consumption server can send the second target message to the target server according to the corresponding relation between the client and the target server.
For example, in order to enable any one server in the distributed server cluster to obtain the correspondence between the client and the target server, the correspondence between the client and the target server is saved in a distributed storage system.
And step S104, sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
For example, after the target server obtains the second target message, the long connection corresponding to the client is determined according to the corresponding relationship between the client and the long connection, and the second target message is sent to the long connection, so that the client can obtain the second target message through the long connection.
In the data forwarding method provided in the foregoing embodiment, the first target message sent by the client is obtained through long connection; sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware; acquiring a second target message sent by the service server through the message middleware, wherein the second target message is obtained by performing preset processing on the first target message; and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection. The target server and the service server are decoupled through the message middleware, so that the problem that server ports of the target server or the service server are insufficient due to the fact that a large number of long connections are established is solved.
Referring to fig. 3, fig. 3 is a schematic diagram of a data forwarding apparatus according to an embodiment of the present application, where the data forwarding apparatus may be configured in a server or a terminal, and is used to execute the foregoing data forwarding method.
As shown in fig. 3, the data forwarding apparatus includes: a first target message obtaining module 110, a first target message forwarding module 120, a second target message obtaining module 130, and a second target message forwarding module 140.
A first target message obtaining module 110, configured to obtain a first target message sent by a client through long connection;
a first target message forwarding module 120, configured to send the first target message to a message middleware, so that a service server obtains the first target message through the message middleware;
a second target message obtaining module 120, configured to obtain, through the message middleware, a second target message sent by the service server, where the second target message is obtained by performing preset processing on the first target message;
a second target message forwarding module 130, configured to send the second target message to the long connection corresponding to the client according to the corresponding relationship between the client and the long connection, so that the client obtains the second target message through the long connection.
Illustratively, the data forwarding apparatus further comprises a long connection establishing module.
And the long connection establishing module is used for acquiring a long connection request of the client, establishing long connection with the client according to the long connection request and storing the corresponding relation between the client and the long connection.
Illustratively, the long connection establishing module further comprises a load balancing sub-module.
And the load balancing submodule is used for acquiring a long connection request of the client sent by a load balancer and establishing long connection with the client according to the long connection request, wherein the load balancer is used for determining a target server corresponding to the long connection request when receiving the long connection request of the client based on a preset load balancing strategy.
Illustratively, the long connection establishing module further includes a request obtaining sub-module and a request authenticating sub-module.
And the request acquisition submodule is used for acquiring a long connection request of the client, wherein the long connection request comprises the authentication information of the client.
And the request authentication submodule is used for authenticating the long connection request according to the authentication information and establishing long connection with the client if the long connection request passes the authentication.
Illustratively, the first message forwarding module 120 comprises a first middleware module.
And the first middleware module is used for sending the first target message to a first message queue so that the service server can obtain the first target message through the first message queue.
Illustratively, the second message acquisition module 130 includes a second middleware module.
And the second middleware module is used for acquiring a second target message sent by the service server through a second message queue.
Illustratively, the data forwarding apparatus further includes a correspondence relation storage submodule.
And the corresponding relation storage submodule is used for storing the corresponding relation between the client and the target server so as to determine the target server which is connected with the client.
Illustratively, the second targeted message acquiring module 130 further includes a second targeted message acquiring sub-module.
And the second target message acquisition submodule is used for acquiring a second target message sent by the message consumption server according to the corresponding relation between the client and the target server, and the message consumption server and the target server belong to the same distributed server cluster.
Illustratively, the device further comprises a first saving submodule and a second saving submodule.
And the first storage submodule is used for storing the corresponding relation between the client and the long connection into a memory of a target server so that the target server can quickly determine the corresponding relation between the client and the long connection.
And the second storage submodule is used for storing the corresponding relation between the client and the target server into a distributed storage system so that the message consumption server can send the second target message to the target server according to the corresponding relation between the client and the target server.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus, the modules and the units described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The methods, apparatus, and devices of the present application are operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. 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. 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 above-described methods and apparatuses may be implemented, for example, in the form of a computer program that can be run on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal.
As shown in fig. 4, the computer device includes a processor, a memory, and a network interface connected by a system bus, wherein the memory may include a storage medium and an internal memory.
The storage medium may store an operating system and a computer program. The computer program comprises program instructions that, when executed, cause a processor to perform any of the data forwarding methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a storage medium, which when executed by a processor causes the processor to perform any of the data forwarding methods.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring a first target message sent by a client through long connection;
sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware;
acquiring a second target message sent by the service server through the message middleware, wherein the second target message is obtained by performing preset processing on the first target message;
and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
In one embodiment, when implementing the data forwarding method, the processor is configured to implement:
and acquiring a long connection request of the client, establishing long connection with the client according to the long connection request, and storing the corresponding relation between the client and the long connection.
In one embodiment, when the processor implements the obtaining of the long connection request of the client and establishes a long connection with the client according to the long connection request, the processor is configured to implement:
the method comprises the steps of obtaining a long connection request of a client sent by a load balancer, and establishing long connection with the client according to the long connection request, wherein the load balancer is used for determining a target server corresponding to the long connection request when receiving the long connection request of the client based on a preset load balancing strategy.
In one embodiment, when the processor implements the obtaining of the long connection request of the client and establishes a long connection with the client according to the long connection request, the processor is configured to implement:
acquiring a long connection request of the client, wherein the long connection request comprises authentication information of the client;
and authenticating the long connection request according to the authentication information, and if the long connection request passes the authentication, establishing long connection with the client.
In one embodiment, the processor, in implementing the sending the first targeted message to message middleware so that a service server acquires the first targeted message through the message middleware, is configured to implement:
and sending the first target message to a first message queue so that a service server acquires the first target message through the first message queue.
In one embodiment, the processor, when implementing the obtaining of the second target message sent by the service server through the message middleware, is configured to implement:
and acquiring a second target message sent by the service server through a second message queue.
In one embodiment, the processor, when implementing the method, is further configured to implement:
and storing the corresponding relation between the client and the target server so as to determine the target server connected with the client.
In one embodiment, the processor, when implementing the obtaining of the second target message sent by the service server through the message middleware, is configured to implement:
and acquiring a second target message sent by a message consumption server according to the corresponding relation between the client and the target server, wherein the message consumption server and the target server belong to the same distributed server cluster.
In one embodiment, when the saving of the correspondence between the client and the long connection is implemented, the processor is configured to implement:
and storing the corresponding relation between the client and the long connection into a memory of a target server so that the target server can quickly determine the corresponding relation between the client and the long connection.
In one embodiment, the processor, when implementing the saving of the correspondence between the client and the target server, is configured to implement:
and storing the corresponding relation between the client and the target server into a distributed storage system so that the message consumption server can send the second target message to the target server according to the corresponding relation between the client and the target server.
It should be noted that, as will be clearly understood by those skilled in the art, for convenience and brevity of description, the specific working process of data forwarding described above may refer to the corresponding process in the foregoing data forwarding control method embodiment, and details are not described herein again.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and a method implemented when the program instructions are executed may refer to the embodiments of the data forwarding method of the present application.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A data forwarding method is applied to a target server, and is characterized by comprising the following steps:
acquiring a first target message sent by a client through long connection;
sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware;
acquiring a second target message sent by the service server through the message middleware, wherein the second target message is obtained by performing preset processing on the first target message;
and sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
2. The data forwarding method of claim 1, wherein the method further comprises:
and acquiring a long connection request of the client, establishing long connection with the client according to the long connection request, and storing the corresponding relation between the client and the long connection.
3. The data forwarding method according to claim 2, wherein the obtaining of the long connection request of the client and the establishing of the long connection with the client according to the long connection request comprise:
the method comprises the steps of obtaining a long connection request of a client sent by a load balancer, and establishing long connection with the client according to the long connection request, wherein the load balancer is used for determining a target server corresponding to the long connection request when receiving the long connection request of the client based on a preset load balancing strategy.
4. The data forwarding method according to claim 2, wherein the obtaining of the long connection request of the client and the establishing of the long connection with the client according to the long connection request comprise:
acquiring a long connection request of the client, wherein the long connection request comprises authentication information of the client;
and authenticating the long connection request according to the authentication information, and if the long connection request passes the authentication, establishing long connection with the client.
5. The data forwarding method of any one of claims 1-4 wherein the message middleware comprises a first message queue, a second message queue;
the sending the first target message to a message middleware so that a service server acquires the first target message through the message middleware comprises:
sending the first target message to a first message queue so that a service server acquires the first target message through the first message queue;
the obtaining, by the message middleware, the second target message sent by the service server includes:
and acquiring a second target message sent by the service server through a second message queue.
6. The data forwarding method of any one of claims 1-4, wherein the method further comprises:
storing the corresponding relation between the client and the target server so as to determine the target server which establishes connection with the client;
the obtaining, by the message middleware, the second target message sent by the service server includes:
and acquiring a second target message sent by a message consumption server according to the corresponding relation between the client and the target server, wherein the message consumption server and the target server belong to the same distributed server cluster.
7. The data forwarding method of claim 6, wherein the saving the correspondence between the client and the long connection comprises:
storing the corresponding relation between the client and the long connection into a memory of a target server so that the target server can quickly determine the corresponding relation between the client and the long connection;
the storing the corresponding relationship between the client and the target server includes:
and storing the corresponding relation between the client and the target server into a distributed storage system so that the message consumption server can send the second target message to the target server according to the corresponding relation between the client and the target server.
8. A data transfer apparatus, characterized in that the data transfer apparatus comprises:
the first target message acquisition module is used for acquiring a first target message sent by a client through long connection;
a first target message forwarding module, configured to send the first target message to a message middleware, so that a service server obtains the first target message through the message middleware;
a second target message obtaining module, configured to obtain, through the message middleware, a second target message sent by the service server, where the second target message is obtained by performing preset processing on the first target message;
and the second target message forwarding module is used for sending the second target message to the long connection corresponding to the client according to the corresponding relation between the client and the long connection, so that the client can acquire the second target message through the long connection.
9. A computer arrangement, characterized in that the computer arrangement comprises a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein the computer program, when executed by the processor, implements the steps of the data forwarding method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, wherein the computer program, when being executed by a processor, carries out the steps of the data forwarding method according to any one of claims 1 to 7.
CN202111567114.0A 2021-12-20 2021-12-20 Data forwarding method, device, computer equipment and storage medium Active CN114268667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111567114.0A CN114268667B (en) 2021-12-20 2021-12-20 Data forwarding method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111567114.0A CN114268667B (en) 2021-12-20 2021-12-20 Data forwarding method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114268667A true CN114268667A (en) 2022-04-01
CN114268667B CN114268667B (en) 2024-05-07

Family

ID=80828169

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111567114.0A Active CN114268667B (en) 2021-12-20 2021-12-20 Data forwarding method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114268667B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114760348A (en) * 2022-04-28 2022-07-15 青岛海尔科技有限公司 Business processing method and device, storage medium and electronic device
CN115426392A (en) * 2022-11-02 2022-12-02 苏州万店掌网络科技有限公司 Equipment network management method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
CN110505275A (en) * 2019-07-16 2019-11-26 北京奇艺世纪科技有限公司 Data transmission method, system, server and computer readable storage medium
CN112612513A (en) * 2020-12-31 2021-04-06 平安养老保险股份有限公司 Message middleware upgrading method and device, computer equipment and storage medium
CN113452774A (en) * 2021-06-25 2021-09-28 睿视(苏州)视频科技有限公司 Message pushing method, device, equipment and storage medium
CN113596150A (en) * 2021-07-28 2021-11-02 南方电网数字电网研究院有限公司 Message pushing method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
CN110505275A (en) * 2019-07-16 2019-11-26 北京奇艺世纪科技有限公司 Data transmission method, system, server and computer readable storage medium
CN112612513A (en) * 2020-12-31 2021-04-06 平安养老保险股份有限公司 Message middleware upgrading method and device, computer equipment and storage medium
CN113452774A (en) * 2021-06-25 2021-09-28 睿视(苏州)视频科技有限公司 Message pushing method, device, equipment and storage medium
CN113596150A (en) * 2021-07-28 2021-11-02 南方电网数字电网研究院有限公司 Message pushing method and device, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114760348A (en) * 2022-04-28 2022-07-15 青岛海尔科技有限公司 Business processing method and device, storage medium and electronic device
CN114760348B (en) * 2022-04-28 2024-06-25 青岛海尔科技有限公司 Service processing method and device, storage medium and electronic device
CN115426392A (en) * 2022-11-02 2022-12-02 苏州万店掌网络科技有限公司 Equipment network management method, device, equipment and storage medium
CN115426392B (en) * 2022-11-02 2023-03-24 苏州万店掌网络科技有限公司 Equipment network management method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114268667B (en) 2024-05-07

Similar Documents

Publication Publication Date Title
US20190082026A1 (en) Interface invocation method and apparatus for hybrid cloud
CN114268667B (en) Data forwarding method, device, computer equipment and storage medium
CN110958281B (en) Data transmission method and communication device based on Internet of things
CN110554927A (en) Micro-service calling method based on block chain
CN110971703B (en) Service request method, device, server and storage medium based on connection pool
CN111478974B (en) Network connection method and device, electronic equipment and readable storage medium
CN105577602A (en) Data pushing method and data pushing device based on open application programming interface
CN112202744B (en) Multi-system data communication method and device
CN113361913A (en) Communication service arranging method, device, computer equipment and storage medium
CN114827161B (en) Service call request sending method and device, electronic equipment and readable storage medium
CN113259429A (en) Session keeping control method, device, computer equipment and medium
CN102932269A (en) Method and device for balancing load
CN112702336A (en) Security control method and device for government affair service, security gateway and storage medium
CN105357239A (en) Method and device for providing service, and method and device for acquiring service
CN107404489B (en) Mobile terminal sharing system and method
US10045372B2 (en) Management of the use of a gateway by a plurality of terminals
CN116961918A (en) Token acquisition method and device
CN116319960A (en) Service release method, device, computer equipment and storage medium
CN112131588B (en) Application access method, device, electronic equipment and storage medium
WO2014128732A1 (en) Correlation identity generation method for cloud environment
CN113746909A (en) Network connection method, device, electronic equipment and computer readable storage medium
CN113986760A (en) Microservice Mock testing method and device, computer equipment and storage medium
CN112799849A (en) Data processing method, device, equipment and storage medium
CN112837156A (en) Transaction method and device with fixed execution sequence
CN113419878B (en) Data operation 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
GR01 Patent grant
GR01 Patent grant