Message transmission method and device, electronic equipment and computer readable storage medium
By dividing instant messaging data based on the session dimension in a multi-active system and transmitting session messages between session centers, the problem of cross-center data synchronization pressure and user communication is solved, and efficient cross-center communication is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM QUANTUM TECH CO LTD
- Filing Date
- 2024-11-04
- Publication Date
- 2026-04-17
AI Technical Summary
In multi-active systems, existing technologies struggle to achieve efficient cross-center data synchronization and continuous user communication in instant messaging systems, especially under high concurrency conditions where data synchronization pressure is high and users in different centers cannot communicate.
By dividing instant messaging data based on the session dimension in a multi-active system, a session unit database is determined, and session messages are transmitted between session centers through remote procedure calls and push services, ensuring that sessions mainly occur within one center and reducing cross-center data transmission.
This significantly reduces the data storage and synchronization pressure in instant messaging services, enables cross-center communication between users in different centers, and improves system availability and efficiency.
Smart Images

Figure CN119276823B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of instant messaging technology, and in particular to a message transmission method, a message transmission device, an electronic device, and a computer-readable storage medium. Background Technology
[0002] A multi-active system refers to deploying two or more business centers to simultaneously support various business production and operation functions of the business system, thereby improving the overall service capability and resource utilization of the system. In a multi-active center architecture, when a major disaster or failure occurs in one center, or when there is an urgent need to migrate production and operation loads to another center, the application load can be switched smoothly between multiple centers in a relatively short period of time to achieve purposes such as disaster recovery, emergency failover, or load balancing.
[0003] Generally, multiple centers are production centers, and the geographical location of each center is transparent to users and is independent of user client access.
[0004] There are generally two solutions for multi-active systems. One is that users can be randomly or according to an algorithm to any center, and the data and logic of each center remain consistent. The other is to route users to a fixed business center, in which case the data of multiple centers may not be completely consistent.
[0005] Option 1 requires each business center to synchronize data with each other, which is generally suitable for read-heavy, write-light scenarios, thus reducing data synchronization pressure. However, for instant messaging systems, one-on-one chats, group chats, and group creation all generate a large number of write operations, making it a typical read-write balanced system. For high-concurrency instant messaging systems with millions of daily active users, peak message concurrency can reach hundreds of thousands. Synchronizing such a large amount of data across regions would be extremely costly.
[0006] If Option 2 is adopted, users can only be routed to a fixed business center. Firstly, instant messaging systems have unique characteristics; users need to send messages to each other. If user A is in center one and user B is in center two, they cannot add each other as friends, create groups, or send messages, which does not meet the business requirements of instant messaging. Secondly, if user data for a particular business center is not backed up in another center, the system cannot serve those users. Summary of the Invention
[0007] In view of the above problems, embodiments of the present invention are proposed to provide a message transmission method, a message transmission device, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.
[0008] To address the aforementioned problems, this invention discloses a message transmission method applied to a first session center corresponding to the first instant messaging client; the method includes:
[0009] Obtain the session messages sent by the first instant messaging client;
[0010] Determine the session unit database for storing the session messages;
[0011] If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center;
[0012] If the session unit database belongs to the first session center, the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client.
[0013] In one or more embodiments, prior to obtaining the session message sent by the first instant messaging client, the method further includes:
[0014] In response to a connection request from the first instant messaging client, a connection is established with the first instant messaging client.
[0015] In one or more embodiments, the session message includes a session identifier; determining the session unit database for storing the session message includes:
[0016] A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
[0017] In one or more embodiments, sending the session message to the second session center corresponding to the session unit database includes:
[0018] The session message is sent to the second session center corresponding to the session unit database via a remote procedure call.
[0019] In one or more embodiments, the session messages are stored in the session unit database via an instant messaging service.
[0020] In one or more embodiments, sending the session message to the second session center includes:
[0021] The second session center corresponding to the second instant messaging client is determined based on a preset routing algorithm;
[0022] The first push service in the first session center calls the second push service in the second session center, and the session message is sent to the second session center through the second push service.
[0023] In one or more embodiments, establishing a connection with the first instant messaging client includes:
[0024] Establish at least one long connection and at least one short connection with the first instant messaging client.
[0025] Accordingly, this invention discloses a message transmission device applied to a first session center corresponding to the first instant messaging client; the device includes:
[0026] The acquisition module is used to acquire the session messages sent by the first instant messaging client;
[0027] A determining module is used to determine a session unit database for storing the session messages;
[0028] The sending module is configured to send the session message to the second session center corresponding to the session unit database if the session unit database does not belong to the first session center, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center.
[0029] The storage module is configured to, if the session unit database belongs to the first session center, store the session message in the session unit database and call the sending module to send the session message to the second session center, so that the second session center sends the session message to the second instant messaging client.
[0030] In one or more embodiments, it further includes:
[0031] The connection module is configured to establish a connection with the first instant messaging client in response to a connection request from the first instant messaging client before obtaining the session message sent by the first instant messaging client.
[0032] In one or more embodiments, the session message includes a session identifier; the determining module is specifically used for:
[0033] A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
[0034] In one or more embodiments, the sending module is specifically used to:
[0035] The session message is sent to the second session center corresponding to the session unit database via a remote procedure call.
[0036] In one or more embodiments, the session messages are stored in the session unit database via an instant messaging service.
[0037] In one or more embodiments, the sending module is further configured to:
[0038] The second session center corresponding to the second instant messaging client is determined based on a preset routing algorithm;
[0039] The first push service in the first session center calls the second push service in the second session center, and the session message is sent to the second session center through the second push service.
[0040] In one or more embodiments, the connection module is specifically used for:
[0041] Establish at least one long connection and at least one short connection with the first instant messaging client.
[0042] Accordingly, this invention discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various steps of the above-described message transmission method embodiments.
[0043] Accordingly, embodiments of the present invention disclose a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the various steps of the above-described message transmission method embodiments.
[0044] The embodiments of the present invention have the following advantages:
[0045] After receiving the session message sent by the first instant messaging client, the first session center can determine the session unit database used to store the session message. If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center. If the session unit database belongs to the first session center, the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client. In this way, by dividing instant messaging data according to the session dimension, cross-center sessions are greatly reduced, allowing sessions to occur in one center as much as possible. This not only greatly reduces the pressure on data storage and data synchronization in instant messaging services, but also solves the problem of users in different centers being unable to communicate, enabling users in each center to conduct cross-center communication. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the steps of a message transmission method according to a first embodiment of the present invention;
[0047] Figure 2 This is a flowchart of the steps in a second embodiment of the message transmission method of the present invention;
[0048] Figure 3 This is an interactive diagram illustrating the one-to-one instant messaging mechanism of the present invention;
[0049] Figure 4 This is a structural block diagram of an embodiment of a message transmission device according to the present invention. Detailed Implementation
[0050] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] One of the core concepts of this invention is to divide instant messaging data by session dimension, thereby greatly reducing cross-center sessions and allowing sessions to occur in one center as much as possible. This not only greatly reduces the pressure of data storage and data synchronization in instant messaging services, but also solves the problem that users in different centers cannot communicate, enabling users in each center to conduct cross-center communication.
[0052] Reference Figure 1The diagram shows a flowchart of a message transmission method according to an embodiment of the present invention, which can be applied to a session center (referred to as "first session center") corresponding to an instant messaging client (for ease of distinction).
[0053] The first instant messaging client can be installed on the user's terminal device, and the terminal device can have the following characteristics:
[0054] (1) In terms of hardware, the device has a central processing unit, memory, input components, and output components. In other words, the device is often a microcomputer device with communication capabilities. In addition, it can have multiple input methods, such as keyboard, mouse, touch screen, microphone, and camera, and the input can be adjusted as needed. At the same time, the device often has multiple output methods, such as receiver, display screen, etc., which can also be adjusted as needed;
[0055] (2) In terms of software, the device must have an operating system, such as Windows Mobile, Symbian, Palm, Android, iOS, etc. At the same time, these operating systems are becoming increasingly open, and personalized applications developed based on these open operating system platforms are emerging in an endless stream, such as address books, calendars, notepads, calculators, and various games, which greatly meet the needs of personalized users;
[0056] (3) In terms of communication capabilities, the device has flexible access methods and high bandwidth communication performance, and can automatically adjust the selected communication method according to the selected service and the environment, thus facilitating user use. The device can support mobile communication based on 3GPP (3rd Generation Partnership Project), 4GPP (4th Generation Partnership Project), 5GPP (5th Generation Partnership Project), LTE (Long Term Evolution), and WIMAX (World Interoperability for Microwave Access), computer network communication based on TCP / IP (Transmission Control Protocol / Internet Protocol) and UDP (User Datagram Protocol), as well as short-range wireless transmission based on Bluetooth and infrared transmission standards. It not only supports voice services, but also a variety of wireless data services.
[0057] (4) In terms of functionality, the equipment places greater emphasis on humanization, personalization, and multi-functionality. With the development of computer technology, the equipment has shifted from a "device-centric" model to a "human-centric" model, integrating embedded computing, control technology, artificial intelligence technology, and biometric authentication technology, fully embodying the principle of human-centeredness. Due to the development of software technology, the equipment can be customized according to individual needs, becoming more personalized. At the same time, the equipment itself integrates numerous software and hardware components, making its functions increasingly powerful.
[0058] Furthermore, the first session center can be any of multiple centers. In this embodiment of the invention, the data partitioning between units must first be determined, that is, what data is stored in each session unit database. To achieve unit-based partitioning, it must be based on a dimension, with some data going to session unit database A and others to session unit database B. The most common partitioning dimension is based on user identifiers, such as e-commerce, short video, and games. Alternatively, all user-related data can be partitioned into one unit based on the user.
[0059] However, instant messaging services have their own unique characteristics. A message belongs to both parties in the chat, and the same applies to group chats. Users can chat with anyone, making it impossible to find a point of entry for traffic segmentation. Forcibly segmenting based on user identifiers would inevitably result in a user's message appearing in N units, making the self-enclosing of units impossible.
[0060] Generally speaking, business operations can divide data according to user or merchant dimensions, with different data centers storing a portion of the data.
[0061] For example, shopping websites can be divided according to the merchant dimension, with data for merchants 1-10 placed in center 1 and data for merchants 11-20 placed in center 2.
[0062] For example, in a multi-center video service, the centers can be divided according to the creator's identifier. Videos created by users 1 to 10 are placed in center 1, and those created by users 11 to 20 are placed in center 2.
[0063] Since the business can be completed within a certain center when a user accesses a product or a video, this division is not a problem.
[0064] However, instant messaging scenarios have unique characteristics. If routing is based on user identifiers, users 1-10 are routed to center 1; users 11-20 are routed to center 2. If user 1 sends a message to user 11, regardless of whether the message is placed in center 1 or center 2, one of the users will always be unable to access this data.
[0065] In practical applications, an M-session typically refers to a connection established between two or more users through chatting. A session is the basic unit of communication, allowing users to engage in real-time text, voice, or video communication. A session can be a one-on-one chat, or a group chat or chat room with multiple participants. Therefore, the establishment of a session is based on interaction between users. When sending and receiving messages through an instant messaging system, the "session dimension" can be used as the business dimension for instant messaging services. That is, embodiments of this invention can divide instant messaging data based on the session dimension. Based on this, each center in a multi-center system can also be divided based on the session dimension, resulting in multiple session centers, each corresponding to an instant messaging client with the same session dimension. For example, based on the session dimension, the first instant messaging client can be assigned to the first session center.
[0066] It should be noted that the embodiments of the present invention are described using one-on-one chat. Since one-on-one chat and multi-person chat are essentially the same, multi-person chat will not be described in detail.
[0067] This method may specifically include the following steps:
[0068] Step 101: Obtain the session message sent by the first instant messaging client.
[0069] Once the first session center successfully connects with the first instant messaging client, the user can initiate a session message through the first instant messaging client, and the first session center can then obtain that session message.
[0070] Step 102: Determine the session unit database for storing the session messages.
[0071] Each session center can configure a session unit database and a global database. Based on the characteristics of instant messaging services, instant messaging data can be divided into basic data and chat data.
[0072] The basic data can include user information (user ID, user phone number, user nickname, etc.), friend information, group information, and other system data. Because this part of the data is read-heavy and write-light, it can be globally synchronized. This means it's stored in a global database in each session center, and data written to the global database in each session center can be synchronized to the global databases of other session centers.
[0073] Chat data can be routed to a specific session center based on the session dimension; that is, chat data is stored in a session unit database within a session center. If the sender and receiver of a session do not belong to the same session center, data transmission can be performed via API calls.
[0074] Based on this, after receiving a session message, the first session center can determine which session center's session unit database the message should be stored in. For example, if the first session center determines that the message needs to be stored in the second session center's session unit database, it can then transmit the message to the second session center via an API call. Upon receiving the message, the second session center can then store it in its session unit database.
[0075] In this embodiment of the invention, the session message includes a session identifier; determining the session unit database for storing the session message includes:
[0076] A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
[0077] Specifically, as mentioned above, the embodiments of the present invention can be divided according to the session dimension. Therefore, the session message can also include a session identifier. In this way, when determining the session unit database, a preset routing algorithm can be used to retrieve the session identifier in the session message, thereby determining the session unit database used to store the session message.
[0078] The routing algorithm is used to divide data according to the session dimension. In other words, the routing algorithm needs to solve the problem of minimizing cross-center sessions and ensuring that sessions occur in the same center as much as possible.
[0079] However, after dividing the session centers according to the session dimension, there is still a problem: session messages may be randomly routed to a certain session center. As a result, a user's session messages may exist in multiple session centers, which will bring a lot of data synchronization pressure.
[0080] Therefore, based on the characteristics of instant messaging services, conversation messages mainly occur within an organization or a specific region. Accordingly, embodiments of the present invention can route instant messaging clients according to organizational identifiers or according to the region where the instant messaging client is located.
[0081] For example, in work-related access routing, the routing algorithm can be based on the company name or organization name; in daily life scenarios, the routing algorithm can be based on the region (province name). As for the specific routing algorithm chosen, this embodiment of the invention can use big data algorithms to find the feature with the highest relevance to the session as the basis for the routing algorithm.
[0082] Step 103: If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center.
[0083] If the identified session unit database does not belong to the first session center, the session message can be sent to the session center to which the session unit database belongs (denoted as the "second session center"). After receiving the session message, the second session center can store the session message in the session unit and simultaneously send the session message to the instant messaging client connected to the second session center (denoted as the "second instant messaging client"). The second instant messaging client can then display the session message to the user.
[0084] For example, User 1 initiates a conversation message through Instant Messaging Client 1. Instant Messaging Client 1 sends the conversation message to Conversation Center 1. Conversation Center 1 determines, based on a routing algorithm, that the conversation message needs to be stored in Conversation Center 2. Therefore, Conversation Center 1 sends the conversation message to Conversation Center 2. Conversation Center 2 stores the conversation message in its Conversation Unit Database and simultaneously sends the conversation message to Instant Messaging Client 2. Instant Messaging Client 2 then displays the conversation message to User 2.
[0085] In this embodiment of the invention, sending the session message to the second session center corresponding to the session unit database includes:
[0086] The session message is sent to the second session center corresponding to the session unit database via a remote procedure call.
[0087] Specifically, after determining that the session unit database does not belong to the first session center, the session route of the first session center can call RPC (Remote Procedure Call) to send the session message to the second session center corresponding to the session unit database, and the session route in the second session center can then obtain the session message.
[0088] Furthermore, conversation messages can be stored in the conversation unit database via the instant messaging service (IM Server). In other words, after the conversation route in the second conversation center obtains the conversation message, it can store the message in the conversation unit database within the second conversation center via the instant messaging service.
[0089] Step 104: If the session unit database belongs to the first session center, then the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client.
[0090] If the identified session unit database belongs to the first session center, then the session message can be stored in that session unit database. At the same time, the session message is sent to the second session center, which then sends the session data to the second instant messaging client. The second instant messaging client can then display the session message to the user.
[0091] In addition, session messages can also be stored in the session unit database via instant messaging services. That is, after the session route in the first session center obtains the session message, it can store the session message in the session unit database in the first session center via instant messaging services.
[0092] In this embodiment of the invention, sending the session message to the second session center includes:
[0093] The second session center corresponding to the second instant messaging client is determined based on a preset routing algorithm;
[0094] The first push service in the first session center calls the second push service in the second session center, and the session message is sent to the second session center through the second push service.
[0095] Specifically, when the first session center sends a session message, it can use a routing algorithm to calculate the second session center to which the second instant messaging client belongs. Then, it uses the push service in the first session center (referred to as the "first push service") to call the push service in the second session center (referred to as the "second push service"). In this way, the first push service can send the session message to the second push service in the second session center. Finally, the second session center sends the session message to the second instant messaging client, and the second instant messaging client can then display the session message to the user.
[0096] In this embodiment of the invention, after the first session center receives the session message sent by the first instant messaging client, it can determine the session unit database used to store the session message. If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center. If the session unit database belongs to the first session center, the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client. In this way, by dividing instant messaging data by the session dimension, cross-center sessions are greatly reduced, allowing sessions to occur in one center as much as possible. This not only greatly reduces the pressure on data storage and data synchronization in instant messaging services, but also solves the problem of users in different centers being unable to communicate, enabling users in each center to conduct cross-center communication.
[0097] Reference Figure 2 The flowchart illustrates a second embodiment of the message transmission method of the present invention, which may specifically include the following steps:
[0098] Step 201: In response to a connection request from the first instant messaging client, establish a connection with the first instant messaging client.
[0099] After a user launches the first instant messaging client on their terminal device, the client connects to the access layer router. The access layer router then calculates, using a routing algorithm, which session center the client belongs to. Once the session center is determined, the client is routed to it. Upon receiving the connection request, the session center establishes a connection with the client. After a successful connection, the user can initiate session messages through the client.
[0100] When the first session center establishes a connection with the first instant messaging client, it can establish at least one long connection and at least one short connection. In other words, all session messages initiated by the first instant messaging client can be sent to the first session center.
[0101] Step 202: Obtain the session message sent by the first instant messaging client.
[0102] Once the first session center successfully connects with the first instant messaging client, the user can initiate a session message through the first instant messaging client, and the first session center can then obtain that session message.
[0103] Step 203: Determine the session unit database for storing the session messages.
[0104] Each session center can configure a session unit database and a global database. Based on the characteristics of instant messaging services, instant messaging data can be divided into basic data and chat data.
[0105] The basic data can include user information (user ID, user phone number, user nickname, etc.), friend information, group information, and other system data. Because this part of the data is read-heavy and write-light, it can be globally synchronized. This means it's stored in a global database in each session center, and data written to the global database in each session center can be synchronized to the global databases of other session centers.
[0106] Chat data can be routed to a specific session center based on the session dimension; that is, chat data is stored in a session unit database within a session center. If the sender and receiver of a session do not belong to the same session center, data transmission can be performed via API calls.
[0107] Based on this, after receiving a session message, the first session center can determine which session center's session unit database the message should be stored in. For example, if the first session center determines that the message needs to be stored in the second session center's session unit database, it can then transmit the message to the second session center via an API call. Upon receiving the message, the second session center can then store it in its session unit database.
[0108] In this embodiment of the invention, the session message includes a session identifier; determining the session unit database for storing the session message includes:
[0109] A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
[0110] Specifically, as mentioned above, the embodiments of the present invention can be divided according to the session dimension. Therefore, the session message can also include a session identifier. In this way, when determining the session unit database, a preset routing algorithm can be used to retrieve the session identifier in the session message, thereby determining the session unit database used to store the session message.
[0111] The routing algorithm is used to divide data according to the session dimension. In other words, the routing algorithm needs to solve the problem of minimizing cross-center sessions and ensuring that sessions occur in the same center as much as possible.
[0112] However, after dividing the session centers according to the session dimension, there is still a problem: session messages may be randomly routed to a certain session center. As a result, a user's session messages may exist in multiple session centers, which will bring a lot of data synchronization pressure.
[0113] Therefore, based on the characteristics of instant messaging services, conversation messages mainly occur within an organization or a specific region. Accordingly, embodiments of the present invention can route instant messaging clients according to organizational identifiers or according to the region where the instant messaging client is located.
[0114] For example, in work-related access routing, the routing algorithm can be based on the company name or organization name; in daily life scenarios, the routing algorithm can be based on the region (province name). As for the specific routing algorithm chosen, this embodiment of the invention can use big data algorithms to find the feature with the highest relevance to the session as the basis for the routing algorithm.
[0115] Step 204: If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center.
[0116] If the identified session unit database does not belong to the first session center, the session message can be sent to the second session center to which that session unit database belongs. Upon receiving the session message, the second session center can store it in the session unit and simultaneously send it to a second instant messaging client connected to the second session center. The second instant messaging client can then display the session message to the user.
[0117] In this embodiment of the invention, sending the session message to the second session center corresponding to the session unit database includes:
[0118] The session message is sent to the second session center corresponding to the session unit database via a remote procedure call.
[0119] Specifically, after determining that the session unit database does not belong to the first session center, the session route of the first session center can call RPC to send the session message to the second session center corresponding to the session unit database, and the session route in the second session center can then obtain the session message.
[0120] Furthermore, session messages can be stored in the session unit database via instant messaging services. In other words, after the session route in the second session center obtains the session message, it can store the session message in the session unit database in the second session center via instant messaging services.
[0121] Step 205: If the session unit database belongs to the first session center, then the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client.
[0122] If the identified session unit database belongs to the first session center, then the session message can be stored in that session unit database. At the same time, the session message is sent to the second session center, which then sends the session data to the second instant messaging client. The second instant messaging client can then display the session message to the user.
[0123] In addition, session messages can also be stored in the session unit database via instant messaging services. That is, after the session route in the first session center obtains the session message, it can store the session message in the session unit database in the first session center via instant messaging services.
[0124] In this embodiment of the invention, sending the session message to the second session center includes:
[0125] The second session center corresponding to the second instant messaging client is determined based on a preset routing algorithm;
[0126] The first push service in the first session center calls the second push service in the second session center, and the session message is sent to the second session center through the second push service.
[0127] Specifically, when the first session center sends a session message, it can use a routing algorithm to calculate the second session center to which the second instant messaging client belongs. Then, it uses the first push service in the first session center to call the second push service in the second session center. In this way, the first push service can send the session message to the second push service in the second session center. Finally, the second session center sends the session message to the second instant messaging client, and the second instant messaging client can then display the session message to the user.
[0128] In this embodiment of the invention, instant messaging data is divided by the session dimension, thereby greatly reducing cross-center sessions and allowing sessions to occur in one center as much as possible. This not only greatly reduces the pressure on data storage and data synchronization in instant messaging services, but also solves the problem that users in different centers cannot communicate, enabling users in each center to conduct cross-center communication.
[0129] For ease of understanding, Figure 3 The diagram illustrates a one-to-one instant messaging interaction, where the access routing layer has determined that user 1 accesses session center 1 and user 2 accesses session center 2.
[0130] User 1 connects to Session Center 1 through Instant Messaging Client 1, and User 2 connects to Session Center 2 through Instant Messaging Client 2. The conversation messages between 1 and 2 are stored in the Session Unit Database of Session Center 1.
[0131] When User 2 sends a message to User 1, Instant Messaging Client 2 sends the message to Session Center 2. Message Receiving Service 2 in Session Center 2 receives the message and, through Session Router 2, calculates that the message is stored in Session Unit Database 1 of Session Center 1. At this point, Session Router 2 in Session Center 2 needs to call RPC to send the message data to Session Router 1 in Session Center 1. Session Router 1 in Session Center 1 then stores the message in Session Unit Database 1 through Instant Messaging Service 1. Simultaneously, Instant Messaging Service 1 sends the message to Instant Messaging Client 1 through Push Service 1. Instant Messaging Client 1 then displays the message sent by User 2 to the user.
[0132] When User 1 sends a message to User 2, Instant Messaging Client 1 sends the message to Session Center 1. Message Receiving Service 1 in Session Center 1 receives the message and, through Session Routing 1, calculates that the message is stored in Session Unit Database 1 within Session Center 1. At this point, Session Routing 1 stores the message in Session Unit Database 1 via Instant Messaging Service 1 (User 2 has not yet received the message). Simultaneously, the routing algorithm calculates which Session Center User 2 is connected to. After determining that User 2 is connected to Session Center 2, Push Service 1 in Session Center 1 can call Push Service 2 in Session Center 2. Thus, Push Service 2 sends the message to Session Center 2. Finally, Session Center 2 sends the message to Instant Messaging Service 2, which then displays the message sent by User 1 to User 2.
[0133] Furthermore, global database 1 in session center 1 and global database 2 in session center 2 maintain data synchronization.
[0134] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0135] Reference Figure 4 The diagram illustrates a structural block diagram of an embodiment of the message transmission device of the present invention, which may specifically include the following modules:
[0136] The acquisition module 401 is used to acquire the session messages sent by the first instant messaging client;
[0137] The determining module 402 is used to determine the session unit database for storing the session messages;
[0138] The sending module 403 is used to send the session message to the second session center corresponding to the session unit database if the session unit database does not belong to the first session center, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center.
[0139] The storage module 404 is configured to, if the session unit database belongs to the first session center, store the session message in the session unit database and call the sending module to send the session message to the second session center, so that the second session center sends the session message to the second instant messaging client.
[0140] In this embodiment of the invention, it further includes:
[0141] The connection module is configured to establish a connection with the first instant messaging client in response to a connection request from the first instant messaging client before obtaining the session message sent by the first instant messaging client.
[0142] In this embodiment of the invention, the session message includes a session identifier; the determining module is specifically used for:
[0143] A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
[0144] In this embodiment of the invention, the sending module is specifically used for:
[0145] The session message is sent to the second session center corresponding to the session unit database via a remote procedure call.
[0146] In this embodiment of the invention, the session messages are stored in the session unit database via an instant messaging service.
[0147] In this embodiment of the invention, the sending module is further configured to:
[0148] The second session center corresponding to the second instant messaging client is determined based on a preset routing algorithm;
[0149] The first push service in the first session center calls the second push service in the second session center, and the session message is sent to the second session center through the second push service.
[0150] In this embodiment of the invention, the connection module is specifically used for:
[0151] Establish at least one long connection and at least one short connection with the first instant messaging client.
[0152] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0153] This invention also provides an electronic device, comprising:
[0154] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described message transmission method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0155] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described message transmission method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0156] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0157] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0158] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0159] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0161] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0162] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0163] The above provides a detailed description of a message transmission method and a message transmission device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A message transmission method, characterized in that, The method is applied to a first session center corresponding to a first instant messaging client; the method includes: Obtain the session messages sent by the first instant messaging client; Determine the session unit database for storing the session messages; If the session unit database does not belong to the first session center, the session message is sent to the second session center corresponding to the session unit database, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center, including: sending the session message to the second session center corresponding to the session unit database through a remote procedure call; If the session unit database belongs to the first session center, the session message is stored in the session unit database and sent to the second session center, so that the second session center sends the session message to the second instant messaging client. This includes: determining the second session center corresponding to the second instant messaging client based on a preset routing algorithm; using the first push service in the first session center to call the second push service in the second session center, and sending the session message to the second session center through the second push service.
2. The message transmission method according to claim 1, characterized in that, Before retrieving the session message sent by the first instant messaging client, the process also includes: In response to a connection request from the first instant messaging client, a connection is established with the first instant messaging client.
3. The message transmission method according to claim 1, characterized in that, The session message includes a session identifier; determining the session unit database for storing the session message includes: A preset routing algorithm is used to retrieve the session identifier and determine the session unit database used to store the session messages.
4. The message transmission method according to claim 1, characterized in that, The session messages are stored in the session unit database via an instant messaging service.
5. The message transmission method according to claim 2, characterized in that, Establishing a connection with the first instant messaging client includes: Establish at least one long connection and at least one short connection with the first instant messaging client.
6. A message transmission device, characterized in that, An apparatus applied to a first session center corresponding to a first instant messaging client; the apparatus includes: The acquisition module is used to acquire the session messages sent by the first instant messaging client; A determining module is used to determine a session unit database for storing the session messages; The sending module is configured to send the session message to the second session center corresponding to the session unit database if the session unit database does not belong to the first session center, so that the second session center stores the session message in the session unit database and sends the session message to the second instant messaging client corresponding to the second session center, including: sending the session message to the second session center corresponding to the session unit database through a remote procedure call; A storage module is configured to, if the session unit database belongs to the first session center, store the session message in the session unit database and call the sending module to send the session message to the second session center, so that the second session center sends the session message to the second instant messaging client. This includes: determining the second session center corresponding to the second instant messaging client based on a preset routing algorithm; using a first push service in the first session center to call a second push service in the second session center, and sending the session message to the second session center through the second push service.
7. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the message transmission method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the message transmission method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Clustered session management
CN104854575A
Method and device for synchronizing session information, electronic device, and storage medium
CN109257448A