CN116939006A - Message transmission method, device and equipment - Google Patents

Message transmission method, device and equipment Download PDF

Info

Publication number
CN116939006A
CN116939006A CN202210359935.3A CN202210359935A CN116939006A CN 116939006 A CN116939006 A CN 116939006A CN 202210359935 A CN202210359935 A CN 202210359935A CN 116939006 A CN116939006 A CN 116939006A
Authority
CN
China
Prior art keywords
message
user
message processing
processing node
client
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
Application number
CN202210359935.3A
Other languages
Chinese (zh)
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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202210359935.3A priority Critical patent/CN116939006A/en
Publication of CN116939006A publication Critical patent/CN116939006A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the specification discloses a message transmission method, a message transmission device and message transmission equipment. The scheme may include: any message processing node in the distributed system can process the target message processing request by itself after acquiring the target message processing request to obtain a message to be transmitted; and determining a receiver of the message to be transmitted according to the message subscription relation data stored locally by the message processing node, and directly transmitting the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the client of the receiver and the message processing node based on the long connection information stored locally by the message processing node.

Description

Message transmission method, device and equipment
Technical Field
The present application relates to the field of distributed systems, and in particular, to a method, an apparatus, and a device for transmitting a message.
Background
The distributed system dynamically and randomly distributes the message processing tasks to each message processing node in the distributed system based on the load balancing strategy, so that the defect that the traditional centralized system can cause the shortage of central host resources and response bottlenecks is overcome, and the distributed system is widely applied. However, in the present distributed system, after a message processing task is randomly allocated to any message processing node, the message processing node cannot generally send a task processing result to a client by itself, but a centralized gateway node of the distributed system is required to forward the task processing result to a client of a user, so that the message transmission efficiency is affected.
Based on this, how to improve the efficiency of message transmission by using the distributed system becomes a technical problem to be solved.
Disclosure of Invention
The message transmission method, device and equipment provided by the embodiment of the specification can improve the efficiency of message transmission by using a distributed system.
In order to solve the above technical problems, the embodiments of the present specification are implemented as follows:
the message transmission method provided in the embodiment of the present disclosure is applied to any message processing node other than a gateway node in a distributed system, and includes:
acquiring a target message processing request;
processing the target message processing request to obtain a message to be transmitted;
determining identification information of a receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
and based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
The message transmission device provided in the embodiment of the present disclosure is applied to any message processing node other than a gateway node in a distributed system, and includes:
The first acquisition module is used for acquiring a target message processing request;
the processing module is used for processing the target message processing request to obtain a message to be transmitted;
the determining module is used for determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
and the first sending module is used for sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver based on the long connection information at the message processing node.
The embodiment of the present disclosure provides a message transmission device, where the device is any message processing node other than a gateway node in a distributed system, and the message transmission device includes:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a target message processing request;
processing the target message processing request to obtain a message to be transmitted;
Determining identification information of a receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
and based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
At least one embodiment provided in this specification enables the following benefits:
any message processing node in the distributed system can process the target message processing request by itself after acquiring the target message processing request to obtain a message to be transmitted; and determining a receiver of the message to be transmitted according to the message subscription relation data stored locally by the message processing node, and directly transmitting the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the client of the receiver and the message processing node based on the long connection information at the message processing node. Because the message to be transmitted is not required to be forwarded by using the centralized gateway node of the distributed system, the operation required to be executed in the message transmission process can be reduced, the message transmission efficiency can be improved, and the method is beneficial to reducing the equipment resources required to be consumed in the message transmission.
Drawings
In order to more clearly illustrate the embodiments of the present description or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments described in the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic application scenario diagram of a message transmission method according to an embodiment of the present disclosure;
fig. 2 is a flow chart of a message transmission method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a lane flow corresponding to the message transmission method in FIG. 2 according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a message transmission device corresponding to fig. 2 according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a message transmission device corresponding to fig. 2 according to an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of one or more embodiments of the present specification more clear, the technical solutions of one or more embodiments of the present specification will be clearly and completely described below in connection with specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without undue burden, are intended to be within the scope of one or more embodiments herein.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
In the prior art, in order to facilitate the distribution of a message processing request of a client by a distributed system and to send a message to be transmitted to the client, a centralized gateway node is usually set in the distributed system. The device where the long connection of the client of the receiver of the message to be transmitted is located can be determined by the centralized gateway node based on the long connection information by storing and managing the long connection information established between each device and each client in the distributed system at the centralized gateway node. Based on this, the message processing nodes in the distributed system typically need to forward the message to be transmitted by using a centralized gateway node, but cannot send the message to be transmitted to the client of the receiving party by itself.
It can be seen that the current message transmission scheme in the distributed system has relatively complex operation and relatively long message transmission link, thereby affecting the message transmission efficiency. Meanwhile, because each device in the distributed system may be deployed in machine rooms in different regions, there is often a situation of calling across machine rooms in the message transmission process, and centralized information storage is needed to be relied on, so that the message transmission efficiency is further affected, and the requirement for real-time information transmission cannot be met.
In order to solve the drawbacks of the prior art, the present solution provides the following embodiments:
fig. 1 is an application scenario schematic diagram of a message transmission method provided in an embodiment of the present disclosure.
As shown in fig. 1, a distributed system may include a plurality of message processing nodes, such as message processing node 101, message processing node 102, message processing node 103, message processing node 104, message processing node 105, and so on. The first user and the second user may be users having a business association relationship, or the first user and the second user may be users subscribed to the same target message subject, so that both the client 110 of the first user and the client 120 of the second user may establish a long connection with the same message processing node (e.g., the message processing node 105). Such that message subscription relationship data corresponding to the first user and the second user may be stored at the message processing node 105, as well as long connection information corresponding to the first user and the second user.
Subsequently, after the message processing node 105 obtains the target message processing request, the target message processing request can be processed to obtain a message to be transmitted; determining identification information of a receiver of the message to be transmitted according to the message subscription relation data at the message processing node; if the identification information of the receiver includes the identification information of the first user or the second user, the message to be transmitted may be sent to the client of the receiver directly by using the long connection pre-established between the message processing node 105 and the client of the receiver based on the long connection information at the message processing node 105.
In the scheme in fig. 1, the message to be transmitted does not need to be forwarded by using the centralized gateway node of the distributed system, so that the operation required to be executed in the message transmission process can be reduced, the message transmission efficiency can be improved, and the reduction of equipment resources required to be consumed in message transmission is facilitated.
Next, a message transmission method provided for the embodiments of the specification will be specifically described with reference to the accompanying drawings:
fig. 2 is a flow chart of a message transmission method according to an embodiment of the present disclosure. From a program perspective, the execution body of the flow may be any message processing node other than a gateway node in the distributed system, or an application program carried at any message processing node. As shown in fig. 2, the process may include the steps of:
step 202: a target message handling request is obtained.
In the embodiment of the present disclosure, the target message processing request may be sent by a client of the user, or may be sent by another service server, or may be generated by an execution entity of the scheme in fig. 2, which is not limited specifically. In practical application, the target message processing request may be used to request to issue a specified message, so that a specified user obtains the specified message through a client; alternatively, the target message processing request may be used to request execution of a specified data processing operation, generate a specified data processing result, and cause a specified user to acquire the specified data processing result through a client.
The distributed system to which the execution subject of the solution in fig. 2 belongs is generally used to implement a server corresponding to a client of a user. Thus, the distributed system may be a distributed resource sharing server cluster, which may comprise a plurality of server devices, and each server device is typically provided with the capability to process the target message processing request, based on which one server device in the distributed system may act as a message processing node.
In the prior art, the distributed system distributes the target message processing request to any message processing node randomly through a network node by deploying a centralized gateway node, storing and managing long connection information between each user client and a server device in the distributed system at the centralized gateway node, and forwarding a message to be transmitted generated by the message processing node to the user client.
However, in the operation process of the message transmission method in the embodiment of the present specification, the centralized gateway node is not required, and the message processing node itself is capable of implementing the route allocation of the message processing request and sending the message to be transmitted to the client of the user.
Step 204: and processing the target message processing request to obtain the message to be transmitted.
In the embodiment of the present disclosure, the execution body of the solution in fig. 2 has a capability of processing the target message processing request, so that the target message processing request may be processed to obtain a message to be transmitted. The message to be transmitted may be a specified message requested to be issued for the target message processing request, or the message to be transmitted may be a specified data processing result generated by performing a specified data processing operation.
Step 206: and determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node.
In the embodiment of the present specification, since identification information of a receiver of a message to be transmitted needs to be determined during the message transmission process. Therefore, the execution body (i.e., the message processing node) of the scheme in fig. 2 may store in advance message subscription relationship data, which may reflect the subscription relationship between the user and the message to be transmitted, based on which the identification information of the user having the subscription relationship with the message to be transmitted may be used as the identification information of the receiver of the message to be transmitted. The subscription relationship between the user and the message to be transmitted may indicate that the client of the user needs to acquire the message to be transmitted.
Step 208: and based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
In this embodiment of the present disclosure, the execution body of the scheme in fig. 2 may further store long connection information in advance, where the long connection information may reflect a long connection established between a receiver of a message to be transmitted and a designated server device in the distributed system, so that, based on the long connection information, a server device where a long connection of a client of the receiver is located may be determined.
In practical applications, because the number of users of the client is huge, the amount of information reflecting each long connection established by the clients of all users is huge, based on this, the execution body of the scheme in fig. 2 generally does not store information reflecting each long connection established by the clients of all users, but only needs to store long connection information corresponding to the client of the user who needs to be responsible for corresponding message transmission, that is, only needs to store long connection information of the user related to the message subscription relationship data at the message processing node. It can be known that, in the embodiment of the present disclosure, by dispersing the long connection information of the user to each message processing node for storage, the performance bottleneck existing in the centralized caching scheme is avoided, and the message calling operation can be reduced, so as to improve the message processing and transmission efficiency.
Specifically, when the message to be transmitted is transmitted, if the long connection information at the execution body of the scheme in fig. 2 indicates that the long connection is established with the client of the receiver, the execution body of the scheme in fig. 2 can directly use the long connection to send the message to be transmitted to the client of the receiver, so as to complete the transmission of the message to be transmitted, which is convenient and fast.
In the method in fig. 2, after any message processing node in the distributed system processes a target message processing request to obtain a message to be transmitted, a receiver of the message to be transmitted may be determined according to message subscription relationship data stored locally in the message processing node, and based on long connection information at the message processing node, the message to be transmitted may be directly sent to a client of the receiver by using a long connection pre-established between the client of the receiver and the message processing node. Because the message to be transmitted is not required to be forwarded by using the centralized gateway node of the distributed system, the operation required to be executed in the message transmission process can be reduced, the message transmission efficiency can be improved, and the method is beneficial to reducing the equipment resources required to be consumed in the message transmission.
Based on the method in fig. 2, the examples of the present specification also provide some specific embodiments of the method, as described below.
In the embodiment of the present disclosure, the application scenarios of the message transmission method in fig. 2 are various, for example, a scenario in which a plurality of users with business association relationships interact in real time and need to transmit interactive messages, or a scenario in which a message publisher (Pub) publishes a specified message under a target message Topic (Topic) and needs to push the specified message to a subscriber (Sub) in real time. The message transmission method in fig. 2 also has a difference between part of the operation steps when applied to different scenarios. This will be explained later for ease of understanding.
Assume that an application scenario is a scenario in which a plurality of users with business association relationships interact in real time and need to transmit interaction messages. For example, multiple users join the same video game scene through respective clients, or multiple users join the same video live room scene through respective clients.
In the prior art, in the first application scenario, a message processing request initiated by a client of each user may be randomly allocated to each message processing node, and because related data of other users may need to be acquired when the message processing request of the user is processed, each message processing node may need to request to acquire related user information from other message processing nodes to respond to the message processing request of the user. The scheme is complex in operation, so that a message transmission link is long, and the condition of calling across machine rooms in the interior is easy to exist, so that the processing efficiency of a message processing request is affected, and the instantaneity of message transmission is further affected.
In the embodiment of the present disclosure, a long connection is established between a plurality of clients of users having service association relationships and the same message processing node, so that the message processing node can process message processing requests of the plurality of users based on related user information acquired and generated by the message processing node, and transmit message processing results to each user directly based on the long connection established between the message processing node and the plurality of users, so as to improve message processing and message transmission efficiency.
In practical applications, the service association relationship may be used to indicate that the first user and the second user participate in the same video game, or the service association relationship may be used to indicate that the first user and the second user join the same video live room, or the like.
Based on this, the solution in fig. 2 may further comprise the step of letting the clients of a plurality of users having a business association establish a long connection with the same message processing node.
Specifically, step 202: before obtaining the target message processing request, the method may further include:
acquiring a first connection request of a first user; the first connection request is for requesting establishment of a long connection between a client of the first user and the message processing node.
And judging whether the first connection request carries token information corresponding to the message processing node or not to obtain a first judgment result.
And if the first judging result indicates that the first connection request does not carry the token information corresponding to the message processing node, establishing long connection between the client of the first user and the message processing node to obtain first long connection information.
And generating first message subscription relation data corresponding to the first user.
Transmitting the token information to a client of the first user; the token information is used for enabling a client of a second user with business association relation with the first user to establish long connection with the message processing node.
In the embodiment of the present disclosure, assuming that the first user is a user (for example, an initiator of an electronic game or a creator of a video live broadcasting room, etc.) who requests to establish a long connection from the distributed system among a plurality of users having a service association relationship, the distributed system may randomly allocate the first connection request of the first user to one message processing node (i.e., an execution subject of the method in fig. 2), and establish the long connection between the client of the first user and the message processing node. Subsequently, in order to facilitate the second user having the business association relationship with the first user to also establish a long connection with the message processing node, token information uniquely corresponding to the message processing node may be sent to the first user. The first user may then present or send the token information to the second user in order for the second user to establish a long connection with the message processing node based on the obtained token information.
It can be known that if the connection request of the user does not carry token information, the message processing node can directly establish long connection with the client of the user; if the connection request of the user carries the token information, the message processing node needs to establish long connection with the client of the user after determining that the token information is the token information with the corresponding relation.
In practical application, if the message processing node determines that the token information carried in the connection request of the user does not belong to the token information having the corresponding relation with the token information, the message processing node can also forward the connection request carrying the token information to the designated message processing node corresponding to the token information, so that the designated message processing node can conveniently establish long connection with the client of the user, and the normal operation of the service can be guaranteed.
In practical applications, the token information may be generated according to access address information (for example, public network IP address information) of the distributed system and intranet IP address information of the message processing node through a certain algorithm rule, or the token information may be generated based on other modes, which is not limited specifically. The distributed system only needs to be able to uniquely determine the message processing node based on the token information.
In the embodiment of the present specification, after the long connection between the client of the first user and the message processing node is established, first long connection information reflecting the long connection established between the client of the first user and the message processing node may be generated. In practical applications, the first long connection information may be Key-Value (Key-Value) formatted data. Specifically, the unique user identification information (for example, user ID) of the first user may be used as a Key Value, and the unique node identification information (for example, internal and external IP address information) of the message processing node may be used as a Value, where the Value may, of course, further include information such as a client name, a client version, a user ID, a system type, a network type, and the like of the first user, so as to find a long connection corresponding to the client of the first user based on the first long connection information.
In the embodiment of the present disclosure, since it is further required to determine which messages need to be transmitted to the first user, it is further required to generate first message subscription relationship data corresponding to the first user, where the first message subscription relationship data may be used to determine a message that needs to be sent to a client of the first user.
In the embodiment of the present disclosure, an implementation manner is further provided that, after the first user establishes a long connection with the message processing node, the second user having a service association relationship with the first user also establishes a long connection with the message processing node.
Specifically, after the sending the token information to the client of the first user, the method may further include:
acquiring a second connection request of the second user; the second connection request is used for requesting to establish a long connection between the client of the second user and the message processing node, and carries the token information acquired by the second user from the client of the first user.
And responding to the second connection request, and establishing long connection between the client of the second user and the message processing node to obtain second long connection information.
Second message subscription relationship data reflecting a message subscription relationship between the first user and the second user is generated.
In this embodiment of the present disclosure, since the second connection request of the second user carries token information corresponding to the message processing node, the message processing node may establish a long connection with the client of the second user, so as to obtain second long connection information reflecting the long connection between the two. In practical applications, the formats and the types of the information included in the second long connection information and the first long connection information may be identical, which is not described in detail.
In this embodiment of the present disclosure, since the token information carried in the second connection request of the second user is token information sent by the message processing node to the first user, and the first user and the second user have a service association relationship, the second connection request may further carry identification information of the first user, so that the message processing node generates second message subscription relationship data reflecting a message subscription relationship between the first user and the second user. Alternatively, the token information sent by the message processing node to the first user may be generated based on the identification information of the first user, so that the token information and the first user have a corresponding relationship, so that the message processing node may generate second message subscription relationship data reflecting the message subscription relationship between the first user and the second user based on the token information.
The message subscription relationship between the first user and the second user may be used to determine a message that needs to be sent to a client of the first user, and determine a message that needs to be sent to a client of the second user, where the message may be obtained by processing a message processing request of the first user and/or a message processing request of the second user.
In practical application, if the first user and the second user do not have a service association relationship with a third user, even if long connection is established between the first user and the second user and the third user and the same message processing node is established between the first user and the second user, the message processing node does not generate data reflecting the message subscription relationship between the first user and the second user and the third user, so that a message obtained by processing a message processing request of the first user and/or a message processing request of the second user is not transmitted to the third user, and normal operation of the service is ensured.
The embodiment of the present disclosure also provides a specific implementation manner of the message transmission method in fig. 2 in the application scenario one.
Specifically, step 202: acquiring the target message handling request may include:
acquiring a target message processing request; the target message processing request is a message processing request generated by a client of the first user based on user operation, or the target message processing request is a message processing request generated by a client of the second user based on user operation. Alternatively, the target message handling request may be a message handling request generated by a service provider's server device for related services of the first user and/or the second user.
Step 204: processing the target message processing request to obtain a message to be transmitted may include:
and processing the target message processing request according to the historical data related to the first user and/or the second user at the elimination processing node to obtain a message to be transmitted.
Step 206: determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node specifically may include:
and determining a receiver of the message to be transmitted from the first user and the second user according to second message subscription relation data reflecting the message subscription relation between the first user and the second user, and obtaining identification information of the receiver.
And step 208: based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by using the long connection pre-established between the message processing node and the client of the receiver specifically may include:
and based on the first long connection information and the second long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
In this embodiment of the present disclosure, the first user and the second user having a service association relationship may be users playing the same electronic game, or users watching the same video live broadcast room. The target message processing request may be generated based on a game operation of the first user or the second user or based on a floor operation of the first user or the second user. Correspondingly, the message to be transmitted obtained by processing the target message processing request may be a message reflecting the game operation result of the user, or a speaking message of the user, etc. The receiver of the message to be transmitted can be determined from the first user and the second user according to the actual situation, which is not particularly limited.
In the embodiment of the present disclosure, since a plurality of users having service association relationships are allowed to establish long connection with the same message processing node, the message processing node may obtain relevant user data required for processing each message processing request of the plurality of users, so that each message processing request may be directly processed. Compared with the scheme in the prior art that message processing requests of a plurality of users are randomly distributed to each message processing node, the message processing node needs to acquire relevant user data from other message processing nodes to process the message processing requests, the scheme in fig. 2 reduces the complexity of service processing and improves the real-time performance of the message by centralizing service logic of a plurality of users with service association relations on a single message processing node (i.e. a single server device).
Meanwhile, as the execution main body (i.e. the message processing node) of the method in fig. 2 establishes long connection with the clients of the users, and stores corresponding long connection information and message subscription relationship data, the message processing node can directly send the message to be transmitted to the clients of all the receivers based on local long connection, and the message to be transmitted does not need to be forwarded by using a centralized gateway node, thereby being beneficial to improving the message transmission efficiency and further guaranteeing the real-time performance of message transmission. It can be known that, in the message transmission method in fig. 2, the message to be transmitted can be prevented from being forwarded by using the centralized gateway node, so that on one hand, performance bottleneck existing in centralized storage is avoided, and on the other hand, message forwarding operation can be reduced, thereby being beneficial to improving the real-time performance of the message.
In practical application, the execution body of the method in fig. 2 may create a corresponding message queue for a plurality of users having service association relationships, and after determining a message to be transmitted, may first deliver the message to be transmitted to the message queue, and then asynchronously deliver the message in the message queue to a downlink message queue of a receiver through a routing inspection task. The downlink message queue of the receiver can also have a corresponding routing inspection task so as to asynchronously push the message in the downlink message queue of the receiver to the client of the receiver through the pre-established long connection, thereby realizing the transmission of the message.
Based on the same principle, when the client of the user uploads the target message processing request to the message processing node, the target message processing request can be firstly delivered to the uplink message queue of the user, and then the message in the uplink message queue is asynchronously pushed to the message processing node based on the pre-established long connection through the routing inspection task. In the embodiment of the present disclosure, the processing results of the client sending the message processing request and the server feeding back the request can be directly completed on the same link, so that the link is simplified.
The second application scenario of the message transmission method in fig. 2 may be: the message publisher (Pub) publishes a specified message under the target message Topic (Topic), which requires a scenario in which the specified message is pushed to the subscriber (Sub) in real time. For example, a corresponding message topic may be set for each stock, and the stock data provider may issue the information about the fluctuation of the specified stock in the target message topic as the specified message, and the user may acquire the scene of the specified message in real time by subscribing to the target message topic.
In the prior art, in the application scenario two, a client of a user may send a request message for subscribing or unsubscribing a target message topic to a message processing node in the distributed system, where the message processing node maintains a dynamic subscription relationship between the user and the target message topic. When the appointed message is required to be issued aiming at the target message theme, the subscribed users of the target message theme are traversed through a write-and-spread mode, the appointed message is stored in the own message queue of each subscribed user in a mode of calling the gateway node in batches through the ID of the appointed user, and then the appointed message is triggered to be pushed to the user according to the behavior of the user. The scheme not only needs to repeatedly store the same message to be transmitted of different users and wastes storage resources, but also has the serious time consumption of calling the gateway nodes in batches, and meanwhile, the condition of calling the gateway nodes in a cross-machine room exists, so that the processing efficiency of a message processing request is seriously influenced, and the real-time performance of the message is further influenced.
In view of the foregoing problems in the prior art, in the embodiments of the present disclosure, a portion of message processing nodes may be preset to be responsible for message publishing management for a target message topic, and a subscriber of the target message topic may be preferentially made to establish a long connection with the portion of message processing nodes, so that after the portion of message processing nodes obtain a message processing request for publishing a specified message in the target message topic, the portion of message processing nodes may directly transmit the specified message to each subscriber based on the long connection established between the message processing nodes and the subscriber, without calling a gateway node to forward the specified message, so as to improve message processing and message transmission efficiency.
Based on this, the scheme in fig. 2 may further include a step of having the user subscribe to the subject message topic through the client.
In particular, a message processing node in a distributed system may include a first message processing node, which may be a node for managing message subscription relationship data for a target message topic; the method of fig. 2 is particularly applicable to any of said first message handling nodes.
Step 202: before obtaining the target message processing request, the method may further include:
Acquiring a subscription request aiming at the target message theme and sent by a client of a third user; the client of the third user is a client which establishes long connection with any one of the first message processing nodes in advance, and third long connection information reflecting the long connection established in advance by the client of the third user is stored at any one of the first message processing nodes.
Generating third message subscription relation data for the target message topic in response to the subscription request; the third message subscription relationship data is the message subscription relationship data reflecting a subscription relationship between the third user and the target message topic.
In this embodiment of the present disclosure, a long connection may be pre-established between the client of the third user and any one of the first message processing nodes (i.e. the execution body of the scheme in fig. 2), so that any one of the first message processing nodes may obtain a subscription request for the target message topic sent by the client of the third user.
In practical application, since each subscriber of the target message subject may not have a direct service association relationship, each subscriber may independently establish a long connection with the first message processing node, that is, the third subscriber and the first message processing node may not involve token information when establishing the long connection.
Specifically, the first message processing node may obtain a third connection request of a third user; the third connection request may be for requesting establishment of a long connection between the client of the third user and the first message processing node; and responding to the third connection request, directly establishing long connection between the client of the third user and the first message processing node, and obtaining third long connection information. Without determining whether the third connection request carries token information corresponding to the first message processing node. Of course, the step of determining whether the third connection request carries token information corresponding to the first message processing node may also be performed, and only a long connection between the two may be established regardless of the determination result. This is not particularly limited.
In the embodiment of the present specification, after the long connection between the third user and the first message processing node is established, third long connection information reflecting the long connection between the two may also be generated. In practical applications, the formats and the types of the third long connection information and the first long connection information may be identical, which will not be described in detail.
In the embodiment of the present specification, the subscription request for the target message topic sent by the client of the third user may be generated based on an operation that the user exposes the message in the target message topic in the client. For example, when the third user browses the rising and falling trend data of the target stock in the client, it may be indicated that the third user subscribes to the target message topic corresponding to the target stock. And when the third user closes the display page of the rising and falling trend data of the target stock in the client, the third user can be indicated to cancel the subscription of the target message theme corresponding to the target stock. Therefore, the accuracy of the message subscription relation data maintained at the first message processing node is ensured, and the trouble brought to the user by transmitting the message of which the user is unsubscribed is avoided. Of course, the subscription request for the target message topic may also be generated based on other operations of the user in the client, which is not particularly limited.
In the embodiment of the present specification, the third message subscription relationship data generated by the first message processing node in response to the subscription request may indicate that a message published in the target message topic needs to be transmitted to a third user. So that the receiver of the message to be transmitted is determined based on the third message subscription relationship data.
In the embodiment of the specification, an implementation manner is also provided that enables a message publisher to publish a message in a target message topic, so as to transmit the message to a subscriber of the target message topic.
Specifically, step 202: acquiring the target message handling request may include:
acquiring a message issuing request of a message issuing party aiming at the target message theme; the message publishing request is for requesting a specified message to be published for the target message topic.
Step 204: processing the target message processing request to obtain a message to be transmitted may include:
responding to the message publishing request, and publishing the specified message by utilizing message middleware deployed in the distributed system; and carrying out consumption operation on the appointed message at the message middleware to obtain a message to be transmitted.
In the embodiment of the present disclosure, the number of the first message processing nodes may be one or more, which is not limited in particular. The message publisher may send a message publication request for a target message topic to any of the first message processing nodes (e.g., the execution body of the scheme in fig. 2).
If there are multiple first message processing nodes, the execution body of the solution in fig. 2 may issue, in response to the message issue request, a specified message requested to be issued by the message issue request to a message middleware in the distributed system. Each first message processing node may subscribe to the target message topic at the message middleware in advance, so that each first message processing node obtains the specified message through message consumption at the message middleware, and further transmits the specified message to a user connected with the specified message and subscribed to the target message topic.
In practical applications, since the execution body of the scheme in fig. 2 may be used to issue the specified message, the execution body of the scheme in fig. 2 may not consume the specified message from the message middleware any more, so as to save device resources. Furthermore, if only a single first message processing node exists, the first message processing node may not issue the specified message to the message middleware, so as to save equipment resources.
In practical application, the message publisher may also send a message publishing request for the target message topic to the second message processing node, so that the second message processing node publishes the specified message to the message middleware, where each first message processing node may obtain the specified message from the message middleware.
In addition, any message processing node in the distributed system may directly send the specified message to each first message processing node after acquiring the message publishing request, without message transmission through the message middleware. It is only necessary to ensure that each first message processing node can acquire the specified message.
In the embodiment of the specification, a specific implementation manner of the first message processing node to acquire the specified message in the target message theme from the message middleware is also provided.
Specifically, step 202: acquiring the target message handling request may include:
a message consumption request for the target message topic is obtained.
Step 204: processing the target message processing request to obtain a message to be transmitted may include:
responding to the message consumption request, and performing consumption operation on the designated message at the message middleware deployed in the distributed system to obtain a message to be transmitted; the specified message is a message published to the message middleware according to a message publication request of a message publisher for the target message topic.
In the embodiment of the specification, the first message processing node may consume the message in the target message theme from the message middleware based on the message consumption request for the target message theme, so as to acquire the message to be transmitted. The message consumption request for the target message topic may be generated by a periodic message consumption task at the first message processing node, or may be generated by a message middleware after having a message in the target message topic to be consumed, which is not limited specifically.
For the above embodiments, the present specification also provides an implementation manner in which the first message processing node sends the message to be transmitted to the client of the user by using the long connection.
Specifically, step 206: determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node can comprise:
and determining the identification information of the user subscribed to the target message theme according to the message subscription relation data at any one of the first message processing nodes to obtain the identification information of the receiver.
Step 208: based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by using a long connection pre-established between the message processing node and the client of the receiver may include:
and based on the third long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the third user, sending the message to be transmitted to the client of the third user by utilizing the long connection pre-established between the client of the third user and any one of the first message processing nodes.
In the embodiment of the present disclosure, since the third user subscribed to the target message topic directly establishes a long connection with the first message processing node, and the first message processing node stores the third long connection information between the third user and the first message processing node, and subscription relationship data between the third user and the target message topic, the first message processing node can determine that the third user is a receiver of the message to be transmitted, and further directly uses the long connection between the third user and the first message processing node to realize message transmission. The message forwarding step is not required to be executed by using a centralized gateway node in the distributed system, so that the real-time performance of message transmission is improved.
In this embodiment of the present disclosure, the message processing node may further include a second message processing node, where the second message processing node may be a message processing node other than the first message processing node, that is, the second message processing node is not generally responsible for managing message publishing of the subject message.
However, since the long connection between the user and the distributed system is generally not changed along with the message subject subscribed or unsubscribed by the user, at the same time, only a part of the message processing nodes in the distributed system may be responsible for managing the message publication of the target message subject, so that a situation that the user subscribed to the target message subject does not establish a long connection with the first message processing node, but establishes a long connection with the second message processing node may occur.
Based on this, in the embodiment of the present specification, there is also provided an implementation manner in which a user who has established a long connection with the second message processing node obtains a message in a target message topic to which the user subscribes.
Specifically, step 202: before obtaining the target message processing request, the method may further include:
acquiring fourth message subscription relation data aiming at the target message theme and sent by the second message processing node; the fourth message subscription relation data is the message subscription relation data generated by the second message processing node according to a subscription request of a fourth user for the target message subject, and the client of the fourth user is a client which establishes long connection with the second message processing node in advance. Or, acquiring a subscription request of a fourth user for the target message topic sent by the second message processing node, and generating fourth message subscription relation data reflecting a subscription relation between the fourth user and the target message topic based on the subscription request, wherein a client of the fourth user is a client which establishes long connection with the second message processing node in advance.
And generating fourth long connection information reflecting that the client of the fourth user establishes a long connection with the second message processing node.
Correspondingly, step 206: after determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node, the method may further include:
based on the fourth long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the fourth user, sending the message to be transmitted to the second message processing node; the second message processing node is configured to send the message to be transmitted to the client of the fourth user by using a long connection with the client of the fourth user.
In the embodiment of the present disclosure, the second message processing node sends the message subscription relationship data between the fourth user and the target message topic, which are connected with the second message processing node, to the first message processing node for management, and the first message processing node stores the long connection information between the second message processing node and the client of the fourth user. After the first message processing node acquires the message to be transmitted in the target message subject, the fourth user can be determined to be the receiving party of the message to be transmitted, and then the message to be transmitted is directly sent to the second message processing node, so that the message to be transmitted is sent to the client of the fourth user by using the long connection at the second message processing node. The message forwarding step is not required to be executed by using a centralized gateway node in the distributed system, so that the real-time performance of message transmission can be improved.
In the embodiment of the present specification, a first software development kit may be installed at the first message processing node; the first software development kit may be used to manage the message subscription relationship data and provide interface information for calls required for subscription requests for the target message topic. A second software development kit can be carried at the second message processing node; the second software development kit may be used to provide interface information for calls required for subscription requests for the subject message topic.
In practical applications, the first software development kit may be the same as the second software development kit or may be different from the first software development kit. However, the second software development kit may not have the capability to manage message subscription relationship data, as the second message processing node typically does not maintain a subscription relationship between users connected to its long connection and the target message topic, but rather needs to forward to the first message processing node for subscription relationship maintenance.
In combination with the above embodiments, it can be known that, when the message transmission method in the present specification is implemented, the message processing node in the distributed system may be configured to carry a specified software development kit to maintain the message subscription relationship data based on the specified software development kit, so that the message processing node may concentrate on service logic processing, and the data maintenance complexity of the message processing node is simplified. Meanwhile, the message processing node can traverse message subscription relation data and long connection information maintained by the local machine based on the appointed software development tool package so as to directly send the message to be transmitted to the client of the user through long connection, thereby reducing the call condition of a machine room, enabling the message to reach the client of the user more quickly and improving the real-time property of the message acquired by the user.
In addition, when the message transmission method in the specification is implemented, a plurality of message processing nodes can be set to be responsible for message publishing and transmission of the same message subject, and compared with the prior art, the method has the advantages that the method can solve the performance bottleneck caused by large calling quantity of the gateway nodes by calling the gateway nodes in batches based on the user IDs of the subscription users so as to push the messages to the subscription users, thereby being beneficial to further improving the real-time property of the messages acquired by the users.
In practical applications, as the number of subscribed users for a target message topic increases, there is a need for capacity expansion for a first message processing node responsible for message publishing of the target message topic.
Based on this, the method in fig. 2 may further include:
and acquiring load data of each first message processing node.
And judging whether the load data meets the capacity expansion condition or not to obtain a second judging result.
And if the second judging result indicates that the load data meets the capacity expansion condition, at least one first message processing node is newly added in the distributed system.
In this embodiment of the present disclosure, the load data of the first message processing node may be the number of subscription users corresponding to the message subscription relationship data managed by the load data. The capacity expansion condition may be that load data of at least part of the first message processing nodes reaches a preset threshold.
In practical applications, a management relationship between each first message processing node and the subject of the target message may be stored in the distributed system. When the first message processing node needs to be newly added in the distributed system, the management relationship between the second message processing node and the target message theme can be removed so as to change the second message processing node into the newly added first message processing node. Subsequently, when a subscription user aiming at a target message theme is newly added, the newly added first message processing node can be used for managing message subscription relation data between the subscription user and the target message theme and recording long connection information of the subscription user, so that the newly added first message processing node is used for transmitting the message to be transmitted in the target message theme, thereby achieving the capacity expansion effect and ensuring normal operation of the service.
Fig. 3 is a schematic flow chart of a lane corresponding to the message transmission method in fig. 2 according to an embodiment of the present disclosure. As shown in fig. 3, the message transmission flow may involve an execution body of a client of a user, a message processing node in a distributed system, a message publisher, or the like.
In the long connection establishment stage, aiming at the scene that a plurality of users with business association relations interact in real time and need to transmit interaction messages, the client of the user can generate a connection request and send the connection request to any message processing node in the distributed system. The message processing node may determine whether the connection request carries target token information, where the target token information is token information uniquely corresponding to the message processing node. If not, the message processing node can establish long connection with the client of the user to obtain long connection information; and sending the target token information to a client of the user so that the relevant user with the business association relation with the user can acquire the target token information from the user, and further, based on the target token information, establishing long connection with the message processing node. If yes, the message processing node can establish long connection with the client of the user to obtain long connection information. Therefore, a plurality of users with service association relations can all establish long connection with the same message processing node, so that the calling condition of internal cross-machine room is reduced, and the message processing and transmission efficiency is improved. Meanwhile, the message processing node can also generate message subscription relation data reflecting subscription relations among a plurality of users with business association relations so as to facilitate the subsequent determination of the receiving party of the message to be transmitted.
And when the message publisher publishes the specified message under the subject of the target message, the specified message needs to be pushed to the scene of the subscriber in real time, and the message processing node can directly respond to the connection request to establish long connection with the client of the user without judging whether token information corresponding to the message processing node is contained or not. Subsequently, if the message processing node obtains the subscription request of the user for the target message topic, message subscription relationship data between the user and the target message topic can be generated and managed.
In addition, if the message processing node with which the user establishes the long connection belongs to the second message processing node which is not responsible for managing the message subscription relationship data for the target message topic, after the second message processing node establishes the long connection with the client of the user, if the subscription request of the user for the target message topic is obtained, the message subscription relationship data between the user and the target message topic can be forwarded to any first message processing node, and meanwhile, the first message processing node also needs to store the long connection information between the user and the second message processing node so as to facilitate the subsequent transmission of the message to be transmitted in the target message topic.
In the message transmission stage, aiming at the scene that a plurality of users with business association relationship interact in real time and need to transmit interaction messages, the message processing node can acquire a target message processing request generated by a message publisher. Wherein the message publisher may be any one of a plurality of users having business associations, and the target message processing request may be generated based on an operation of the user with respect to the client. The message processing node can process the target message processing request to obtain a message to be transmitted; and determining the identification information of the receiver of the message to be transmitted from a plurality of users with service association relations according to the message subscription relation data at the message processing node. And based on the long connection information at the message processing node, directly sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
And when the message publisher publishes the specified message under the subject of the target message, the specified message needs to be pushed to the scene of the subscriber in real time, and the message processing node can acquire the target message processing request generated by the message publisher. The target message processing request may be used to request to publish a specified message for the target message topic, and in practical application, the message publisher and the subscriber of the target message topic may be different users. The message processing node can process the target message processing request to obtain a message to be transmitted; and determining identification information of a receiver (namely a subscribing user of a target message theme) of the message to be transmitted according to the message subscription relation data at the message processing node. And based on the long connection information at the message processing node, if the receiver and the message processing node are determined to establish long connection, directly sending the message to be transmitted to the client of the receiver by utilizing the long connection between the receiver and the message processing node. If the long connection information at the message processing node is based on the long connection information, the receiver and other message processing nodes are determined to establish long connection, the message to be transmitted can be sent to other message processing nodes which establish long connection with the receiver; so that other message processing nodes send the message to be transmitted to the client of the recipient, typically over a long connection.
Based on the same thought, the embodiment of the specification also provides a device corresponding to the method. Fig. 4 is a schematic structural diagram of a message transmission device corresponding to fig. 2 according to an embodiment of the present disclosure. As shown in fig. 4, the apparatus may be applied to any message processing node other than a gateway node in a distributed system, and the apparatus may include:
a first obtaining module 402, configured to obtain a target message processing request.
And a processing module 404, configured to process the target message processing request to obtain a message to be transmitted.
A determining module 406, configured to determine identification information of a receiver of the message to be transmitted according to the message subscription relationship data at the message processing node.
A first sending module 408, configured to send the message to be transmitted to the client of the receiver, based on the long connection information at the message processing node, using a long connection pre-established between the message processing node and the client of the receiver.
The present description example also provides some specific embodiments of the device based on the device of fig. 4, which is described below.
Optionally, the apparatus in fig. 4 may further include:
The second acquisition module is used for acquiring a first connection request of the first user; the first connection request is for requesting establishment of a long connection between a client of the first user and the message processing node.
And the first judging module is used for judging whether the first connection request carries token information corresponding to the message processing node or not to obtain a first judging result.
And the first long connection establishing module is used for establishing long connection between the client of the first user and the message processing node to obtain first long connection information if the first judgment result indicates that the first connection request does not carry token information corresponding to the message processing node.
And the first generation module is used for generating first message subscription relation data corresponding to the first user.
The second sending module is used for sending the token information to the client of the first user; the token information is used for enabling a client of a second user with business association relation with the first user to establish long connection with the message processing node. The business association relationship is used for indicating that the first user and the second user participate in the same video live broadcast room, or the business association relationship is used for indicating that the first user and the second user join in the same video live broadcast room.
Optionally, the apparatus in fig. 4 may further include:
a third obtaining module, configured to obtain a second connection request of the second user; the second connection request is used for requesting to establish a long connection between the client of the second user and the message processing node, and carries the token information acquired by the second user from the client of the first user.
And the second long connection establishment module establishes long connection between the client of the second user and the message processing node in response to the second connection request to obtain second long connection information.
And the second generation module is used for generating second message subscription relation data reflecting the message subscription relation between the first user and the second user.
Optionally, the apparatus in fig. 4, the first obtaining module may specifically be configured to:
acquiring a target message processing request; the target message processing request is a message processing request generated by a client of the first user based on user operation, or the target message processing request is a message processing request generated by a client of the second user based on user operation.
The determining module may specifically be configured to: and determining a receiver of the message to be transmitted from the first user and the second user according to second message subscription relation data reflecting the message subscription relation between the first user and the second user, and obtaining identification information of the receiver.
Optionally, the apparatus in fig. 4, the message processing node includes a first message processing node, where the first message processing node is configured to manage message subscription relationship data for a target message topic; the apparatus is applied to any one of the first message processing nodes; the apparatus may further include:
a fourth obtaining module, configured to obtain a subscription request for the target message topic sent by a client of a third user; the client of the third user is a client which establishes long connection with any one of the first message processing nodes in advance, and third long connection information reflecting the long connection established in advance by the client of the third user is stored at any one of the first message processing nodes.
A third generation module, configured to generate third message subscription relationship data for the target message topic in response to the subscription request; the third message subscription relationship data is the message subscription relationship data reflecting a subscription relationship between the third user and the target message topic.
Optionally, the apparatus in fig. 4, the first obtaining module may specifically be configured to:
acquiring a message issuing request of a message issuing party aiming at the target message theme; the message issuing request is used for requesting to issue a specified message aiming at the target message theme;
the processing module may be specifically configured to: responding to the message publishing request, and publishing the specified message by utilizing message middleware deployed in the distributed system; and carrying out consumption operation on the appointed message at the message middleware to obtain a message to be transmitted.
Optionally, the apparatus in fig. 4, the first obtaining module may specifically be configured to: a message consumption request for the target message topic is obtained.
The processing module may be specifically configured to: responding to the message consumption request, and performing consumption operation on the designated message at the message middleware deployed in the distributed system to obtain a message to be transmitted; the specified message is a message published to the message middleware according to a message publication request of a message publisher for the target message topic.
Optionally, the determining module in the apparatus of fig. 4 may specifically be configured to: and determining the identification information of the user subscribed to the target message theme according to the message subscription relation data at any one of the first message processing nodes to obtain the identification information of the receiver.
The first sending module may specifically be configured to: and based on the third long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the third user, sending the message to be transmitted to the client of the third user by utilizing the long connection pre-established between the client of the third user and any one of the first message processing nodes.
Optionally, the apparatus in fig. 4, where the message processing node further includes a second message processing node, where the second message processing node is a message processing node other than the first message processing node; the apparatus may further include:
a fifth obtaining module, configured to obtain fourth message subscription relationship data for the target message topic sent by the second message processing node; the fourth message subscription relation data is the message subscription relation data generated by the second message processing node according to a subscription request of a fourth user for the target message subject, and the client of the fourth user is a client which establishes long connection with the second message processing node in advance.
And the fourth generation module is used for generating fourth long connection information reflecting that the client of the fourth user establishes long connection with the second message processing node.
A third sending module, configured to send the message to be transmitted to the second message processing node, if it is determined that the identification information of the receiver includes the identification information of the fourth user, based on the fourth long connection information at any one of the message processing nodes; the second message processing node is configured to send the message to be transmitted to the client of the fourth user by using a long connection with the client of the fourth user.
Optionally, the apparatus in fig. 4, where the first message processing node is loaded with a first software development kit; the first software development kit is used for managing the message subscription relation data and providing interface information required to be called for a subscription request of the target message theme; a second software development kit is carried at the second message processing node; the second software development kit is used for providing interface information required to be invoked by a subscription request for the target message topic.
Optionally, the apparatus in fig. 4 may further include:
and a sixth acquisition module, configured to acquire load data of each of the first message processing nodes.
And the second judging module is used for judging whether the load data meets the capacity expansion condition or not to obtain a second judging result.
And the newly added node module is used for newly adding at least one first message processing node in the distributed system if the second judging result indicates that the load data meets the capacity expansion condition.
Based on the same thought, the embodiment of the specification also provides equipment corresponding to the method.
Fig. 5 is a schematic structural diagram of a message transmission device corresponding to fig. 2 according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus 500 may be any message processing node other than a gateway node in a distributed system, and the apparatus 500 may include:
at least one processor 510; and a memory 530 communicatively coupled to the at least one processor; wherein the memory 530 stores instructions 520 executable by the at least one processor 510, the instructions being executable by the at least one processor 510 to enable the at least one processor 510 to: 25. a message transmission apparatus comprising:
a target message handling request is obtained.
And processing the target message processing request to obtain the message to be transmitted.
And determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node.
And based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus shown in fig. 5, the description is relatively simple as it is substantially similar to the method embodiment, with reference to the partial description of the method embodiment being relevant.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. The designer programs itself to "integrate" a digital system onto a single PLD without requiring the chip manufacturer to design and fabricate application specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in the same piece or pieces of software and/or hardware when implementing the present application.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The 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 foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (23)

