Message sending method, device, equipment and storage medium
By obtaining the identity of the target recipient in the message sending server cluster and finding the target device node in the distributed application coordination service cluster, and adding child nodes to realize message sending, the problem of inefficient message sending in the prior art is solved and efficient message transmission is achieved.
Patent Information
- Application Number
- CN202210048700.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-01-17
AI Technical Summary
In the scenario where the user establishes a communication connection with the backend, it is difficult for the prior art to efficiently send messages to users through specific machines, resulting in inefficient message transmission.
By obtaining the identity of the target receiver in the message sending server cluster, finding the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adding child nodes under the target device node. The content of the child node includes the identity of the target message and the target receiver to achieve efficient message transmission.
It realizes fast positioning and communication between the message sending server cluster and the receiver, improves message sending efficiency, and ensures that the target message can be transmitted to the target receiver efficiently and quickly.
Smart Images

Figure CN114328129B_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computer technology, and in particular to a message sending method, device, equipment and storage medium. Background Art
[0002] In the scenario where a user establishes a communication connection with the backend, the backend is usually equipped with a server cluster. When a user establishes a communication connection with the backend for the first time, a communication connection relationship is established with a machine in the server cluster (hereinafter referred to as the target machine) and a session is established. When the backend needs to send a message to the user, it needs to send the message to the user through a specific machine in the server cluster before the user can receive it. For example, it needs to send a message to the user based on the session on the target machine before the user can receive it. Based on this, it is necessary to provide a technical solution to improve the efficiency of message sending when it is necessary to send a message to the user through a specific machine. Summary of the Invention
[0003] The purpose of one or more embodiments of the present specification is to provide a message sending method, which is applied to a first server; the method includes: obtaining event information of a message sending event. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and a target message. According to the identifier of the target recipient, a target message sending server corresponding to the target recipient is determined in a message sending server cluster. A target device node corresponding to the target message sending server is searched in a distributed application coordination service cluster. A child node is added under the target device node. The content of the child node includes the identifier of the target message and the target recipient. The child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0004] The purpose of one or more embodiments of the present specification is to provide a message sending method, which is applied to a target message sending server in a message sending server cluster, including: obtaining an identifier of the target message sending server. Based on the identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster. Listening for new sub-node addition events under the target device node. After monitoring the occurrence of a new sub-node addition event under the target device node, obtaining the content of the newly added sub-node. The content of the sub-node includes the target message to be sent and the identifier of the target recipient corresponding to the target message. According to the identifier of the target recipient, the target message is sent to the target recipient.
[0005] The purpose of one or more embodiments of the present specification is to provide a message sending device, which is applied to a first server and includes: an information acquisition unit, which acquires event information of a message sending event. The message sending event is used to send a target message to a target recipient. The event information includes the identifier of the target recipient and the target message. A sending determination unit, which determines the target message sending server corresponding to the target recipient in the message sending server cluster based on the identifier of the target recipient. A node adding unit, which searches for a target device node corresponding to the target message sending server in a distributed application coordination service cluster. A child node is added under the target device node. The content of the child node includes the identifier of the target message and the target recipient. The child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0006] The purpose of one or more embodiments of the present specification is to provide a message sending device, which is applied to a target message sending server in a message sending server cluster, including: a node monitoring unit, which obtains the identifier of the target message sending server. Based on the identifier of the target message sending server, search for a target device node pre-established for the target message sending server in the distributed application coordination service cluster. Monitor new sub-node addition events under the target device node. A content acquisition unit, which obtains the content of the newly added sub-node after monitoring the occurrence of a new sub-node addition event under the target device node. The content of the sub-node includes the target message to be sent and the identifier of the target recipient corresponding to the target message. A message sending unit, which sends the target message to the target recipient based on the identifier of the target recipient.
[0007] The purpose of one or more embodiments of the present specification is to provide a message sending device, which is arranged in a first server and includes: a processor, and a memory arranged to store computer-executable instructions. When the computer-executable instructions are executed, the processor is caused to: obtain event information of a message sending event. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and a target message. According to the identifier of the target recipient, a target message sending server corresponding to the target recipient is determined in a message sending server cluster. The target device node corresponding to the target message sending server is searched in a distributed application coordination service cluster. A child node is added under the target device node. The content of the child node includes the identifier of the target message and the target recipient. The child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0008] The purpose of one or more embodiments of the present specification is to provide a message sending device, which is arranged in a target message sending server in a message sending server cluster, and includes: a processor, and a memory arranged to store computer-executable instructions. When the computer-executable instructions are executed, the processor: obtains the identifier of the target message sending server. Based on the identifier of the target message sending server, searches for a target device node pre-established for the target message sending server in the distributed application coordination service cluster. Listens for new sub-node addition events under the target device node. After monitoring the occurrence of a new sub-node addition event under the target device node, obtains the content of the newly added sub-node. The content of the sub-node includes the target message to be sent and the identifier of the target recipient corresponding to the target message. According to the identifier of the target recipient, the target message is sent to the target recipient.
[0009] The purpose of one or more embodiments of the present specification is to provide a storage medium, which is arranged in a first server and is used to store computer-executable instructions. When the computer-executable instructions are executed by the processor, the following method is implemented: obtaining event information of a message sending event. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and a target message. According to the identifier of the target recipient, the target message sending server corresponding to the target recipient is determined in the message sending server cluster. The target device node corresponding to the target message sending server is searched in the distributed application coordination service cluster. A child node is added under the target device node. The content of the child node includes the identifier of the target message and the target recipient. The child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0010] The purpose of one or more embodiments of the present specification is to provide a storage medium, which is arranged in a target message sending server in a message sending server cluster, and is used to store computer executable instructions. When the computer executable instructions are executed by the processor, the following method is implemented: obtaining the identifier of the target message sending server. Based on the identifier of the target message sending server, searching for the target device node pre-established for the target message sending server in the distributed application coordination service cluster. Listening for new sub-node addition events under the target device node. After monitoring the occurrence of a new sub-node addition event under the target device node, obtaining the content of the newly added sub-node. The content of the sub-node includes the target message to be sent and the identifier of the target recipient corresponding to the target message. According to the identifier of the target recipient, the target message is sent to the target recipient. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in one or more of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 A schematic diagram of an application scenario of the message sending method provided in one embodiment of this specification;
[0013] Figure 2 A flowchart of a message sending method provided in one embodiment of this specification;
[0014] Figure 3 A flowchart of a message sending method provided in another embodiment of this specification;
[0015] Figure 4 A schematic diagram of an application scenario of a message sending method provided in another embodiment of this specification;
[0016] Figure 5 A schematic diagram of a multi-party interaction process of a message sending method provided in one embodiment of this specification;
[0017] Figure 6 A schematic diagram of an application scenario of a message sending method provided in another embodiment of this specification;
[0018] Figure 7 A schematic diagram of a multi-party interaction process of a message sending method provided in another embodiment of this specification;
[0019] Figure 8 A schematic diagram of nodes in a distributed application coordination service cluster provided in an embodiment of this specification;
[0020] Figure 9 A schematic diagram of the structure of a message sending device provided in one embodiment of this specification;
[0021] Figure 10 A schematic structural diagram of a message sending device provided in another embodiment of this specification;
[0022] Figure 11 This is a structural diagram of a message sending device provided in one embodiment of this specification. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the technical solutions in one or more of the present specification, the technical solutions in one or more of the present specification will be clearly and completely described below in conjunction with the drawings in one or more of the present specification. Obviously, the described embodiments are only one or more partial embodiments of the present specification, not all of the embodiments. Based on one or more of the embodiments in the present specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document. It should be noted that, in the absence of conflict, one or more of the embodiments in the present specification and the features in the embodiments can be combined with each other. One or more embodiments of the present specification will be described in detail below with reference to the drawings and in conjunction with the embodiments.
[0024] One or more embodiments of the present specification provide a message sending mechanism. On the one hand, a target message sending server in a message sending server cluster establishes a target device node for itself in a distributed application coordination service cluster and monitors new sub-node addition events under the target device node. On the other hand, when the first server determines that the target message sending server needs to send the target message to the target recipient, the first server searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a sub-node under the target device node. The content of the sub-node includes the target message and the identifier of the target recipient. Therefore, after monitoring the occurrence of a new sub-node addition event under the target device node, the target message sending server obtains the content of the newly added sub-node, that is, obtains the identifier of the target message and the target recipient, and sends the target message to the target recipient based on the identifier of the target recipient.
[0025] Through the message sending mechanism in one or more embodiments of the present specification, for the first server, by adding a child node, it is possible to notify the target message sending server in the message sending server cluster of the target message to be sent and the identifier of the target recipient. For the target message sending server in the message sending server cluster, by listening to the new events of its corresponding child node, it is possible to obtain the target message to be sent and the identifier of the target recipient of the target message, and send the target message to the target recipient. In the scenario where the message sending server cluster communicates with the recipient, the target message sending server that communicates with the target recipient can be quickly located, so that the target message sending server can efficiently and quickly send the target message to the target recipient, thereby improving the message sending efficiency.
[0026] Figure 1 This is a schematic diagram of an application scenario of a message sending method provided in an embodiment of this specification, such as Figure 1As shown, the scenario includes a message sending server cluster, a distributed application coordination service cluster, a first server and a user terminal. Among them, the message sending server cluster includes multiple message sending servers, each of which is used to connect with the user terminal and send messages to the user terminal. Each message sending server pre-establishes a device node for itself in the distributed application coordination service cluster and monitors new events of sub-nodes under the device node. The first server determines that the target message needs to be sent to the target recipient (i.e., the target message receiving party) by the target message sending server in the message sending server cluster. Figure 1 The target message sending server monitors the target device node corresponding to itself, and after monitoring the occurrence of a new sub-node event under the target device node, obtains the content of the newly added sub-node, that is, obtains the target message and the identifier of the target recipient, and sends the target message to the target recipient according to the identifier of the target recipient.
[0027] exist Figure 1 In the scenario shown, for the first server, by adding a child node, it is possible to notify the target message sending server in the message sending server cluster of the target message to be sent and the identifier of the target recipient. For the target message sending server in the message sending server cluster, by listening to the new events of its corresponding child node, it can obtain the target message to be sent and the identifier of the target recipient of the target message, and send the target message to the target recipient. In the scenario where the message sending server cluster communicates with the recipient, it can quickly locate the target message sending server that communicates with the target recipient, so that the target message sending server can send the target message to the target recipient efficiently and quickly, thereby improving the message sending efficiency.
[0028] Figure 2 This is a flow chart of a message sending method provided in an embodiment of this specification. The method is applied to the first server mentioned above and executed by the first server, such as Figure 2 As shown, the method includes the following steps:
[0029] Step S202, obtaining event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes the identifier of the target recipient and the target message;
[0030] Step S204: determining a target message sending server corresponding to the target recipient in the message sending server cluster according to the identifier of the target recipient;
[0031] Step S206, search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0032] It can be seen that through the method in this embodiment, when the first server determines that the target message sending server in the message sending server cluster needs to send the target message to the target recipient, it searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a child node under the target device node. The content of the child node includes the target message and the identifier of the target recipient. The child node is used to be monitored by the target message sending server to send the target message to the target recipient. Therefore, for the first server, by adding child nodes, it is possible to notify the target message sending server in the message sending server cluster of the target message to be sent and the identifier of the target recipient, so that in the scenario where the message sending server cluster communicates with the recipient, the target message sending server that communicates with the target recipient can be quickly located, so that the target message sending server can efficiently and quickly send the target message to the target recipient, thereby improving the efficiency of message sending.
[0033] In the above step S202, the first server obtains the event information of the message sending event, which is used to send the target message to the target recipient. The event information includes the identifier of the target recipient and the target message. In this embodiment, the target recipient can Figure 1 The user terminal in the scenario shown, accordingly, the identifier of the target recipient may be the identifier of the user terminal or the identifier of the corresponding user.
[0034] In one embodiment, event information of a message sending event is obtained. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and the target message, specifically:
[0035] Receive a notification message sent by an external device, which carries event information of a message sending event. The message sending event is generated by the external device and is used to send a target message to a target recipient. The event information includes the identifier of the target recipient and the target message.
[0036] Specifically, the external device can be a server other than the first server. When the first server is a message sending server in a message sending server cluster, the external device can be a server outside the message sending server cluster. The external device obtains the identifiers of the target message and the target recipient and generates a message sending event. The message sending event is used to send the target message to the target recipient. The event information of the message sending event includes the identifier of the target recipient and the target message. The external device carries the event information of the message sending event in a notification message and sends it to the first server, so that the first server obtains the event information of the message sending event and determines that the target message needs to be sent to the target recipient.
[0037] In this embodiment, the external device of the first server may generate a message sending event, and the first server may obtain event information of the message sending event from the external device to determine that the target message needs to be sent to the target recipient.
[0038] In another embodiment, event information of a message sending event is obtained. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and the target message, specifically:
[0039] Based on the target message and target recipient specified by the user, a message sending event is generated and event information of the message sending event is obtained. The message sending event is used to send the target message to the target recipient. The event information includes the identifier of the target recipient and the target message.
[0040] Specifically, when the first server is an event generation server, it can generate a message sending event based on a user operation. For example, based on the target message and the target recipient's identifier input or selected by the user, the first server generates a message sending event and obtains event information for the message sending event. The message sending event is used to send the target message to the target recipient, and the event information includes the target recipient's identifier and the target message.
[0041] In this embodiment, the first server may generate a message sending event based on the target message and the identifier of the target recipient specified by the user, thereby achieving generation of the message sending event without relying on an external device.
[0042] In another embodiment, event information of a message sending event is obtained. The message sending event is used to send a target message to a target recipient. The event information includes an identifier of the target recipient and the target message, specifically:
[0043] Monitor the data fluctuation of the preset monitored object, and when the data fluctuation of the preset monitored object meets the corresponding data fluctuation requirements, generate a message sending event and obtain event information of the message sending event;
[0044] Among them, the message sending event is used to send the target message to the target recipient; the target message is used to notify the target recipient about the data fluctuation of the preset monitored object; the event information includes the identifier of the target recipient and the target message.
[0045] In this embodiment, the first server records the data of the preset monitored object, and the first server monitors the data fluctuation of the preset monitored object. The data fluctuation of the preset monitored object includes but is not limited to the increase rate of the data of the preset monitored object per unit time, etc. When the data fluctuation of the preset monitored object meets the corresponding data fluctuation requirements, a message sending event is generated. The data fluctuation requirements include but are not limited to the increase rate threshold of the data of the preset monitored object per unit time, etc. After the first server generates the message sending event, it also obtains the event information of the message sending event, wherein the message sending event is used to send the target message to the target recipient, the target message can be a message with a fixed message content, the target recipient can be a pre-set recipient, the target message is used to notify the target recipient about the data fluctuation of the preset monitored object, and the event information of the message sending event includes the identifier of the target recipient and the target message.
[0046] In a specific example, a first server monitors the growth rate of a certain stock and generates a message sending event when the growth rate reaches a certain value. The target message can be a message pre-written by the administrator, specifically "Hello user, the stock's growth rate is high, please pay attention." The target recipient can be a pre-defined recipient, such as User A3.
[0047] In this embodiment, the first server may be a message sending server in a message sending server cluster. When the data fluctuation of a preset monitored object meets corresponding data fluctuation requirements, the first server may generate a message sending event, thereby notifying a target recipient of the data fluctuation of the preset monitored object by sending a targeted message, thereby achieving a data monitoring effect.
[0048] In one embodiment, the first server is a message sending server in a message sending server cluster. The first server executes a scheduled task (such as an alarm clock timer reminder task). Each time the task is executed, a message sending event is generated. This event is used to notify a target user (i.e., a target recipient) of a target message. The target message is a message pre-stored within the first server, and its content is pre-written by the administrator of the first server. For example, the content can be an alarm clock timer reminder message. The target user can be a pre-defined user or a user who has subscribed to the alarm clock reminder task.
[0049] In the above step S204, the first server determines a target message sending server corresponding to the target recipient from multiple message sending servers included in the message sending server cluster according to the identifier of the target recipient. The target message sending server is a server that needs to send a target message to the target recipient.
[0050] In one embodiment, the first server determines the target message sending server corresponding to the target recipient in the message sending server cluster according to the identifier of the target recipient, specifically:
[0051] Obtaining a pre-cached mapping relationship between message sending servers and message recipients, wherein the mapping relationship records identifiers of multiple message sending servers and identifiers of multiple message recipients in the message sending server cluster in a one-to-one correspondence;
[0052] According to the identifier of the target recipient and the mapping relationship, a target message sending server corresponding to the target recipient is determined in the message sending server cluster.
[0053] Specifically, a mapping relationship between a message sending server and a message receiver is pre-cached, and the mapping relationship records the identifiers of multiple message sending servers and multiple message receivers in the message sending server cluster in a one-to-one correspondence. For example, the mapping relationship records "message sending server 1-user 1" and "message sending server 2-user 2", indicating that message sending server 1 is used to send messages to user 1, and message sending server 2 is used to send messages to user 2. First, the mapping relationship is obtained, and then the identifier of the target receiver is searched in the mapping relationship. After the identifier is found, the message sending server corresponding to the identifier of the target receiver is used as the target message sending server. For example, if the identifier of the target receiver is "user 2", then "user 2" is searched in the mapping relationship. After the identifier is found, the message sending server 2 corresponding to "user 2" is used as the target message sending server.
[0054] In one embodiment, considering the stability and universality of distributed caching, the above-mentioned mapping relationship is cached in a distributed cache cluster. In one embodiment, after any message sending server in the message sending server cluster establishes a communication connection with a corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in a one-to-one correspondence in the mapping relationship.
[0055] The message recipient can be a user terminal, and the identifier of the message recipient can be the identifier of the user terminal or the identifier of the user. After any message sending server in the message sending server cluster establishes a communication connection with the corresponding user terminal and generates a session, it records its own server identifier and the identifier of the corresponding user terminal in a one-to-one correspondence in the mapping relationship. Of course, it can also record its own server identifier and the identifier of the corresponding user in a one-to-one correspondence in the mapping relationship, thereby generating the above-mentioned mapping relationship, and using the mapping relationship to query the target message sending server corresponding to the target recipient. Among them, a message recipient, such as a user, can only establish a communication relationship with one message sending server, but a message sending server can establish a communication relationship with multiple different message recipients.
[0056] Taking into account that the same message recipient, such as the same user terminal, can establish communication connections with different message sending servers at different times, for example, the user establishes a communication connection with message server 1 in the morning to generate a session, and after the session ends, establishes a communication connection with message server 2 in the afternoon to generate a session, in order to ensure that the above mapping relationship always records the identifier of the message server that has most recently established a connection with the same user, in the above mapping relationship, for the same message recipient, the identifier of the message sending server that has most recently established a communication connection with the same message recipient is used to overwrite the identifier of the message sending server that has historically established a communication connection with the same message recipient, thereby ensuring that the above mapping relationship always records the identifier of the message server that has most recently established a connection with the same message recipient, so that the mapping relationship can be used to find the message server that has most recently established a communication connection with the message recipient, avoiding finding the message server that has historically established a communication connection with the message recipient, and ensuring the accuracy of finding the message server.
[0057] Based on the previous introduction, each message sending server in the message sending server cluster pre-establishes a device node for itself in the distributed application coordination service cluster, and monitors the newly added events of sub-nodes under the device node. When the first server determines that the target message sending server in the message sending server cluster needs to send the target message to the target recipient, it searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a sub-node under the target device node. The content of the sub-node includes the target message and the identifier of the target recipient. The target message sending server monitors the target device node corresponding to itself, and after monitoring the newly added event of sub-nodes under the target device node, it obtains the content of the newly added sub-node, that is, obtains the identifier of the target message and the target recipient, and sends the target message to the target recipient according to the identifier of the target recipient. Based on this, Figure 3This is a flow chart of a message sending method provided by another embodiment of this specification. The message sending method is applied to the target message sending server mentioned above and is executed by the target message sending server. Figure 3 As shown, the method includes the following steps:
[0058] Step S302: Obtain the identifier of the target message sending server, and based on the identifier of the target message sending server, search for a target device node pre-established for the target message sending server in the distributed application coordination service cluster, and monitor new events of subnodes under the target device node;
[0059] Step S304: After monitoring the occurrence of a child node addition event under the target device node, obtain the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message;
[0060] Step S306: Send the target message to the target recipient according to the identifier of the target recipient.
[0061] It can be seen that through the method in this embodiment, the target message sending server can monitor the target device node corresponding to the target message sending server pre-established in the distributed application coordination service cluster, and when monitoring the new event of the sub-node under the target device node, obtain the content of the newly added sub-node, and based on the content, send the target message to the target recipient. Therefore, for the target message sending server in the message sending server cluster, by monitoring the new event of the sub-node corresponding to itself, it can obtain the target message to be sent and the identifier of the target recipient of the target message, and send the target message to the target recipient, so that in the scenario where the message sending server cluster communicates with the recipient, the target message sending server that communicates with the target recipient can be quickly located, so that the target message sending server can efficiently and quickly send the target message to the target recipient, thereby improving the efficiency of message sending.
[0062] It should be noted that, for any message sending server in the message sending server cluster, when it is determined as the target message sending server corresponding to the target recipient, it can execute Figure 3 As well as the aforementioned method flow, the sending of the target message is achieved by monitoring the child nodes.
[0063] In step S302, the target message sending server obtains its own identifier and, based on its identifier, searches for a pre-established target device node for itself in the distributed application coordination service cluster and monitors for new child node events under the target device node. In one embodiment, before searching for a pre-established target device node for itself in the distributed application coordination service cluster, the target message sending server also establishes a target device node for itself in the distributed application coordination service cluster based on the identifier of the target message sending server, thereby satisfying subsequent search requirements.
[0064] In the above step S304, after monitoring the occurrence of a child node addition event under the target device node, the target message sending server obtains the content of the newly added child node, which includes the target message to be sent and the identifier of the target recipient.
[0065] Next, in step S306, the target message sending server sends the target message to the target recipient based on the target recipient's identifier. This shows that the target message sending server can obtain the target message and the identifier of the target recipient by monitoring new events on its corresponding child node, and then send the target message to the target recipient. Furthermore, the target message sending server can pre-create a target device node for itself in the distributed application coordination service cluster.
[0066] In one embodiment, the subnode under the target device node is added by the first server under the target device node. Specifically, as described above, in the method flow executed by the first server, after obtaining event information of a message sending event for sending a target message to a target recipient, the first server determines that the message sending server corresponding to the target recipient is the target message sending server based on a pre-cached mapping relationship between message sending servers and message recipients, searches for the target device node in the distributed application coordination service cluster, and thereby adds the subnode under the target device node.
[0067] In one embodiment, the mapping relationship between the message sending server and the message recipient is cached in a distributed cache cluster. After any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0068] In one embodiment, in the above mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has previously established a communication connection relationship with the same message recipient.
[0069] For the specific process of establishing the mapping relationship and related introduction, please refer to the previous description of the mapping relationship, which will not be repeated here.
[0070] In one embodiment, after determining that the target message has been successfully sent, the target message sending server deletes the aforementioned child nodes under the target device node to avoid repeated reading of the child nodes and thus prevent repeated sending of the target message. The added child nodes are only deleted by the message sending server to which they belong after the message has been successfully sent; other message sending servers do not have deletion permission, thereby preventing message loss and allowing for repeated sending after a message fails.
[0071] In the above embodiments, any message sending server in the message sending server cluster can, after startup, establish a corresponding device node for itself in the distributed application coordination service cluster based on the node registration interface provided by the distributed application coordination service cluster, and listen to new sub-node events under its corresponding device node based on the node listening interface provided by the distributed application coordination service cluster.
[0072] The above message sending method is described in detail below with reference to specific scenarios.
[0073] Scene 1
[0074] In this scenario, the message recipient is the user terminal, and the message sending server cluster establishes a WebSocket communication connection with the user terminal. The distributed application coordination service cluster is implemented based on the distributed application coordination service Zookeeper, and the distributed cache cluster is implemented based on the distributed cache Redis.
[0075] Figure 4 This is a schematic diagram of an application scenario of a message sending method provided in another embodiment of this specification, such as Figure 4 As shown in the figure, the scenario includes a message sending server cluster, a distributed application coordination service cluster based on Zookeeper, a distributed cache cluster based on Redis, a user terminal, and a background management cluster. Figure 4 In the example, the background management cluster is the aforementioned event generation cluster, and the first server is any server in the background management cluster.
[0076] Figure 4 In the example, after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in a one-to-one correspondence in the mapping relationship. The mapping relationship is the mapping relationship between the message sending server and the message recipient, and the mapping relationship is stored in the distributed cache cluster.
[0077] Figure 4In the example, any message sending server in the message sending server cluster can, after startup, establish a corresponding device node for itself in the distributed application coordination service cluster and listen to new events of sub-nodes under its corresponding device node.
[0078] Figure 4 In the example, the first server may generate the above-mentioned message sending event based on the user's operation and the target message and target recipient specified by the user, and obtain event information of the message sending event.
[0079] Figure 4 In the process, after generating a message sending event, the first server determines the target message sending server corresponding to the target recipient in the message sending server cluster according to the mapping relationship between the message sending servers cached in the distributed cache cluster and the message recipients, searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a child node under the target device node. The content of the child node includes the identifier of the target message and the target recipient.
[0080] Figure 4 In the process, after monitoring the occurrence of a new subnode addition event under the target device node, the target message sending server obtains the content of the newly added subnode, which includes the target message to be sent and the identifier of the target recipient corresponding to the target message. According to the identifier of the target recipient, the target message is sent to the target recipient through the websocket communication connection.
[0081] Figure 5 This is a schematic diagram of a multi-party interaction process of a message sending method provided in an embodiment of this specification. Figure 5 The method flow in this paper is applied to Figure 4 The scene shown, Figure 5 The target message sending server is used as an example to illustrate. It can be understood that any machine in the message sending server cluster can implement the following process. Figure 5 The process specifically includes the following steps:
[0082] Step S501: After being started, the target message sending server obtains its own identification and establishes a target device node for itself in the distributed application coordination service cluster according to its own identification.
[0083] Step S502: The target message sending server monitors the event of adding a subnode under the target device node.
[0084] Step S503: The target user terminal carries the user identifier and establishes a websocket communication connection with the target message sending server.
[0085] Here, the target user terminal can also carry the identifier of the user terminal as the identifier of the recipient.
[0086] Step S504: The target message sending server obtains the user identifier.
[0087] Step S505: The target message sending server obtains its own identification.
[0088] Step S506: The target message sending server establishes a mapping relationship between the user identifier and its own identifier and stores the mapping relationship in the distributed cache cluster.
[0089] In step S507 , the first server in the background management cluster generates a message sending event based on the user operation and obtains event information of the message sending event.
[0090] Step S508: The first server determines, based on the mapping relationship stored in the distributed cache cluster, that the message sending server corresponding to the target recipient is the target message sending server.
[0091] Step S509: The first server searches for a target device node in the distributed application coordination service cluster and adds a child node under the target device node.
[0092] Step S510: The target message sending server monitors a new event of a subnode under the target device node.
[0093] Step S511: The target message sending server sends the target message to the target user terminal through the websocket communication connection according to the sub-node content.
[0094] Step S512: After determining that the message is sent successfully, the target message sending server deletes the child node under the target device node.
[0095] In this embodiment, the target message sending server can also pre-store the correspondence between the identifiers of each recipient and each session identifier. The correspondence can be stored locally on the target message sending server or in a distributed cache cluster. Therefore, after determining to send the target message to the target recipient, the target message sending server sends the target message to the target recipient through the target session corresponding to the target recipient.
[0096] Scene 2
[0097] In this scenario, the message receiver is the user terminal. The message sending server cluster establishes a websocket communication connection with the user terminal. The distributed application coordination service cluster is implemented based on the distributed application coordination service Zookeeper, and the distributed cache cluster is implemented based on the distributed cache Redis.
[0098] Figure 6 This is a schematic diagram of an application scenario of a message sending method provided in another embodiment of this specification, such as Figure 6 As shown in the figure, the scenario includes a message sending server cluster, a distributed application coordination service cluster based on Zookeeper, a distributed cache cluster based on Redis, and a user terminal. Figure 6 In the example, the first server is any message sending server in the message sending server cluster.
[0099] Figure 6 In the example, after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in a one-to-one correspondence in the mapping relationship. The mapping relationship is the mapping relationship between the message sending server and the message recipient, and the mapping relationship is stored in the distributed cache cluster.
[0100] Figure 6 In the example, any message sending server in the message sending server cluster can, after startup, establish a corresponding device node for itself in the distributed application coordination service cluster and listen to new events of sub-nodes under its corresponding device node.
[0101] Figure 6 In the example, the first server can monitor data fluctuations of a preset monitored object. When the data fluctuations of the preset monitored object meet corresponding data fluctuation requirements, the first server can generate a message sending event and obtain event information of the message sending event. Alternatively, the first server can receive a notification message sent by an external device, the notification message carrying event information of the message sending event, and the message sending event is generated by the external device.
[0102] Figure 6 In the process, after obtaining the event information of the message sending event, the first server determines the target message sending server corresponding to the target recipient in the message sending server cluster according to the mapping relationship between the message sending servers cached in the distributed cache cluster and the message recipients, searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a child node under the target device node. The content of the child node includes the identifier of the target message and the target recipient.
[0103] Figure 6 In the process, after monitoring the occurrence of a new subnode addition event under the target device node, the target message sending server obtains the content of the newly added subnode, which includes the target message to be sent and the identifier of the target recipient corresponding to the target message. According to the identifier of the target recipient, the target message is sent to the target recipient through the websocket communication connection.
[0104] Figure 7 This is a schematic diagram of a multi-party interaction process of a message sending method provided in another embodiment of this specification. Figure 7 The method flow in this paper is applied to Figure 6 The scene shown, Figure 7 The target message sending server is used as an example to illustrate. It can be understood that any machine in the message sending server cluster can implement the following process. Figure 7 The process specifically includes the following steps:
[0105] Step S701: After being started, the target message sending server obtains its own identification and establishes a target device node for itself in the distributed application coordination service cluster according to its own identification.
[0106] Step S702: The target message sending server monitors the event of adding a subnode under the target device node.
[0107] Step S703: The target user terminal carries the user identifier and establishes a websocket communication connection with the target message sending server.
[0108] Here, the target user terminal can also carry the identifier of the user terminal as the identifier of the recipient.
[0109] Step S704: The target message sending server obtains the user identifier.
[0110] Step S705: The target message sending server obtains its own identification.
[0111] Step S706: The target message sending server establishes a mapping relationship between the user identifier and its own identifier and stores the mapping relationship in the distributed cache cluster.
[0112] Step S707: The first server in the message sending server cluster obtains event information of the message sending event.
[0113] Step S708: The first server determines, based on the mapping relationship stored in the distributed cache cluster, that the message sending server corresponding to the target recipient is the target message sending server.
[0114] In step S709 , the first server searches for a target device node in the distributed application coordination service cluster and adds a child node under the target device node.
[0115] Step S710: The target message sending server monitors a new event of a subnode under the target device node.
[0116] Step S711: The target message sending server sends the target message to the target user terminal through the websocket communication connection according to the sub-node content.
[0117] Step S712: After determining that the message is sent successfully, the target message sending server deletes the child node under the target device node.
[0118] In this embodiment, the target message sending server can also pre-store the correspondence between the identifiers of each recipient and each session identifier, so that after determining to send the target message to the target recipient, the target message is sent to the target recipient through the target session corresponding to the target recipient.
[0119] In this embodiment, if the first server determines that it is the target message sending server that needs to send the target message to the target recipient, the first server may also perform the specific process of steps S710 to S712. Alternatively, the first server does not need to add or access the child node and can directly send the target message to the target user terminal.
[0120] Figure 8 A schematic diagram of nodes in a distributed application coordination service cluster provided in an embodiment of this specification is shown as follows: Figure 8 As shown, in the distributed application coordination service cluster, there is a root node. Under the root node, any message sending server can establish a corresponding device node for itself, such as Figure 8 When a message sending server needs to send a message, a new child node will be added under the machine node of the message sending server, such as Figure 8 The contents of the subnodes include the message to be sent and the identifier of the message recipient.
[0121] The message sending method described in the above embodiment has at least the following technical effects:
[0122] (1) Distributed application coordination services can solve the communication between multiple clusters without opening a communication interface for each machine in the cluster;
[0123] (2) When notifying the message sending server that a message needs to be sent, there is no need to notify a specific machine or open an additional communication interface. Instead, it is only necessary to add a subnode under the machine node. As long as the message sending server can be connected to the distributed application coordination service, it can be done;
[0124] (3) The entire message sending method does not require obtaining the IP and domain name of the message sending server, but only requires the message sending server to have its own machine identification;
[0125] (4) The added child node will only be deleted by the message sending server after the message is successfully sent. Other message sending servers do not have the deletion permission, thus avoiding message loss. The message can be sent again after the message fails to be sent.
[0126] (5) There is no limit on the number of machines in the message sending server cluster, and it can be dynamically expanded according to communication needs.
[0127] Figure 9 This is a structural diagram of a message sending device provided in an embodiment of this specification, such as Figure 9 As shown, the device is applied to the first server and includes:
[0128] An information acquisition unit 91 is configured to acquire event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message;
[0129] a sending determination unit 92, which determines a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient;
[0130] A node adding unit 93 searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and adds a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0131] Optionally, a sending determination unit 92 is configured to:
[0132] Obtaining a pre-cached mapping relationship between a message sending server and a message recipient; wherein the mapping relationship records the identifiers of multiple message sending servers and the identifiers of multiple message recipients in the message sending server cluster in a one-to-one correspondence;
[0133] According to the identifier of the target recipient and the mapping relationship, a target message sending server corresponding to the target recipient is determined in the message sending server cluster.
[0134] Optionally, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with a corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0135] Optionally, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has previously established a communication connection relationship with the same message recipient.
[0136] Optionally, the information acquisition unit 91:
[0137] Receive a notification message sent by an external device; the notification message carries event information of a message sending event; the message sending event is generated by the external device; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message.
[0138] Optionally, the information acquisition unit 91:
[0139] Monitoring data fluctuations of a preset monitored object, generating a message sending event when the data fluctuations of the preset monitored object meet corresponding data fluctuation requirements, and obtaining event information of the message sending event;
[0140] Among them, the message sending event is used to send a target message to a target recipient; the target message is used to notify the target recipient about the data fluctuation of the preset monitored object; the event information includes the identifier of the target recipient and the target message.
[0141] Optionally, the information acquisition unit 91:
[0142] Based on the target message and target recipient specified by the user, a message sending event is generated, and event information of the message sending event is obtained. The message sending event is used to send the target message to the target recipient; the event information includes the identifier of the target recipient and the target message.
[0143] Optionally, the first server is an event generation server in an event generation cluster; or, the first server is a message sending server in the message sending server cluster.
[0144] The message sending device provided in this embodiment can implement each process of the aforementioned message sending method applied to the first server and achieve the same effects and functions, which will not be repeated here.
[0145] Figure 10 This is a structural diagram of a message sending device provided in another embodiment of this specification, such as Figure 10 As shown, the device is applied to a target message sending server in a message sending server cluster; the device includes:
[0146] The node monitoring unit 1001 obtains the identifier of the target message sending server, searches for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitors new events of subnodes under the target device node;
[0147] The content acquisition unit 1002 acquires the content of the newly added child node after monitoring the occurrence of a child node addition event under the target device node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message;
[0148] The message sending unit 1003 sends the target message to the target recipient according to the identifier of the target recipient.
[0149] Optionally, the child node is added by the first server under the target device node; wherein, after obtaining the event information of the message sending event for sending the target message to the target recipient, the first server determines that the message sending server corresponding to the target recipient is the target message sending server based on the pre-cached mapping relationship between the message sending server and the message recipient, and searches for the target device node in the distributed application coordination service cluster.
[0150] Optionally, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with a corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0151] Optionally, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has previously established a communication connection relationship with the same message recipient.
[0152] Optionally, a deletion unit is further included, which:
[0153] After determining that the target message is sent successfully, the child node is deleted under the target device node.
[0154] Optionally, the method further comprises a creation unit, which:
[0155] Before searching for the target device node pre-established for the target message sending server in the distributed application coordination service cluster, the target device node is established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server.
[0156] The message sending device provided in this embodiment can implement each process of the aforementioned message sending method applied to the target message sending server and achieve the same effects and functions, which will not be repeated here.
[0157] One or more embodiments of this specification further provide a message sending device, which is used to execute the above message sending method. Figure 11 This is a structural diagram of a message sending device provided in an embodiment of this specification, such as Figure 11 As shown, the message sending device may have relatively large differences due to different configurations or performances, and may include one or more processors 1101 and memory 1102, and the memory 1102 may store one or more applications or data. Among them, the memory 1102 can be a temporary storage or a persistent storage. The application stored in the memory 1102 may include one or more modules (not shown in the figure), and each module may include a series of computer-executable instructions in the message sending device. Furthermore, the processor 1101 can be configured to communicate with the memory 1102 and execute a series of computer-executable instructions in the memory 1102 on the message sending device. The message sending device may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input and output interfaces 1105, one or more keyboards 1106, etc.
[0158] In a specific embodiment, the message sending device includes a processor and a memory arranged to store computer-executable instructions, and when the computer-executable instructions are executed, the processor implements the following process:
[0159] Acquire event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message;
[0160] Determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient;
[0161] Search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0162] Optionally, when the computer executable instructions are executed, determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient includes:
[0163] Obtaining a pre-cached mapping relationship between a message sending server and a message recipient; wherein the mapping relationship records the identifiers of multiple message sending servers and the identifiers of multiple message recipients in the message sending server cluster in a one-to-one correspondence;
[0164] According to the identifier of the target recipient and the mapping relationship, a target message sending server corresponding to the target recipient is determined in the message sending server cluster.
[0165] Optionally, when the computer executable instructions are executed, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0166] Optionally, when the computer executable instructions are executed, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has historically established a communication connection relationship with the same message recipient.
[0167] Optionally, when the computer executable instructions are executed, event information of a message sending event is obtained; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0168] Receive a notification message sent by an external device; the notification message carries event information of a message sending event; the message sending event is generated by the external device; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message.
[0169] Optionally, when the computer executable instructions are executed, event information of a message sending event is obtained; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0170] Monitoring data fluctuations of a preset monitored object, generating a message sending event when the data fluctuations of the preset monitored object meet corresponding data fluctuation requirements, and obtaining event information of the message sending event;
[0171] Among them, the message sending event is used to send a target message to a target recipient; the target message is used to notify the target recipient about the data fluctuation of the preset monitored object; the event information includes the identifier of the target recipient and the target message.
[0172] Optionally, when the computer executable instructions are executed, event information of a message sending event is obtained; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0173] Based on the target message and target recipient specified by the user, a message sending event is generated, and event information of the message sending event is obtained. The message sending event is used to send the target message to the target recipient; the event information includes the identifier of the target recipient and the target message.
[0174] Optionally, when the computer executable instructions are executed, the first server is an event generation server in an event generation cluster; or, the first server is a message sending server in the message sending server cluster.
[0175] The message sending device provided in this embodiment can implement each process of the aforementioned message sending method applied to the first server and achieve the same effects and functions, which will not be repeated here.
[0176] In another specific embodiment, the message sending device includes a processor and a memory arranged to store computer-executable instructions, and when the computer-executable instructions are executed, the processor implements the following process:
[0177] Obtaining an identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitoring new events of subnodes under the target device node;
[0178] After monitoring the occurrence of a child node addition event under the target device node, obtaining the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message;
[0179] The target message is sent to the target recipient according to the identifier of the target recipient.
[0180] Optionally, when the computer-executable instruction is executed, the child node is added by the first server under the target device node; wherein, after the first server obtains the event information of the message sending event for sending the target message to the target recipient, based on the pre-cached mapping relationship between the message sending server and the message recipient, determines that the message sending server corresponding to the target recipient is the target message sending server, and searches for the target device node in the distributed application coordination service cluster.
[0181] Optionally, when the computer executable instructions are executed, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0182] Optionally, when the computer executable instructions are executed, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has historically established a communication connection relationship with the same message recipient.
[0183] Optionally, when the computer executable instructions are executed, they further include:
[0184] After determining that the target message is sent successfully, the child node is deleted under the target device node.
[0185] Optionally, when the computer executable instructions are executed, they further include:
[0186] Before searching for the target device node pre-established for the target message sending server in the distributed application coordination service cluster, the target device node is established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server.
[0187] The message sending device provided in this embodiment can implement each process of the aforementioned message sending method applied to the target message sending server and achieve the same effects and functions, which will not be repeated here.
[0188] Furthermore, one or more embodiments of this specification further provide a storage medium for storing computer-executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. The computer-executable instructions stored in the storage medium, when executed by a processor, can implement the following process:
[0189] Acquire event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message;
[0190] Determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient;
[0191] Search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the child node is used to be monitored by the target message sending server to send the target message to the target recipient.
[0192] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, determining, according to the identifier of the target recipient, a target message sending server corresponding to the target recipient in a message sending server cluster, includes:
[0193] Obtaining a pre-cached mapping relationship between a message sending server and a message recipient; wherein the mapping relationship records the identifiers of multiple message sending servers and the identifiers of multiple message recipients in the message sending server cluster in a one-to-one correspondence;
[0194] According to the identifier of the target recipient and the mapping relationship, a target message sending server corresponding to the target recipient is determined in the message sending server cluster.
[0195] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0196] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has historically established a communication connection relationship with the same message recipient.
[0197] Optionally, the computer-executable instructions stored in the storage medium, when executed by the processor, obtain event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0198] Receive a notification message sent by an external device; the notification message carries event information of a message sending event; the message sending event is generated by the external device; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message.
[0199] Optionally, the computer-executable instructions stored in the storage medium, when executed by the processor, obtain event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0200] Monitoring data fluctuations of a preset monitored object, generating a message sending event when the data fluctuations of the preset monitored object meet corresponding data fluctuation requirements, and obtaining event information of the message sending event;
[0201] Among them, the message sending event is used to send a target message to a target recipient; the target message is used to notify the target recipient about the data fluctuation of the preset monitored object; the event information includes the identifier of the target recipient and the target message.
[0202] Optionally, the computer-executable instructions stored in the storage medium, when executed by the processor, obtain event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message, including:
[0203] Based on the target message and target recipient specified by the user, a message sending event is generated, and event information of the message sending event is obtained. The message sending event is used to send the target message to the target recipient; the event information includes the identifier of the target recipient and the target message.
[0204] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, the first server is an event generation server in an event generation cluster; or, the first server is a message sending server in the message sending server cluster.
[0205] The storage medium provided in this embodiment can implement each process of the aforementioned message sending method applied to the first server and achieve the same effects and functions, which will not be repeated here.
[0206] In another specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc., and the computer executable instructions stored in the storage medium, when executed by the processor, can implement the following process:
[0207] Obtaining an identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitoring new events of subnodes under the target device node;
[0208] After monitoring the occurrence of a child node addition event under the target device node, obtaining the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message;
[0209] The target message is sent to the target recipient according to the identifier of the target recipient.
[0210] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, the child node is added by the first server under the target device node; wherein, after the first server obtains the event information of the message sending event for sending the target message to the target recipient, based on the pre-cached mapping relationship between the message sending server and the message recipient, it determines that the message sending server corresponding to the target recipient is the target message sending server, and searches for the target device node in the distributed application coordination service cluster.
[0211] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, the mapping relationship is cached in a distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
[0212] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, in the mapping relationship, for the same message recipient, the identifier of the message sending server that most recently established a communication connection relationship with the same message recipient is used to overwrite the identifier of the message sending server that has historically established a communication connection relationship with the same message recipient.
[0213] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, they further include:
[0214] After determining that the target message is sent successfully, the child node is deleted under the target device node.
[0215] Optionally, when the computer executable instructions stored in the storage medium are executed by the processor, they further include:
[0216] Before searching for the target device node pre-established for the target message sending server in the distributed application coordination service cluster, the target device node is established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server.
[0217] The storage medium provided in this embodiment can implement each process of the aforementioned message sending method applied to the target message sending server and achieve the same effects and functions, which will not be repeated here.
[0218] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0219] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures such as diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, 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. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0220] The controller can be implemented in any suitable manner. For example, the controller can take the form of 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, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.
[0221] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, 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.
[0222] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing one or more of the present descriptions, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0223] It will be understood by those skilled in the art that one or more embodiments of this specification may be provided as methods, systems, or computer program products. Thus, one or more of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0224] One or more of the present specification is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to one or more embodiments of the present specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0225] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0226] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0227] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0228] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0229] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media 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 disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0230] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0231] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as methods, systems, or computer program products. Thus, one or more of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0232] One or more of the present disclosures may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more of the present disclosures may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.
[0233] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0234] The foregoing description is merely an example of one or more embodiments of this specification and is not intended to limit this specification. Persons skilled in the art will readily appreciate that this specification may be modified and varied in various ways. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims of this specification.
Claims
1. A message sending method, applied to a first server; the method comprising: Get the event information of the message sending event; The message sending event is used to send the target message to the target recipient; The event information includes the identifier of the target recipient and the target message; Determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient; Search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the new child node event of the child node is used to be monitored by the target message sending server to send the target message to the target recipient through the target message sending server.
2. The method according to claim 1, wherein, based on the identifier of the target recipient, determining the target message sending server corresponding to the target recipient in the message sending server cluster comprises: Obtaining a pre-cached mapping relationship between a message sending server and a message receiver; The mapping relationship records the identifiers of multiple message sending servers and identifiers of multiple message recipients in the message sending server cluster in a one-to-one correspondence; According to the identifier of the target recipient and the mapping relationship, a target message sending server corresponding to the target recipient is determined in the message sending server cluster.
3. The method according to claim 2, The mapping relationship is cached in the distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
4. The method according to claim 3, In the mapping relationship, for the same message recipient, the identifier of the message sending server that established a communication connection relationship with the same message recipient most recently is used to overwrite the identifier of the message sending server that established a communication connection relationship with the same message recipient in the past.
5. The method according to claim 1, obtaining event information of a message sending event; The message sending event is used to send the target message to the target recipient; The event information includes the identifier of the target recipient and the target message, including: Receive a notification message sent by an external device; the notification message carries event information of a message sending event; the message sending event is generated by the external device; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message.
6. The method according to claim 1, obtaining event information of a message sending event; The message sending event is used to send the target message to the target recipient; The event information includes the identifier of the target recipient and the target message, including: Monitoring data fluctuations of a preset monitored object, generating a message sending event when the data fluctuations of the preset monitored object meet corresponding data fluctuation requirements, and obtaining event information of the message sending event; Among them, the message sending event is used to send a target message to a target recipient; the target message is used to notify the target recipient about the data fluctuation of the preset monitored object; the event information includes the identifier of the target recipient and the target message.
7. The method according to claim 1, obtaining event information of a message sending event; The message sending event is used to send the target message to the target recipient; The event information includes the identifier of the target recipient and the target message, including: Based on the target message and target recipient specified by the user, a message sending event is generated, and event information of the message sending event is obtained. The message sending event is used to send the target message to the target recipient; the event information includes the identifier of the target recipient and the target message.
8. The method according to claim 1, wherein the first server is an event generation server in an event generation cluster; or the first server is a message sending server in the message sending server cluster.
9. A message sending method, applied to a target message sending server in a message sending server cluster; the method comprising: Obtaining an identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitoring new events of subnodes under the target device node; After monitoring the occurrence of a child node addition event under the target device node, obtaining the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message; The target message is sent to the target recipient according to the identifier of the target recipient.
10. The method according to claim 9, The child node is added by the first server under the target device node; wherein, After obtaining the event information of the message sending event used to send the target message to the target recipient, the first server determines that the message sending server corresponding to the target recipient is the target message sending server based on the pre-cached mapping relationship between the message sending server and the message recipient, and searches for the target device node in the distributed application coordination service cluster.
11. The method according to claim 10, The mapping relationship is cached in the distributed cache cluster; after any message sending server in the message sending server cluster establishes a communication connection with the corresponding message recipient, it records its own identifier and the identifier of the corresponding message recipient in the mapping relationship in a one-to-one correspondence.
12. The method according to claim 11, In the mapping relationship, for the same message recipient, the identifier of the message sending server that established a communication connection relationship with the same message recipient most recently is used to overwrite the identifier of the message sending server that established a communication connection relationship with the same message recipient in the past.
13. The method according to any one of claims 9 to 12, further comprising: After determining that the target message is sent successfully, the child node is deleted under the target device node.
14. The method according to claim 9, further comprising: Before searching for the target device node pre-established for the target message sending server in the distributed application coordination service cluster, the target device node is established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server.
15. A message sending device, applied to a first server; the device comprising: An information acquisition unit, which acquires event information of a message sending event; The message sending event is used to send the target message to the target recipient; The event information includes the identifier of the target recipient and the target message; a sending determination unit, which determines a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient; A node adding unit, which searches for the target device node corresponding to the target message sending server in the distributed application coordination service cluster and adds a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the child node's newly added child node event is used to be monitored by the target message sending server to send the target message to the target recipient through the target message sending server.
16. A message sending device, applied to a target message sending server in a message sending server cluster; the device comprising: a node monitoring unit, which obtains the identifier of the target message sending server, searches for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitors new events of subnodes under the target device node; a content acquisition unit, which acquires the content of the newly added child node after monitoring the occurrence of a child node addition event under the target device node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message; A message sending unit is configured to send the target message to the target recipient according to the identifier of the target recipient.
17. A message sending device, provided in a first server, comprising: processor; as well as a memory arranged to store computer-executable instructions which, when executed, cause the processor to: Acquire event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message; Determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient; Search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the new child node event of the child node is used to be monitored by the target message sending server to send the target message to the target recipient through the target message sending server.
18. A message sending device, provided in a target message sending server in a message sending server cluster, comprising: processor; as well as a memory arranged to store computer-executable instructions which, when executed, cause the processor to: Obtaining an identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitoring new events of subnodes under the target device node; After monitoring the occurrence of a child node addition event under the target device node, obtaining the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message; The target message is sent to the target recipient according to the identifier of the target recipient.
19. A storage medium, disposed in a first server, for storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the following method: Acquire event information of a message sending event; the message sending event is used to send a target message to a target recipient; the event information includes an identifier of the target recipient and the target message; Determining a target message sending server corresponding to the target recipient in a message sending server cluster according to the identifier of the target recipient; Search for the target device node corresponding to the target message sending server in the distributed application coordination service cluster, and add a child node under the target device node; the content of the child node includes the target message and the identifier of the target recipient; the new child node event of the child node is used to be monitored by the target message sending server to send the target message to the target recipient through the target message sending server.
20. A storage medium, disposed in a target message sending server in a message sending server cluster, for storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the following method: Obtaining an identifier of the target message sending server, searching for a target device node pre-established for the target message sending server in the distributed application coordination service cluster based on the identifier of the target message sending server, and monitoring new events of subnodes under the target device node; After monitoring the occurrence of a child node addition event under the target device node, obtaining the content of the newly added child node; the content of the child node includes the target message to be sent and the identifier of the target recipient corresponding to the target message; The target message is sent to the target recipient according to the identifier of the target recipient.
Citation Information
Patent Citations
Message notification method and equipment
CN106302621A
Cluster type instant message system supporting Internet inquiry service and implementation method thereof
CN111211971A