Real-time conversation message processing method and device, storage medium, and terminal
By retrieving all messages within the local range in multiple Internet data center system architectures, querying online session status and determining target session connections, the problem of state redundancy and resource waste caused by the search for online session status by primary distributed cache is solved, and the processing efficiency of real-time session messages is improved.
Patent Information
- Application Number
- CN202210925623.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-03
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-08-03
AI Technical Summary
In a system architecture built by multiple Internet data centers, finding online session states from only the main distributed cache leads to state redundancy, waste of resources and inefficient processing.
By retrieving all message routing interfaces within the local area, including local message routing interfaces and associated message routing interfaces, querying the online session status in each distributed cache, and determining the target message routing interface and the target session connection, and issuing real-time session messages through the target session connection.
It avoids redundancy and resource waste in online session state, improves the processing efficiency of real-time session messages, and reduces the impact of network jitter on message processing.
Smart Images

Figure CN115277647B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a method and device for processing real-time conversation messages, a storage medium, and a terminal. Background Art
[0002] With the rapid development of Internet technology, in order to meet the needs of fast speed and low system consumption, the real-time communication of major social applications is also constantly improving. Among them, when social users in the same city conduct real-time conversations, the transmission and generation of messages are usually processed by building a system architecture through multiple Internet data centers in the same city, such as a multi-active architecture, to achieve short-distance and low-network loss message processing.
[0003] At present, in the existing real-time session message processing process, a main distributed cache library is usually selected from the distributed databases of multiple Internet data centers. When the real-time session message is transmitted from the client, the online session state is first searched in the Internet data center corresponding to the main distributed cache, so as to determine whether to distribute the real-time session message in this Internet data center. However, as a main distributed cache library, when a large number of users log in and out frequently, the state writing surges, the online session state is redundant, and the system resources are seriously wasted. When the network jitters, it affects the processing of the session messages of all users, which greatly reduces the processing efficiency of the real-time session message. Summary of the invention
[0004] In view of this, the present invention provides a method and device for processing real-time conversation messages, a storage medium, and a terminal, the main purpose of which is to solve the problems of state redundancy, resource waste, and low processing efficiency caused by only searching for online conversation status from the main distributed cache in the current system architecture built in multiple Internet data centers.
[0005] According to one aspect of the present invention, a method for processing a real-time conversation message is provided, comprising:
[0006] When a real-time conversation message is received, all message routing interfaces within the local area are retrieved, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
[0007] When it is found through the message routing interface that there is an online session state matching the real-time session message in each distributed cache within the local area, a target message routing interface and a target session connection are determined, and the distributed cache corresponds to one message routing interface;
[0008] The target session connection is called through the target message routing interface, and the real-time session message after message processing is sent through the target session connection.
[0009] Furthermore, before calling all message routing interfaces within the local area, the method further includes:
[0010] Searching for all non-local message routing interfaces in a local area, wherein each of the non-local message routing interfaces is matched with a corresponding session connection;
[0011] An association relationship is established between the searched non-local message routing interface and the local message routing interface, and at least one associated message routing interface is determined.
[0012] Furthermore, before determining the target message routing interface and the target session connection, the method further includes:
[0013] Acquire interface parameters in the real-time conversation message, wherein the interface parameters include message content, target user information, and conversation request identifier;
[0014] Calling the message routing interface based on the interface parameters, searching the distributed cache for a session state corresponding to the real-time session message;
[0015] If the session state is found and the session state is an online state, it is determined that an online session state matching the real-time session message is found in each distributed cache within the local area.
[0016] Further, the determining of the target message routing interface and the target session connection includes:
[0017] Determine a target distributed cache where the session state corresponding to the online session state is stored, and determine a message routing interface corresponding to the target distributed cache as a target message routing interface;
[0018] A connection service configured by the target message routing interface is obtained, and a session connection created by the connection service is determined as a target session connection.
[0019] Further, calling the target session connection through the target message routing interface and sending the processed real-time session message through the target session connection includes:
[0020] Configure the interface parameters of the target message routing interface according to the message content, target user information, and session request identifier in the real-time session message;
[0021] The target message routing interface calls the target session connection based on the completed interface parameter configuration, and obtains the real-time session message that completes message processing based on the message content;
[0022] The real-time session message is sent to a target user matching the target user information and the session request identifier through the target session connection.
[0023] Furthermore, the method further comprises:
[0024] Detecting whether a plurality of call times for calling all the message routing interfaces is greater than a preset call time threshold;
[0025] If the calling time is greater than the preset calling time threshold, determining that the message routing interface corresponding to the calling time is a calling failure;
[0026] When a real-time conversation message is received again, the message routing interface that failed to be called is retrieved again, and the corresponding distributed cache is queried through the message routing interface that failed to be called to see whether there is an online conversation state that matches the real-time conversation message, so as to determine whether the message routing interface that failed to be called is the target message routing interface.
[0027] Furthermore, the method further comprises:
[0028] When it is detected that the real-time conversation message after the message processing is not sent to the target user through the target conversation connection, the real-time conversation message that has not been sent successfully is transferred to a message sending queue, and the message sending queue executes the sending of the real-time conversation message in a polling manner;
[0029] When the polling delivery condition corresponding to the real-time conversation message in the message delivery queue is triggered, the real-time conversation message is delivered to the target user.
[0030] According to another aspect of the present invention, a device for processing real-time conversation messages is provided, comprising:
[0031] An interface calling module, used for calling all message routing interfaces within a local area when receiving a real-time conversation message, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
[0032] A determination module, configured to determine a target message routing interface and a target session connection when an online session state matching the real-time session message exists in each distributed cache within the local area through the message routing interface, wherein the distributed cache corresponds to one message routing interface;
[0033] The message sending module is used to call the target session connection through the target message routing interface, and send the real-time session message after message processing through the target session connection.
[0034] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned method for processing real-time conversation messages.
[0035] According to another aspect of the present invention, there is provided a terminal, comprising:
[0036] A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0037] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to any one of the above-mentioned methods for processing real-time conversation messages.
[0038] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0039] The present invention provides a method and device for processing real-time conversation messages, a storage medium, and a terminal. Compared with the prior art, the embodiment of the present invention retrieves all message routing interfaces within a local area when a real-time conversation message is received, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; when the message routing interface finds that there is an online conversation state matching the real-time conversation message in each distributed cache within the local area, a target message routing interface and a target conversation connection are determined, wherein the distributed cache corresponds to a message routing interface; the target conversation connection is called through the target message routing interface, and the real-time conversation message after the message processing is sent through the target conversation connection. In the system architecture constructed by multiple Internet data centers, the online conversation state is searched from each distributed cache within the local area, and the message content in the conversation request is sent to the target user within the local area. Since it is not necessary to update the conversation state in each distributed cache to the main distributed cache, the phenomenon of redundancy of the online conversation state and waste of resources is avoided. Since it is not necessary to search for the online conversation state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time conversation messages is improved.
[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0042] Figure 1 A flowchart of a method for processing a real-time conversation message provided by an embodiment of the present invention is shown;
[0043] Figure 2 A flowchart showing another method for processing real-time conversation messages provided by an embodiment of the present invention is shown;
[0044] Figure 3 A flowchart showing another method for processing real-time conversation messages provided by an embodiment of the present invention is shown;
[0045] Figure 4 A flowchart of another method for processing real-time conversation messages provided by an embodiment of the present invention is shown;
[0046] Figure 5 A flowchart of another method for processing real-time conversation messages provided by an embodiment of the present invention is shown;
[0047] Figure 6 A schematic diagram showing the structure of a real-time session message processing device provided by an embodiment of the present invention;
[0048] Figure 7 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0049] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0050] The embodiment of the present invention provides a method for processing real-time conversation messages, such as Figure 1 As shown, the method includes:
[0051] 101. When a real-time conversation message is received, all message routing interfaces within the local area are called;
[0052] In the embodiment of the present invention, when the current execution end receives the user's real-time conversation message, it calls all message routing interfaces within the local area where the current execution end is located, and the said all message routing interfaces include the local message routing interface and at least one associated message routing interface associated with the said local message routing interface; the local area can be used to represent the scope of a region in terms of geographical location, such as the scope of the same city; it can also be used to represent the network scope composed of multiple interconnected Internet data centers, such as the network system scope of a multi-active architecture, which is not specifically limited in the embodiment of the present invention. Message routing is a soft routing that determines the next hop address of the message, and has high stability.
[0053] It should be noted that, since there are multiple execution terminals within the local area, when data communication is performed between the multiple execution terminals, the working efficiency of the message routing interface can be improved by simultaneously calling all message routing interfaces within the local area.
[0054] 102. When it is found through the message routing interface that an online session state matching the real-time session message exists in each distributed cache within the local area, a target message routing interface and a target session connection are determined;
[0055] In the embodiment of the present invention, the current execution end performs online session query on each distributed cache within the local area. When the online session state matching the real-time session message sent by the user is queried, the message routing interface matching the online session state is determined as the target message routing interface. Since the message routing interface matches the corresponding session connection, the target session connection is obtained through the determined target message routing interface. The session connection is a physical link established by the server process for the user to participate in the session. Once the user establishes a connection, a server process is created to process the session request of the user. When the user disconnects, the server process for the user to participate in the session is terminated.
[0056] It should be noted that each message routing interface in the local area corresponds to a distributed cache for storing the user's session status information. When the user is logged in, the user's online session status is written into the corresponding distributed cache. When the user is logged out, the user's online session status is removed from the distributed cache.
[0057] 103. Call the target session connection through the target message routing interface, and send the processed real-time session message through the target session connection.
[0058] In the embodiment of the present invention, the current execution end calls the target session connection of the target user through the found target message routing interface, and sends the real-time session message after message processing to the target user through the target session connection. Message processing is used to represent the process of storing and verifying the messages sent by the user. During the verification, it can be verified whether the message sender and the target user are friends, or whether the sender is a group member, or whether the sender is banned in the group. The embodiment of the present invention does not make specific limitations. Only messages that have passed the verification during the message processing process can be sent through the target session connection.
[0059] In another embodiment of the present invention, in order to further define and illustrate, as Figure 2 As shown, before the step of calling all message routing interfaces within the local area, the method further includes:
[0060] 201. Search all non-local message routing interfaces in the local area;
[0061] In the embodiment of the present invention, in order to find the session status of the target user in a non-local data center or server, it is necessary to first establish a network system within a local area. The current execution end needs to search all non-local message routing interfaces within the local area, and each non-local message routing interface is matched with a corresponding session connection; the session connection here is a physical link established by the server process in which the non-local user participates in the session. Once the user establishes a connection, a server process is created and processes the session request of this user. When the user disconnects, the server process in which the user participates in the session is terminated, that is, the session message content cannot be uploaded or sent through the terminated session service process.
[0062] 202. Establish an association relationship between the searched non-local message routing interface and the local message routing interface, and determine at least one associated message routing interface.
[0063] In the embodiment of the present invention, the current execution end establishes an association relationship between the searched non-local message routing interface and the local message routing interface, and the non-local message routing interface that establishes an association relationship with the local message routing interface is called an associated message routing interface. The number of associated message routing interfaces within the local area is greater than or equal to 1, that is, the information communication between the local message routing and the non-local message routing is realized.
[0064] In another embodiment of the present invention, in order to further define and illustrate, as Figure 3 As shown, before the step of determining the target message routing interface and the target session connection, the method further includes:
[0065] 301. Obtain interface parameters in the real-time session message;
[0066] In an embodiment of the present invention, in order to match the target user within the local area, it is necessary to first process the real-time conversation message sent by the local user. The current execution end needs to obtain the interface parameters in the real-time conversation message sent by the local user, and the interface parameters include message content, target user information, and session request identifier. The message content is the specific conversation content that the local user needs to send to the target user. The target user information includes the target user ID, the target user online information, etc., which is not specifically limited in the embodiment of the present invention. The target user information can also be stored in the form of a list during the message processing process, which is not specifically limited in the embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (i.e., the sender of the session) is located.
[0067] 302. Call the message routing interface based on the interface parameters, and search the distributed cache for a session state corresponding to the real-time session message;
[0068] In the embodiment of the present invention, after the current execution end obtains the interface parameters, it calls all message routing interfaces within the local area based on the interface parameters, and searches the distributed cache corresponding to the message routing interface for the user session state corresponding to the real-time session message in the real-time session message request.
[0069] 303. If the session state is found and the session state is an online state, it is determined that an online session state matching the real-time session message exists in each distributed cache within the local area.
[0070] In the embodiment of the present invention, in order to match the target user within the local area, it is necessary to first match the online session state within the local area. If the current execution end finds the user session state, and the corresponding user session state is an online state, it can be determined that the online session state matching the real-time session message is found in each distributed cache within the local area. Finding the matching online session state is the premise for determining the target message routing interface and the target session connection. The current execution end determines the message routing interface corresponding to the distributed cache where the matching online session state is found as the target message routing interface, and finds the session connection corresponding to the target user from the distributed cache where the matching online session state is found as the target session connection.
[0071] In another embodiment of the present invention, for further definition and explanation, the step of determining the target message routing interface and the target session connection includes:
[0072] Determine a target distributed cache where the session state corresponding to the online session state is stored, and determine a message routing interface corresponding to the target distributed cache as a target message routing interface;
[0073] A connection service configured by the target message routing interface is obtained, and a session connection created by the connection service is determined as a target session connection.
[0074] In the embodiment of the present invention, a distributed cache is set to update and store the session state; and a connection service is configured in the message routing interface to create a session connection between users. The connection service is a service form for establishing a network connection. After determining the online session state, the current execution end determines the distributed cache corresponding to the storage of the online session state as the target distributed cache, and determines the message routing interface corresponding to the target distributed cache as the target message routing interface. After obtaining the target message routing interface, the current execution end needs to obtain the connection service configured by the target message routing interface, and find the target session connection corresponding to the target user through the connection service.
[0075] In another embodiment of the present invention, in order to further define and illustrate, as Figure 4 As shown, the step of calling the target session connection through the target message routing interface and sending the processed real-time session message through the target session connection includes:
[0076] 401. Configure the interface parameters of the target message routing interface according to the message content, target user information, and session request identifier in the real-time session message;
[0077] In an embodiment of the present invention, in order to accurately send the processed message to the target user end, it is necessary to configure the parameters of the target message routing interface to realize the message communication between the target message routing and the local message routing of the current execution end. The current execution end configures the interface parameters of the target message routing interface through the message content, target user information, and session request identifier in the real-time session message. The message content is the specific conversation content that the local user needs to send to the target user. The target user information includes the target user ID, the target user online information, etc., which is not specifically limited in the embodiment of the present invention. The target user information can also be stored in the form of a list during the message processing process, which is not specifically limited in the embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (i.e., the sender of the session) is located.
[0078] 402. Calling a target session connection based on the target message routing interface that has completed the interface parameter configuration, and acquiring the real-time session message that has completed message processing based on the message content;
[0079] 403. Send the real-time session message to a target user matching the target user information and the session request identifier through the target session connection.
[0080] In the embodiment of the present invention, the current execution end calls the target session connection corresponding to the target user at the target message routing interface after completing the interface parameter configuration. After calling the target session connection, the current execution end obtains the real-time session message that has been processed. Message processing is used to represent the process of storing and verifying messages sent by users. During verification, it can be verified whether the message sender and the target user are friends, or whether the sender is a group member, or whether the sender is banned in the group. This is not specifically limited in the embodiment of the present invention. Only messages that have passed the verification during the message processing process can be sent through the target session connection.
[0081] After obtaining the real-time session message after message processing, the current execution end sends the real-time session message to the corresponding target user that matches the target user information and the session request identifier through the target session connection. The target user information includes but is not limited to the target user ID, the target user online information, etc., which is not specifically limited in the embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (i.e., the session sender) is located.
[0082] In another embodiment of the present invention, in order to further define and illustrate, as Figure 5 As shown, the method also includes:
[0083] 501. Detect whether multiple call times of calling all the message routing interfaces are greater than a preset call time threshold;
[0084] 502. If the calling time is greater than a preset calling time threshold, determining that the message routing interface corresponding to the calling time is a calling failure;
[0085] In the embodiment of the present invention, in order to handle the situation of call timeout, a call time threshold is preset. The current execution end detects multiple call times of all message routing interfaces, and compares the detected multiple call times with the preset call time threshold. When there is a situation where the call time among the multiple call times is greater than the preset call time threshold, the message routing interface corresponding to the call time greater than the preset call time is identified as the message routing interface whose call failed. The preset call time is a time value set manually, which can be 2 seconds, 3 seconds, 4 seconds, etc., and the embodiment of the present invention does not make a specific limitation.
[0086] 503. When a real-time conversation message is received again, the message routing interface that failed to be called is retrieved again, and the corresponding distributed cache is queried through the message routing interface that failed to be called to determine whether there is an online conversation state that matches the real-time conversation message, so as to determine whether the message routing interface that failed to be called is the target message routing interface.
[0087] In the embodiment of the present invention, in order to improve the efficiency of calling the message routing interface and save the processing time of the real-time session message, when the current execution end receives the real-time session message again, the message routing interface that is successfully called is no longer called repeatedly, and only the message routing that fails to be called is called repeatedly. After the call is successful, the corresponding distributed cache is queried through the message routing interface that failed to be called to see whether there is an online session state that matches the real-time session message. If there is an online session state that matches the real-time session message, the corresponding message routing interface that failed to be called is determined as the target message routing interface. The current execution end calls the target session connection through the target message routing interface, and sends the processed real-time session message to the corresponding target user through the target session connection.
[0088] In another embodiment of the present invention, for further definition and description, the method further includes:
[0089] When it is detected that the real-time conversation message after the message processing is not sent to the target user through the target conversation connection, the real-time conversation message that has not been sent successfully is transferred to the message sending queue;
[0090] When the polling delivery condition corresponding to the real-time conversation message in the message delivery queue is triggered, the real-time conversation message is delivered to the target user.
[0091] In the embodiment of the present invention, in order to handle the problem of message delivery failure, a message delivery queue is set to process the real-time session message that fails to be delivered, so as to ensure that the delivery of the real-time session message can be achieved even under the influence of factors such as network disconnection or power failure. The current execution end needs to detect the delivery of the real-time session message. When it is detected that the real-time session message after message processing is not delivered to the target user through the target session connection, the current execution end needs to transfer the unsuccessful delivery of the real-time session message to a pre-set message queue. The message delivery queue is used to execute the delivery of the real-time session message in a polling manner, and the polling manner is a manner of repeatedly executing a certain operation at a certain time interval. In the embodiment of the present invention, the current execution end first sets a time interval as a polling delivery condition, such as 5 seconds, 7 seconds, etc., which is not specifically limited in the embodiment of the present invention. When the polling delivery condition corresponding to the real-time session message in the message queue is triggered, the real-time session message is delivered to the target user.
[0092] The embodiment of the present invention provides a method for processing real-time conversation messages. Compared with the prior art, the embodiment of the present invention retrieves all message routing interfaces within a local area when a real-time conversation message is received, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; when the message routing interface finds that there is an online conversation state matching the real-time conversation message in each distributed cache within the local area, the target message routing interface and the target conversation connection are determined, wherein the distributed cache corresponds to one message routing interface; the target conversation connection is called through the target message routing interface, and the real-time conversation message after the message processing is sent through the target conversation connection. In the system architecture constructed by multiple Internet data centers, the online conversation state is searched from each distributed cache within the local area, and the message content in the conversation request is sent to the target user within the local area. Since it is not necessary to update the conversation state in each distributed cache to the main distributed cache, the phenomenon of redundancy of the online conversation state and waste of resources is avoided. Since it is not necessary to search for the online conversation state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time conversation messages is improved.
[0093] Furthermore, as a response to the above Figure 1 The embodiment of the present invention provides a device for processing real-time conversation messages, such as Figure 6 As shown, the device comprises:
[0094] The interface calling module 61 is used to call all message routing interfaces within the local area when receiving a real-time conversation message, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
[0095] A determination module 62, configured to determine a target message routing interface and a target session connection when an online session state matching the real-time session message exists in each distributed cache within the local area through the message routing interface, wherein the distributed cache corresponds to one message routing interface;
[0096] The message sending module 63 is used to call the target session connection through the target message routing interface, and send the real-time session message after message processing through the target session connection.
[0097] Furthermore, the device also includes:
[0098] An interface search module, used for searching all non-local message routing interfaces in a local area, wherein each of the non-local message routing interfaces is matched with a corresponding session connection;
[0099] The association module is used to establish an association relationship between the searched non-local message routing interface and the local message routing interface, and determine at least one associated message routing interface.
[0100] Furthermore, the device also includes:
[0101] A parameter acquisition module, used to acquire interface parameters in the real-time session message, wherein the interface parameters include message content, target user information, and session request identifier;
[0102] A state search module, configured to call the message routing interface based on the interface parameters, and search the distributed cache for a session state corresponding to the real-time session message;
[0103] The matching determination module is used to determine that an online session state matching the real-time session message exists in each distributed cache within the local area if the session state is found and the session state is an online state.
[0104] Furthermore, the determining module 62 includes:
[0105] A target message routing interface determining unit, configured to determine a target distributed cache storing a session state corresponding to the online session state, and determine a message routing interface corresponding to the target distributed cache as a target message routing interface;
[0106] The target session connection determining unit is used to obtain the connection service configured by the target message routing interface, and determine the session connection created by the connection service as the target session connection.
[0107] Furthermore, the message sending module 63 includes:
[0108] An interface parameter configuration unit, used to configure the interface parameters of the target message routing interface according to the message content, target user information, and session request identifier in the real-time session message;
[0109] A message acquisition unit, configured to call a target session connection based on a target message routing interface that completes the interface parameter configuration, and acquire the real-time session message that completes message processing based on the message content;
[0110] The sending unit is used to send the real-time session message to a target user matching the target user information and the session request identifier through the target session connection.
[0111] Furthermore, the device also includes:
[0112] A call time detection module, used to detect whether a plurality of call times for calling all the message routing interfaces is greater than a preset call time threshold;
[0113] A call failure determination module, configured to determine that the message routing interface corresponding to the call time is a call failure if the call time is greater than a preset call time threshold;
[0114] The target message routing interface re-determination module is used to re-call the message routing interface that failed to be called when a real-time conversation message is received again, and query whether there is an online conversation state matching the real-time conversation message in the corresponding distributed cache through the message routing interface that failed to be called, so as to determine whether the message routing interface that failed to be called is the target message routing interface.
[0115] Furthermore, the device also includes:
[0116] The sending exception pre-processing module is used for transferring the unsuccessfully sent real-time session message to a message sending queue when it is detected that the real-time session message after message processing is not sent to the target user through the target session connection. The message sending queue sends the real-time session message in a polling manner.
[0117] The message re-issuing module is used to send the real-time conversation message to the target user when the polling sending condition corresponding to the real-time conversation message in the message sending queue is triggered.
[0118] The embodiment of the present invention provides a device for processing real-time conversation messages. Compared with the prior art, the embodiment of the present invention retrieves all message routing interfaces within a local area when a real-time conversation message is received, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; when the message routing interface finds that there is an online conversation state matching the real-time conversation message in each distributed cache within the local area, the target message routing interface and the target conversation connection are determined, wherein the distributed cache corresponds to one message routing interface; the target conversation connection is called through the target message routing interface, and the real-time conversation message after the message processing is sent through the target conversation connection. In the system architecture constructed by multiple Internet data centers, the online conversation state is searched from each distributed cache within the local area, and the message content in the conversation request is sent to the target user within the local area. Since it is not necessary to update the conversation state in each distributed cache to the main distributed cache, the phenomenon of redundancy of the online conversation state and waste of resources is avoided. Since it is not necessary to search for the online conversation state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time conversation messages is improved.
[0119] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the real-time session processing method in any of the above method embodiments.
[0120] Figure 7 A schematic diagram of the structure of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0121] like Figure 7 As shown, the computer device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0122] The processor 702 , the communication interface 704 , and the memory 706 communicate with each other via a communication bus 708 .
[0123] The communication interface 704 is used to communicate with other devices such as clients or other servers.
[0124] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps in the above-mentioned embodiment of the method for processing public business data.
[0125] Specifically, the program 710 may include program codes, which include computer operation instructions.
[0126] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0127] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0128] The program 710 may be specifically configured to enable the processor 702 to perform the following operations:
[0129] When a real-time conversation message is received, all message routing interfaces within the local area are retrieved, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
[0130] When it is found through the message routing interface that there is an online session state matching the real-time session message in each distributed cache within the local area, a target message routing interface and a target session connection are determined, and the distributed cache corresponds to one message routing interface;
[0131] The target session connection is called through the target message routing interface, and the real-time session message after message processing is sent through the target session connection.
[0132] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0133] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing real-time conversation messages, characterized in that: include: When a real-time conversation message is received, all message routing interfaces within the local area are retrieved, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; When it is found through all message routing interfaces within the local area that there is an online session state matching the real-time session message in each distributed cache within the local area, a target message routing interface and a target session connection are determined, and the distributed cache corresponds to one message routing interface; The target session connection is called through the target message routing interface, and the real-time session message after message processing is sent through the target session connection.
2. The method according to claim 1, characterized in that: Before calling all message routing interfaces within the local area, the method further includes: Searching for all non-local message routing interfaces in a local area, wherein each of the non-local message routing interfaces is matched with a corresponding session connection; An association relationship is established between the searched non-local message routing interface and the local message routing interface, and at least one associated message routing interface is determined.
3. The method according to claim 1, characterized in that Before determining the target message routing interface and the target session connection, the method further includes: Acquire interface parameters in the real-time conversation message, wherein the interface parameters include message content, target user information, and conversation request identifier; Calling the message routing interface based on the interface parameters, searching the distributed cache for a session state corresponding to the real-time session message; If the session state is found and the session state is an online state, it is determined that an online session state matching the real-time session message is found in each distributed cache within the local area.
4. The method according to claim 3, characterized in that: Determining the target message routing interface and the target session connection includes: Determine a target distributed cache where the session state corresponding to the online session state is stored, and determine a message routing interface corresponding to the target distributed cache as a target message routing interface; A connection service configured by the target message routing interface is obtained, and a session connection created by the connection service is determined as a target session connection.
5. The method according to claim 1, characterized in that The calling the target session connection through the target message routing interface and sending the processed real-time session message through the target session connection comprises: Configure the interface parameters of the target message routing interface according to the message content, target user information, and session request identifier in the real-time session message; The target message routing interface calls the target session connection based on the completed interface parameter configuration, and obtains the real-time session message that completes message processing based on the message content; The real-time session message is sent to a target user matching the target user information and the session request identifier through the target session connection.
6. The method according to claim 1, characterized in that The method further comprises: Detecting whether a plurality of call times for calling all the message routing interfaces is greater than a preset call time threshold; If the calling time is greater than the preset calling time threshold, determining that the message routing interface corresponding to the calling time is a calling failure; When a real-time conversation message is received again, the message routing interface that failed to be called is retrieved again, and the corresponding distributed cache is queried through the message routing interface that failed to be called to see whether there is an online conversation state that matches the real-time conversation message, so as to determine whether the message routing interface that failed to be called is the target message routing interface.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When it is detected that the real-time conversation message after the message processing is not sent to the target user through the target conversation connection, the real-time conversation message that has not been sent successfully is transferred to a message sending queue, and the message sending queue executes the sending of the real-time conversation message in a polling manner; When the polling delivery condition corresponding to the real-time conversation message in the message delivery queue is triggered, the real-time conversation message is delivered to the target user.
8. A device for processing real-time conversation messages, characterized in that: include: An interface calling module, used for calling all message routing interfaces within a local area when receiving a real-time conversation message, wherein all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; A determination module, configured to determine a target message routing interface and a target session connection when an online session state matching the real-time session message exists in each distributed cache within the local area through all message routing interfaces within the local area, wherein the distributed cache corresponds to one message routing interface; The message sending module is used to call the target session connection through the target message routing interface, and send the real-time session message after message processing through the target session connection.
9. A storage medium, wherein at least one executable software is stored in the storage medium, and the executable software executes operations corresponding to the method for processing real-time conversation messages according to any one of claims 1 to 7.
10. A terminal comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the method for processing a real-time conversation message according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data transmission method, related device and computer readable storage medium
CN109429215A
Caching method based on a live video system in a named data network
CN109905482A