1. A message transmission method applied to any message processing node other than a gateway node in a distributed system, comprising:
acquiring a target message processing request;
processing the target message processing request to obtain a message to be transmitted;
determining identification information of a receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
and based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
2. The method of claim 1, further comprising, prior to the obtaining the target message processing request:
acquiring a first connection request of a first user; the first connection request is used for requesting to establish a long connection between a client of the first user and the message processing node;
Judging whether the first connection request carries token information corresponding to the message processing node or not to obtain a first judgment result;
if the first judging result indicates that the first connection request does not carry token information corresponding to the message processing node, establishing long connection between the client of the first user and the message processing node to obtain first long connection information;
generating first message subscription relation data corresponding to the first user;
transmitting the token information to a client of the first user; the token information is used for enabling a client of a second user with business association relation with the first user to establish long connection with the message processing node.
3. The method of claim 2, further comprising, after the sending the token information to the client of the first user:
acquiring a second connection request of the second user; the second connection request is used for requesting to establish a long connection between the client of the second user and the message processing node, and carries the token information acquired by the second user from the client of the first user;
Responding to the second connection request, and establishing long connection between the client of the second user and the message processing node to obtain second long connection information;
second message subscription relationship data reflecting a message subscription relationship between the first user and the second user is generated.
4. The method according to claim 3, wherein the obtaining the target message processing request specifically includes:
acquiring a target message processing request; the target message processing request is a message processing request generated by a client of the first user based on user operation, or the target message processing request is a message processing request generated by a client of the second user based on user operation;
the determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node specifically includes:
and determining a receiver of the message to be transmitted from the first user and the second user according to second message subscription relation data reflecting the message subscription relation between the first user and the second user, and obtaining identification information of the receiver.
5. The method according to any one of claims 2-4, wherein the business association is used for indicating that the first user and the second user participate in the same video live room, or the business association is used for indicating that the first user and the second user join the same video live room.
6. The method of claim 1, the message processing node comprising a first message processing node for managing message subscription relationship data for a target message topic; the method is applied to any one of the first message processing nodes;
before the target message processing request is acquired, the method further comprises:
acquiring a subscription request aiming at the target message theme and sent by a client of a third user; the client of the third user is a client which establishes long connection with any one of the first message processing nodes in advance, and third long connection information reflecting the long connection established in advance by the client of the third user is stored at any one of the first message processing nodes;
generating third message subscription relation data for the target message topic in response to the subscription request; the third message subscription relationship data is the message subscription relationship data reflecting a subscription relationship between the third user and the target message topic.
7. The method according to claim 6, wherein the obtaining the target message processing request specifically includes:
acquiring a message issuing request of a message issuing party aiming at the target message theme; the message issuing request is used for requesting to issue a specified message aiming at the target message theme;
The processing the target message processing request to obtain a message to be transmitted specifically includes:
responding to the message publishing request, and publishing the specified message by utilizing message middleware deployed in the distributed system;
and carrying out consumption operation on the appointed message at the message middleware to obtain a message to be transmitted.
8. The method according to claim 6, wherein the obtaining the target message processing request specifically includes:
acquiring a message consumption request aiming at the target message theme;
the processing the target message processing request to obtain a message to be transmitted specifically includes:
responding to the message consumption request, and performing consumption operation on the designated message at the message middleware deployed in the distributed system to obtain a message to be transmitted; the specified message is a message published to the message middleware according to a message publication request of a message publisher for the target message topic.
9. The method according to claim 7 or 8, wherein the determining the identification information of the receiver of the message to be transmitted according to the message subscription relationship data at the message processing node specifically comprises:
Determining the identification information of the user subscribed to the target message subject according to the message subscription relation data at any one of the first message processing nodes to obtain the identification information of the receiver;
the sending the message to be transmitted to the client of the receiver by using the long connection pre-established between the message processing node and the client of the receiver based on the long connection information at the message processing node specifically includes:
and based on the third long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the third user, sending the message to be transmitted to the client of the third user by utilizing the long connection pre-established between the client of the third user and any one of the first message processing nodes.
10. The method of claim 9, the message processing node further comprising a second message processing node, the second message processing node being a message processing node other than the first message processing node;
before the target message processing request is acquired, the method further comprises:
acquiring fourth message subscription relation data aiming at the target message theme and sent by the second message processing node; the fourth message subscription relation data is the message subscription relation data generated by the second message processing node according to a subscription request of a fourth user for the target message subject, and a client of the fourth user is a client which establishes long connection with the second message processing node in advance;
Generating fourth long connection information reflecting that a long connection is established between the client of the fourth user and the second message processing node;
after determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node, the method further comprises the following steps:
based on the fourth long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the fourth user, sending the message to be transmitted to the second message processing node; the second message processing node is configured to send the message to be transmitted to the client of the fourth user by using a long connection with the client of the fourth user.
11. The method of claim 10, the first message processing node hosting a first software development kit; the first software development kit is used for managing the message subscription relation data and providing interface information required to be called for a subscription request of the target message theme;
a second software development kit is carried at the second message processing node; the second software development kit is used for providing interface information required to be invoked by a subscription request for the target message topic.
12. The method of claim 10, further comprising:
load data of each first message processing node are acquired;
judging whether the load data meets the capacity expansion condition or not to obtain a second judgment result;
and if the second judging result indicates that the load data meets the capacity expansion condition, at least one first message processing node is newly added in the distributed system.
13. A message transmission apparatus for use in any message processing node other than a gateway node in a distributed system, comprising:
the first acquisition module is used for acquiring a target message processing request;
the processing module is used for processing the target message processing request to obtain a message to be transmitted;
the determining module is used for determining the identification information of the receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
and the first sending module is used for sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver based on the long connection information at the message processing node.
14. The apparatus of claim 13, further comprising:
The second acquisition module is used for acquiring a first connection request of the first user; the first connection request is used for requesting to establish a long connection between a client of the first user and the message processing node;
the first judging module is used for judging whether the first connection request carries token information corresponding to the message processing node or not to obtain a first judging result;
a first long connection establishing module, configured to establish a long connection between a client of the first user and the message processing node if the first judgment result indicates that the first connection request does not carry token information corresponding to the message processing node, so as to obtain first long connection information;
the first generation module is used for generating first message subscription relation data corresponding to the first user;
the second sending module is used for sending the token information to the client of the first user; the token information is used for enabling a client of a second user with business association relation with the first user to establish long connection with the message processing node.
15. The apparatus of claim 14, further comprising:
a third obtaining module, configured to obtain a second connection request of the second user; the second connection request is used for requesting to establish a long connection between the client of the second user and the message processing node, and carries the token information acquired by the second user from the client of the first user;
The second long connection establishment module responds to the second connection request to establish long connection between the client of the second user and the message processing node, so as to obtain second long connection information;
and the second generation module is used for generating second message subscription relation data reflecting the message subscription relation between the first user and the second user.
16. The apparatus of claim 15, wherein the first acquisition module is specifically configured to:
acquiring a target message processing request; the target message processing request is a message processing request generated by a client of the first user based on user operation, or the target message processing request is a message processing request generated by a client of the second user based on user operation;
the determining module is specifically configured to:
and determining a receiver of the message to be transmitted from the first user and the second user according to second message subscription relation data reflecting the message subscription relation between the first user and the second user, and obtaining identification information of the receiver.
17. The apparatus of claim 13, the message processing node comprising a first message processing node to manage message subscription relationship data for a target message topic; the apparatus is applied to any one of the first message processing nodes; the apparatus further comprises:
A fourth obtaining module, configured to obtain a subscription request for the target message topic sent by a client of a third user; the client of the third user is a client which establishes long connection with any one of the first message processing nodes in advance, and third long connection information reflecting the long connection established in advance by the client of the third user is stored at any one of the first message processing nodes;
a third generation module, configured to generate third message subscription relationship data for the target message topic in response to the subscription request; the third message subscription relationship data is the message subscription relationship data reflecting a subscription relationship between the third user and the target message topic.
18. The apparatus of claim 17, the first acquisition module is specifically configured to:
acquiring a message issuing request of a message issuing party aiming at the target message theme; the message issuing request is used for requesting to issue a specified message aiming at the target message theme;
the processing module is specifically configured to:
responding to the message publishing request, and publishing the specified message by utilizing message middleware deployed in the distributed system; and carrying out consumption operation on the appointed message at the message middleware to obtain a message to be transmitted.
19. The apparatus of claim 17, the first acquisition module is specifically configured to:
acquiring a message consumption request aiming at the target message theme;
the processing module is specifically configured to:
responding to the message consumption request, and performing consumption operation on the designated message at the message middleware deployed in the distributed system to obtain a message to be transmitted; the specified message is a message published to the message middleware according to a message publication request of a message publisher for the target message topic.
20. The apparatus according to claim 18 or 19, the determining module being specifically configured to:
determining the identification information of the user subscribed to the target message subject according to the message subscription relation data at any one of the first message processing nodes to obtain the identification information of the receiver;
the first sending module is specifically configured to:
and based on the third long connection information at any one of the message processing nodes, if the identification information of the receiver comprises the identification information of the third user, sending the message to be transmitted to the client of the third user by utilizing the long connection pre-established between the client of the third user and any one of the first message processing nodes.
21. The apparatus of claim 20, the message processing node further comprising a second message processing node, the second message processing node being a message processing node other than the first message processing node; the apparatus further comprises:
a fifth obtaining module, configured to obtain fourth message subscription relationship data for the target message topic sent by the second message processing node; the fourth message subscription relation data is the message subscription relation data generated by the second message processing node according to a subscription request of a fourth user for the target message subject, and a client of the fourth user is a client which establishes long connection with the second message processing node in advance;
a fourth generation module, configured to generate fourth long connection information reflecting that a client of the fourth user has established a long connection with the second message processing node;
a third sending module, configured to send the message to be transmitted to the second message processing node, if it is determined that the identification information of the receiver includes the identification information of the fourth user, based on the fourth long connection information at any one of the message processing nodes; the second message processing node is configured to send the message to be transmitted to the client of the fourth user by using a long connection with the client of the fourth user.
22. The apparatus of claim 21, further comprising:
a sixth obtaining module, configured to obtain load data of each of the first message processing nodes;
the second judging module is used for judging whether the load data meets the capacity expansion condition or not to obtain a second judging result;
and the newly added node module is used for newly adding at least one first message processing node in the distributed system if the second judging result indicates that the load data meets the capacity expansion condition.
23. A message transmission apparatus, the apparatus being any message processing node other than a gateway node in a distributed system, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a target message processing request;
processing the target message processing request to obtain a message to be transmitted;
determining identification information of a receiver of the message to be transmitted according to the message subscription relation data at the message processing node;
And based on the long connection information at the message processing node, sending the message to be transmitted to the client of the receiver by utilizing the long connection pre-established between the message processing node and the client of the receiver.
CN202210359935.3A 2022-04-06 2022-04-06 Message transmission method, device and equipment Pending CN116939006A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210359935.3A CN116939006A (en) 2022-04-06 2022-04-06 Message transmission method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210359935.3A CN116939006A (en) 2022-04-06 2022-04-06 Message transmission method, device and equipment

