Message transmission method and device, electronic equipment and computer readable storage medium
By dividing instant communication data in the session dimension and routing it in the multi-living system, the synchronization pressure and cross-center communication problems in the multi-living system are solved, and cross-center communication capabilities are achieved.
Patent Information
- Application Number
- CN202411560753.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-11-04
AI Technical Summary
In multi-active systems, the data synchronization pressure of the instant communication system is high, and when users are distributed in different centers, it is impossible to communicate and cannot meet business needs.
The instant communication data is divided through the session dimension, the session unit database is determined, and the session messages are stored and transmitted in the same center through a preset routing algorithm, reducing cross-center data synchronization and realizing cross-center communication.
It greatly reduces the pressure of data storage and synchronization, solves the problem that users of different centers cannot communicate, and realizes cross-center communication between each center user.
Smart Images

Figure CN119276823A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of instant messaging, and in particular to a message transmission method, a message transmission device, an electronic device and a computer-readable storage medium. Background Art
[0002] A multi-active system refers to the deployment of two or more business centers, which simultaneously carry various business production and operation functions of the business system to improve the overall service capabilities of the system and the utilization rate of system resources. In the architecture of multi-active centers, when a major disaster or failure occurs in a center, or when it is urgent to migrate the production and operation load to another center, the application load can be smoothly switched between multiple centers in a short period of time to achieve the purpose of disaster recovery, emergency switching or load balancing of the center.
[0003] Generally speaking, multiple centers are production centers, and the geographical location of each center is transparent to users and has nothing to do with user client access.
[0004] There are usually two solutions for multi-active systems. One is that users can be routed to any center randomly or according to an algorithm, and the data and logic of each center are consistent. The other is to route users to a fixed business center. In this case, the data of multiple centers may not be completely consistent.
[0005] Solution 1 requires each business center to synchronize data with each other. It is generally suitable for scenarios with more reads and fewer writes, so the pressure of data synchronization is small. For instant messaging systems, single chat, group chat, group creation and other operations will bring a large number of write operations. It is a typical read-write balanced system. For an instant messaging system with large concurrency and millions of daily active users, the peak message concurrency can reach hundreds of thousands. The cost of synchronizing such a large amount of data across regions will be very high.
[0006] If the second solution is adopted, users can only be routed to a fixed business center. On the one hand, the instant messaging system has its own characteristics. Users need to send messages to each other. When user A is in center 1 and user B is in center 2, they cannot add friends, create groups, or send messages to each other, which does not meet the business requirements of instant messaging. At the same time, if the user data of a certain business center is not backed up in another center, the system cannot serve these 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 the above problems or at least partially solve the above problems.
[0008] In order to solve the above problem, an embodiment of the present invention discloses a message transmission method, which is applied to a first conversation center corresponding to the first instant messaging client; the method comprises:
[0009] Obtaining a conversation message sent by the first instant messaging client;
[0010] determining a session unit database for storing the session message;
[0011] If the conversation unit database does not belong to the first conversation center, sending the conversation message to a second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to a second instant messaging client corresponding to the second conversation center;
[0012] If the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database, and the conversation message is sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client.
[0013] In one or more embodiments, before acquiring the conversation message sent by the first instant messaging client, the method further includes:
[0014] In response to a connection request for a 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; and the determining a session unit database for storing the session message includes:
[0016] The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
[0017] In one or more embodiments, sending the conversation message to the second conversation center corresponding to the conversation unit database includes:
[0018] The session message is sent to the second session center corresponding to the session unit database through a remote procedure call.
[0019] In one or more embodiments, the conversation message is stored in the conversation unit database via an instant messaging service.
[0020] In one or more embodiments, sending the conversation message to the second conversation center includes:
[0021] Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm;
[0022] The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation 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, an embodiment of the present invention discloses a message transmission device, which is applied to a first conversation center corresponding to the first instant messaging client; the device includes:
[0026] An acquisition module, used for acquiring a session message sent by the first instant messaging client;
[0027] A determination module, used for determining a session unit database for storing the session message;
[0028] a sending module, configured to send the conversation message to a second conversation center corresponding to the conversation unit database if the conversation unit database does not belong to the first conversation center, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to a second instant messaging client corresponding to the second conversation center;
[0029] A storage module is used to store the session message in the session unit database if the session unit database belongs to the first session center, 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, further comprising:
[0031] The connection module is configured to establish a connection with the first instant messaging client in response to a connection request for the first instant messaging client before acquiring the conversation message sent by the first instant messaging client.
[0032] In one or more embodiments, the session message includes a session identifier; and the determining module is specifically configured to:
[0033] The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
[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 through a remote procedure call.
[0036] In one or more embodiments, the conversation message is stored in the conversation unit database via an instant messaging service.
[0037] In one or more embodiments, the sending module is further configured to:
[0038] Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm;
[0039] The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation center through the second push service.
[0040] In one or more embodiments, the connection module is specifically used to:
[0041] Establish at least one long connection and at least one short connection with the first instant messaging client.
[0042] Correspondingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the various steps of the above-mentioned message transmission method embodiment when executed by the processor.
[0043] Accordingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each step of the above-mentioned message transmission method embodiment is implemented.
[0044] The embodiments of the present invention include the following advantages:
[0045] After the first conversation center obtains the conversation message sent by the first instant messaging client, it can determine the conversation unit database used to store the conversation message; if the conversation unit database does not belong to the first conversation center, the conversation message is sent to the second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to the second instant messaging client corresponding to the second conversation center; if the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database and sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client. In this way, the instant messaging data is divided by the conversation dimension, thereby greatly reducing the cross-center conversations and making the conversations occur in one center as much as possible, which not only greatly reduces the pressure of data storage and data synchronization in the instant messaging service, but also solves the problem that users in different centers cannot communicate, and realizes that users in each center can communicate across centers. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flow chart of the steps of Embodiment 1 of a message transmission method of the present invention;
[0047] Figure 2 is a flow chart of the steps of Embodiment 2 of a message transmission method of the present invention;
[0048] Figure 3 It is a schematic diagram of the interaction of one-to-one instant messaging of the present invention;
[0049] Figure 4 It is a structural block diagram of an embodiment of a message transmission device of the present invention. DETAILED DESCRIPTION
[0050] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] One of the core concepts of the embodiments of the present invention is to divide the instant messaging data by the conversation dimension, thereby greatly reducing cross-center conversations and allowing conversations to occur in one center as much as possible. This not only greatly reduces the pressure of data storage and data synchronization in the instant messaging service, but also solves the problem that users in different centers cannot communicate, and enables users in each center to communicate across centers.
[0052] Reference Figure 1, showing a step flow chart of a message transmission method embodiment 1 of the present invention, which can be applied to a conversation center (referred to as the "first conversation center") corresponding to an instant messaging client (referred to as the "first instant messaging client" for easy distinction).
[0053] The first instant messaging client may be installed in a terminal device used by the user, and the terminal device may have the following features:
[0054] (1) In terms of hardware system, the device has a central processing unit, memory, input components and output components, that is, the device is often a microcomputer device with communication function. In addition, it can also 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 system, 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 more and more 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, so as to facilitate user use. The device can support 3GPP (3rd Generation Partnership Project), 4GPP (4th Generation Partnership Project), 5GPP (5th Generation Partnership Project), LTE (Long Term Evolution), WIMAX (World Interoperability for Microwave Access) mobile communications, computer network communications based on TCP / IP (Transmission Control Protocol / Internet Protocol) and UDP (User Datagram Protocol) protocols, and short-range wireless transmission methods based on Bluetooth and infrared transmission standards. It not only supports voice services, but also supports a variety of wireless data services;
[0057] (4) In terms of functional use, the equipment pays more attention to humanization, personalization and multi-functionality. With the development of computer technology, the equipment has moved from a "device-centric" model to a "people-centric" model, integrating embedded computing, control technology, artificial intelligence technology and biometric authentication technology, fully reflecting the people-oriented purpose. Due to the development of software technology, the equipment can adjust the settings according to personal needs and become more personalized. At the same time, the equipment itself integrates a lot of software and hardware, and its functions are becoming more and more powerful.
[0058] Furthermore, the first conversation center can be any one of the multiple centers. In the embodiment of the present invention, it is necessary to first determine the data division between units, that is, what data is stored in each conversation unit database. To achieve unit division, it is necessary to divide based on one dimension, with one part going to conversation unit database A and one part going to conversation unit database B. The most common division dimension is division by user ID, such as e-commerce business, short video business, and game. All user-related data can be divided into one unit according to the user.
[0059] However, instant messaging services have their own particularities. A message belongs to both parties in the chat, and the same is true for group chats. Users can chat with anyone, so there is no way to find a point of entry to divide the traffic. Forcibly dividing by user ID will inevitably lead to a user's message appearing in N units, and the self-closure of the unit cannot be achieved.
[0060] Generally speaking, general businesses can divide data according to user or merchant dimensions, and different data centers each store part of the data.
[0061] For example, a shopping website can be divided according to the merchant dimension, with the data of merchants 1 to 10 placed in center 1, and the data of merchants 11 to 20 placed in center 2.
[0062] For example, the multi-center of the video service can be divided according to the creator's ID. Videos created by users 1 to 10 are placed in center 1, and videos created by users 11 to 20 are placed in center 2.
[0063] Since when a user accesses a product or a video, the service can be completed in a certain center, there is no problem with this division.
[0064] However, instant messaging scenarios are special. If routing is performed based on user IDs, users 1 to 10 are routed to center 1, and users 11 to 20 are routed to center 2. At this time, user 1 sends a message to user 11. Regardless of whether the message is placed in center 1 or center 2, one user cannot access this part of the data.
[0065] In practical applications, an M session usually refers to an association established between two or more users due to chatting. A session is a basic communication unit that allows users to communicate in real time via text, voice or video. A session can be a one-to-one chat, or a group chat or chat room with multiple participants. Therefore, the establishment of a session is based on the interaction between users. When sending and receiving messages through an instant messaging system, the "session dimension" can be used as the business dimension of the instant messaging service. In other words, the embodiment of the present invention can divide the instant messaging data based on the session dimension. Based on this, each center in the multi-center can also be divided based on the session dimension, thereby obtaining multiple session centers, each session center corresponding to an instant messaging client of the same session dimension. For example, the first instant messaging client can be divided into the first session center according to the session dimension.
[0066] It should be noted that the embodiment of the present invention is described with reference to a one-to-one chat. Since the essence of a one-to-one chat is the same as a chat with multiple participants, the chat with multiple participants will not be described in detail.
[0067] The method may specifically include the following steps:
[0068] Step 101: Acquire a conversation message sent by the first instant messaging client.
[0069] When the first conversation center is successfully connected to the first instant messaging client, the user can initiate a conversation message through the first instant messaging client, and the first conversation center can obtain the conversation message.
[0070] Step 102: Determine a session unit database for storing the session message.
[0071] In each conversation center, a conversation unit database and a global database can be set. According to the characteristics of the instant messaging service, the instant messaging data can be divided into basic data and chat data.
[0072] Among them, basic data may include user information (user ID, user mobile phone number, user nickname, etc.), friend information, group information, other system data, etc. Since this part of data is read more and written less, this part of data can be globally synchronized, that is, stored in the global database of each session center, and the data written in the global database of each session center can be synchronized to the global database of other session centers.
[0073] Chat data can be routed to a session center based on the session dimension, that is, chat data is stored in a session unit database of a session center. If the sender and receiver of the session do not belong to the same session center, data transmission can be performed through interface calls.
[0074] Based on this, after obtaining the session message, the first session center can determine in which session center's session unit database the session message needs to be stored. For example, after obtaining the session message, the first session center determines that the session message needs to be stored in the session unit database of the second session center. Then, the first session center can transmit the session message to the second session center by calling the interface, and after obtaining the session message, the second session center can store the session message in the session unit database.
[0075] In the embodiment of the present invention, the session message includes a session identifier; and the step of determining a session unit database for storing the session message includes:
[0076] The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
[0077] Specifically, as mentioned above, the embodiment of the present invention can be divided according to the session dimension, so 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] Among them, the routing algorithm is used to divide the data according to the session dimension. In other words, the routing algorithm needs to solve the problem of reducing cross-center sessions as much as possible and making the sessions occur in the same center as much as possible.
[0079] After dividing the conversation center according to the conversation dimension, there is still a problem. The conversation message may be randomly routed to a conversation center. In this way, the conversation message of a user may exist in multiple conversation centers, which will bring great data synchronization pressure.
[0080] Therefore, according to the characteristics of instant messaging services, session messages mainly occur within an organization or in a certain region. Based on this, the embodiment of the present invention can route the instant messaging client according to the organization identifier, or route according to the region where the instant messaging client is located.
[0081] For example, when applying access routing to work scenarios, the company name or organization name can be selected as the basis for the routing algorithm; when applying to daily life scenarios, the region (province name) can be selected as the basis for the routing algorithm. As for which routing algorithm to choose, the embodiment of the present invention can use the big data algorithm to find the feature with the greatest correlation with the session as the basis for the routing algorithm.
[0082] Step 103: If the conversation unit database does not belong to the first conversation center, the conversation message is sent to the second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to the second instant messaging client corresponding to the second conversation center.
[0083] If the determined conversation unit database does not belong to the first conversation center, the conversation message can be sent to the conversation center to which the conversation unit database belongs (referred to as the "second conversation center"). After the second conversation center obtains the conversation message, it can store the conversation message in the conversation unit and send the conversation message to the instant messaging client connected to the second conversation center (referred to as the "second instant messaging client"). The second instant messaging client can display the conversation message to the user.
[0084] For example, user 1 initiates a conversation message through instant messaging client 1, and instant messaging client 1 sends the conversation message to conversation center 1. Conversation center 1 determines that the conversation message needs to be stored in conversation center 2 based on the routing algorithm, so conversation center 1 sends the conversation message to conversation center 2, and conversation center 2 stores the conversation message in its conversation unit database. At the same time, the conversation message is sent to instant messaging client 2, and instant messaging client 2 displays the conversation message to user 2.
[0085] In the embodiment of the present invention, the sending of the conversation message to the second conversation center corresponding to the conversation unit database includes:
[0086] The session message is sent to the second session center corresponding to the session unit database through a remote procedure call.
[0087] Specifically, after determining that the session unit database does not belong to the first session center, the session routing 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 routing in the second session center can obtain the session message.
[0088] Furthermore, the conversation message can be stored in the conversation unit database through the instant messaging service (IM Server). That is, after the conversation router in the second conversation center obtains the conversation message, the conversation message can be stored in the conversation unit database in the second conversation center through the instant messaging service.
[0089] Step 104: if the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database, and the conversation message is sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client.
[0090] If the determined conversation unit database belongs to the first conversation center, the conversation message can be stored in the conversation unit database. At the same time, the conversation message can be sent to the second conversation center. The second conversation center sends the conversation data to the second instant messaging client, and the second instant messaging client can display the conversation message to the user.
[0091] The conversation message may also be stored in the conversation unit database through the instant messaging service. That is, after the conversation router in the first conversation center obtains the conversation message, the conversation message may be stored in the conversation unit database in the first conversation center through the instant messaging service.
[0092] In the embodiment of the present invention, the sending the session message to the second session center includes:
[0093] Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm;
[0094] The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation center through the second push service.
[0095] Specifically, when sending a conversation message, the first conversation center can use a routing algorithm to calculate the second conversation center to which the second instant messaging client belongs, and then use the push service in the first conversation center (referred to as the "first push service") to call the push service in the second conversation center (referred to as the "second push service"). In this way, the first push service can send the conversation message to the second push service in the second conversation center. Finally, the second conversation center sends the conversation message to the second instant messaging client, and the second instant messaging client can display the conversation message to the user.
[0096] In an embodiment of the present invention, after the first conversation center obtains the conversation message sent by the first instant messaging client, it can determine the conversation unit database used to store the conversation message; if the conversation unit database does not belong to the first conversation center, the conversation message is sent to the second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to the second instant messaging client corresponding to the second conversation center; if the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database and sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client. In this way, the instant messaging data is divided by the conversation dimension, thereby greatly reducing the cross-center conversations, and making the conversations occur in one center as much as possible, which not only greatly reduces the pressure of data storage and data synchronization in the instant messaging service, but also solves the problem that users in different centers cannot communicate, and realizes that users in each center can communicate across centers.
[0097] Reference Figure 2 , shows a flow chart of the steps of Embodiment 2 of a message transmission method of the present invention, which may specifically include the following steps:
[0098] Step 201: In response to a connection request for a first instant messaging client, establish a connection with the first instant messaging client.
[0099] After the user starts the first instant messaging client in the terminal device, the first instant messaging client can be connected to the access layer routing, and the access layer routing can calculate which session center the first instant messaging client belongs to according to the routing algorithm. After determining that the first instant messaging client belongs to the first session center, the first instant messaging client can be routed to the first session center. After obtaining the connection request, the first session center can establish a connection with the first messaging client. After the connection is successfully established, the user can initiate a session message through the first instant messaging client.
[0100] When the first conversation center establishes a connection with the first instant messaging client, at least one long connection and at least one short connection may be established. That is, all conversation messages initiated by the first instant messaging client may be sent to the first conversation center.
[0101] Step 202: Acquire the conversation message sent by the first instant messaging client.
[0102] When the first conversation center is successfully connected to the first instant messaging client, the user can initiate a conversation message through the first instant messaging client, and the first conversation center can obtain the conversation message.
[0103] Step 203: determine a session unit database for storing the session message.
[0104] In each conversation center, a conversation unit database and a global database can be set. According to the characteristics of the instant messaging service, the instant messaging data can be divided into basic data and chat data.
[0105] Among them, basic data may include user information (user ID, user mobile phone number, user nickname, etc.), friend information, group information, other system data, etc. Since this part of data is read more and written less, this part of data can be globally synchronized, that is, stored in the global database of each session center, and the data written in the global database of each session center can be synchronized to the global database of other session centers.
[0106] Chat data can be routed to a session center based on the session dimension, that is, chat data is stored in a session unit database of a session center. If the sender and receiver of the session do not belong to the same session center, data transmission can be performed through interface calls.
[0107] Based on this, after obtaining the session message, the first session center can determine in which session center's session unit database the session message needs to be stored. For example, after obtaining the session message, the first session center determines that the session message needs to be stored in the session unit database of the second session center. Then, the first session center can transmit the session message to the second session center by calling the interface, and after obtaining the session message, the second session center can store the session message in the session unit database.
[0108] In the embodiment of the present invention, the session message includes a session identifier; and the step of determining a session unit database for storing the session message includes:
[0109] The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
[0110] Specifically, as mentioned above, the embodiment of the present invention can be divided according to the session dimension, so 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] Among them, the routing algorithm is used to divide the data according to the session dimension. In other words, the routing algorithm needs to solve the problem of reducing cross-center sessions as much as possible and making the sessions occur in the same center as much as possible.
[0112] After dividing the conversation center according to the conversation dimension, there is still a problem. The conversation message may be randomly routed to a conversation center. In this way, the conversation message of a user may exist in multiple conversation centers, which will bring great data synchronization pressure.
[0113] Therefore, according to the characteristics of instant messaging services, session messages mainly occur within an organization or in a certain region. Based on this, the embodiment of the present invention can route the instant messaging client according to the organization identifier, or route according to the region where the instant messaging client is located.
[0114] For example, when applying access routing to work scenarios, the company name or organization name can be selected as the basis for the routing algorithm; when applying to daily life scenarios, the region (province name) can be selected as the basis for the routing algorithm. As for which routing algorithm to choose, the embodiment of the present invention can use the big data algorithm to find the feature with the greatest correlation with the session as the basis for the routing algorithm.
[0115] Step 204: If the conversation unit database does not belong to the first conversation center, the conversation message is sent to the second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to the second instant messaging client corresponding to the second conversation center.
[0116] If the determined conversation unit database does not belong to the first conversation center, the conversation message can be sent to the second conversation center to which the conversation unit database belongs. After acquiring the conversation message, the second conversation center can store the conversation message in the conversation unit and send the conversation message to the second instant messaging client connected to the second conversation center. The second instant messaging client can display the conversation message to the user.
[0117] In the embodiment of the present invention, the sending of the conversation message to the second conversation center corresponding to the conversation unit database includes:
[0118] The session message is sent to the second session center corresponding to the session unit database through a remote procedure call.
[0119] Specifically, after determining that the session unit database does not belong to the first session center, the session routing 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 routing in the second session center can obtain the session message.
[0120] Furthermore, the conversation message can be stored in the conversation unit database through the instant messaging service. That is, after the conversation router in the second conversation center obtains the conversation message, the conversation message can be stored in the conversation unit database in the second conversation center through the instant messaging service.
[0121] Step 205: If the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database, and the conversation message is sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client.
[0122] If the determined conversation unit database belongs to the first conversation center, the conversation message can be stored in the conversation unit database. At the same time, the conversation message can be sent to the second conversation center. The second conversation center sends the conversation data to the second instant messaging client, and the second instant messaging client can display the conversation message to the user.
[0123] The conversation message may also be stored in the conversation unit database through the instant messaging service. That is, after the conversation router in the first conversation center obtains the conversation message, the conversation message may be stored in the conversation unit database in the first conversation center through the instant messaging service.
[0124] In the embodiment of the present invention, the sending the session message to the second session center includes:
[0125] Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm;
[0126] The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation center through the second push service.
[0127] Specifically, when sending a conversation message, the first conversation center can use a routing algorithm to calculate the second conversation center to which the second instant messaging client belongs, and then use the first push service in the first conversation center to call the second push service in the second conversation center. In this way, the first push service can send the conversation message to the second push service in the second conversation center. Finally, the second conversation center sends the conversation message to the second instant messaging client, and the second instant messaging client can display the conversation message to the user.
[0128] In an embodiment of the present invention, the instant messaging data is divided by the session dimension, thereby greatly reducing cross-center sessions and allowing the sessions to occur in one center as much as possible. This not only greatly reduces the pressure of data storage and data synchronization in the instant messaging service, but also solves the problem that users in different centers cannot communicate, and enables users in each center to communicate across centers.
[0129] For ease of understanding, Figure 3 The interactive schematic diagram of one-to-one instant messaging is shown, wherein the access routing layer has determined that user 1 accesses session center 1 and user 2 accesses session center 2.
[0130] User 1 is connected to conversation center 1 through instant messaging client 1 , and user 2 is connected to conversation center 2 through instant messaging client 2 . The conversation message of 1 - 2 is stored in the conversation unit database of conversation center 1 .
[0131] When user 2 sends a message to user 1, instant messaging client 2 sends the session message to session center 2. After message receiving service 2 in session center 2 obtains the session message, it calculates the session message through session routing 2 and stores it in session unit database 1 of session center 1. At this time, session routing 2 in session center 2 needs to call RPC to send the session data to session routing 1 of session center 1. Session routing 1 in session center 1 stores the session message in session unit database 1 through instant messaging service 1. At the same time, instant messaging service 1 sends the session message to instant messaging client 1 through push service 1. Instant messaging client 1 displays the session message sent by user 2 to the user.
[0132] When user 1 sends a message to user 2, instant messaging client 1 sends the conversation message to conversation center 1. After the message receiving service 1 in conversation center 1 obtains the conversation message, it calculates the conversation message through conversation routing 1 and stores it in conversation unit database 1 of conversation center 1. At this time, conversation routing 1 stores the conversation message in conversation unit database 1 through instant messaging service 1 (user 2 has not received the message yet). At the same time, the routing algorithm is used to calculate which conversation center user 2 is connected to. After determining that user 2 is connected to conversation center 2, push service 1 in conversation center 1 can call push service 2 in conversation center 2. In this way, the conversation message is sent to conversation center 2 through push service 2. Finally, conversation center 2 sends the conversation message to instant messaging service 2, and instant messaging service 2 displays the conversation message sent by user 1 to user 2.
[0133] Furthermore, the global database 1 in the conversation center 1 and the global database 2 in the conversation center 2 maintain data synchronization.
[0134] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0135] Reference Figure 4 , shows a structural block diagram of an embodiment of a message transmission device of the present invention, which may specifically include the following modules:
[0136] The acquisition module 401 is used to acquire the conversation message sent by the first instant messaging client;
[0137] A determination module 402, configured to determine a session unit database for storing the session message;
[0138] A sending module 403 is used for sending the conversation message to a second conversation center corresponding to the conversation unit database if the conversation unit database does not belong to the first conversation center, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to a second instant messaging client corresponding to the second conversation center;
[0139] The storage module 404 is used to store the session message in the session unit database if the session unit database belongs to the first session center, 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 an embodiment of the present invention, it also includes:
[0141] The connection module is configured to establish a connection with the first instant messaging client in response to a connection request for the first instant messaging client before acquiring the conversation message sent by the first instant messaging client.
[0142] In the embodiment of the present invention, the session message includes a session identifier; and the determining module is specifically configured to:
[0143] The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
[0144] In the embodiment of the present invention, the sending module is specifically used to:
[0145] The session message is sent to the second session center corresponding to the session unit database through a remote procedure call.
[0146] In the embodiment of the present invention, the conversation message is stored in the conversation unit database via an instant messaging service.
[0147] In the embodiment of the present invention, the sending module is further used for:
[0148] Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm;
[0149] The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation center through the second push service.
[0150] In the embodiment of the present 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 for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0153] An embodiment of the present invention further provides an electronic device, including:
[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, the various processes of the above-mentioned message transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0155] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned message transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0156] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0157] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product 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 codes.
[0158] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0159] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A 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 device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0161] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0162] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0163] The message transmission method and the message transmission device provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained by using specific examples in this article. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A message transmission method, characterized in that: Applied to a first conversation center corresponding to the first instant messaging client; the method comprises: Obtaining a conversation message sent by the first instant messaging client; determining a session unit database for storing the session message; If the conversation unit database does not belong to the first conversation center, sending the conversation message to a second conversation center corresponding to the conversation unit database, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to a second instant messaging client corresponding to the second conversation center; If the conversation unit database belongs to the first conversation center, the conversation message is stored in the conversation unit database, and the conversation message is sent to the second conversation center, so that the second conversation center sends the conversation message to the second instant messaging client.
2. The message transmission method according to claim 1, characterized in that: Before acquiring the conversation message sent by the first instant messaging client, the method further includes: In response to a connection request for a 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; the determining a session unit database for storing the session message includes: The session identifier is retrieved using a preset routing algorithm to determine a session unit database for storing the session message.
4. The message transmission method according to claim 1, characterized in that: The sending the conversation message to the second conversation center corresponding to the conversation unit database includes: The session message is sent to the second session center corresponding to the session unit database through a remote procedure call.
5. The message transmission method according to claim 1, characterized in that: The conversation message is stored in the conversation unit database via an instant messaging service.
6. The message transmission method according to claim 1, characterized in that: The sending the conversation message to the second conversation center includes: Determining a second session center corresponding to the second instant messaging client based on a preset routing algorithm; The first push service in the first conversation center is used to call the second push service in the second conversation center, and the conversation message is sent to the second conversation center through the second push service.
7. The message transmission method according to claim 2, characterized in that: The 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.
8. A message transmission device, characterized in that: Applied to a first conversation center corresponding to the first instant messaging client; the device comprises: An acquisition module, used for acquiring a conversation message sent by the first instant messaging client; A determination module, used for determining a session unit database for storing the session message; a sending module, configured to send the conversation message to a second conversation center corresponding to the conversation unit database if the conversation unit database does not belong to the first conversation center, so that the second conversation center stores the conversation message in the conversation unit database and sends the conversation message to a second instant messaging client corresponding to the second conversation center; A storage module is used to store the session message in the session unit database if the session unit database belongs to the first session center, 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.
9. 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 when the computer program is executed by the processor, the steps of the message transmission method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message transmission method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
System and method for transferring a session between multiple clients
CN102077492A
Session information creation method, device and system
CN102571575A
Clustered session management
CN104854575A
Method and device for synchronizing session information, electronic device, and storage medium
CN109257448A
Systems and methods for achieving session stickiness for stateful cloud services with non-sticky load balancers
CN110799945A