Publications (1)

Publication Number Publication Date
CN116939006A true CN116939006A (en) 2023-10-24

Family

ID=88377863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210359935.3A Pending CN116939006A (en) 2022-04-06 2022-04-06 Message transmission method, device and equipment

Country Status (1)

Country Link
CN (1) CN116939006A (en)

Similar Documents

Publication Publication Date Title
US10637947B2 (en) Scalable, real-time messaging system
US10382574B2 (en) Systems and methods for providing messages to multiple subscribers
US9843640B2 (en) Scalable, real-time messaging system
US20180139162A1 (en) Systems and methods for transferring message data
US9319363B1 (en) Scalable, real-time messaging system
US9277030B2 (en) Stream processing using a client-server architecture
CN106657314B (en) Cross-data center data synchronization system and method
JP2018531465A6 (en) System and method for storing message data
WO2018171543A1 (en) Method and device for broadcasting messages
CN112579148B (en) Service message processing method and device based on service agent and electronic equipment
US20170041266A1 (en) Scalable, real-time messaging system
CN116627333A (en) Log caching method and device, electronic equipment and computer readable storage medium
CN112769671A (en) Message processing method, device and system
KR20160110585A (en) Method for Defining Quality of Things based on DDS in Internet of Things
CN116939006A (en) Message transmission method, device and equipment
CN113835905B (en) Message queue load balancing method and device, electronic equipment and medium
CN115174587B (en) Data transmission system, method and device, computer readable storage medium and electronic equipment
CN114500546B (en) Communication message sending method, device and equipment based on load balancing cluster
KR20230144074A (en) Method and apparatus for using non-stop controller with local area network (LAN) for local cloud
US20110078233A1 (en) Apparatus, system, and method for improved performance of real time applications in intermittent connection environments
CN116803065A (en) Method and apparatus for using a high availability controller for a local cloud using a Local Area Network (LAN)
CN116248685A (en) Load balancing method, load balancing system, electronic equipment and storage medium

Legal Events

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