[go: up one dir, main page]

CN115277647A - Method and device for processing real-time session message, storage medium and terminal - Google Patents

Method and device for processing real-time session message, storage medium and terminal Download PDF

Info

Publication number
CN115277647A
CN115277647A CN202210925623.4A CN202210925623A CN115277647A CN 115277647 A CN115277647 A CN 115277647A CN 202210925623 A CN202210925623 A CN 202210925623A CN 115277647 A CN115277647 A CN 115277647A
Authority
CN
China
Prior art keywords
message
session
target
real
message routing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210925623.4A
Other languages
Chinese (zh)
Other versions
CN115277647B (en
Inventor
党伟锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN202210925623.4A priority Critical patent/CN115277647B/en
Publication of CN115277647A publication Critical patent/CN115277647A/en
Application granted granted Critical
Publication of CN115277647B publication Critical patent/CN115277647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1069Session establishment or de-establishment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1083In-session procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method and a device for processing a real-time session message, a storage medium and a terminal, relates to the technical field of Internet, and mainly aims to solve the problems of session state redundancy, resource waste and low processing efficiency in real-time session message processing. The method comprises the following steps: when receiving the real-time conversation message, calling all message routing interfaces in a local area range; when the online session state matched with the real-time session message exists in each distributed cache in the local area range through the message routing interface, determining a target message routing interface and a target session connection, wherein the distributed caches correspond to one message routing interface; and calling the target session connection through the target message routing interface, and issuing the real-time session message after message processing through the target session connection.

Description

实时会话消息的处理方法及装置、存储介质、终端Method and device for processing real-time conversation messages, storage medium, and terminal

技术领域technical field

本发明涉及一种互联网技术领域,特别是涉及一种实时会话消息的处理方法及装置、存储介质、终端。The invention relates to the technical field of the Internet, in particular to a processing method and device, a storage medium, and a terminal for real-time conversational messages.

背景技术Background technique

随着互联网技术的快速发展,为了满足快速、系统消耗低的需求,各大社交应用程序的实时通信也在不断完善。其中,同城中的社交用户在进行实时会话时,消息的传输、产生等处理通常是通过同城中的多个互联网数据中心构建系统架构,如多活架构,以实现短距离、网络损耗小的消息处理。With the rapid development of Internet technology, in order to meet the needs of fast and low system consumption, the real-time communication of major social applications is also constantly improving. Among them, when social users in the same city conduct real-time conversations, the transmission and generation of messages are usually processed through multiple Internet data centers in the same city to build a system architecture, such as a multi-active architecture, to achieve short-distance and low network loss. deal with.

目前,现有对实时会话消息在处理过程中,通常从多个互联网数据中心的分布式数据库中选取一个主分布式缓存库,当实时会话消息从客户端传来时,首先在主分布式缓存对应的互联网数据中心中查找的在线会话状态,从而确定是否在此互联网数据中心进行分发实时会话消息。但是,由于作为一个主分布式缓存库,在用户大量进行登录、退出频繁,使得状态写入激增,在线会话状态存在冗余,严重浪费系统资源,并在网络抖动时,影响全部用户的会话消息的处理,大大降低了实时会话消息的处理效率。At present, in the process of processing real-time session messages, a main distributed cache library is usually selected from the distributed databases of multiple Internet data centers. The online session status searched in the corresponding Internet data center, so as to determine whether to distribute real-time session messages in this Internet data center. However, as a main distributed cache library, when a large number of users log in and log out frequently, the state writes surge, and the online session state is redundant, which seriously wastes system resources and affects all user session messages when the network is jittering. processing, which greatly reduces the processing efficiency of real-time conversation messages.

发明内容Contents of the invention

有鉴于此,本发明提供一种实时会话消息的处理方法及装置、存储介质、终端,主要目的在于解决目前在多个互联网数据中心构建的系统架构中,仅从主分布式缓存中查找在线会话状态带来的状态冗余、资源浪费以及处理效率低的问题。In view of this, the present invention provides a processing method, device, storage medium, and terminal for real-time session messages, the main purpose of which is to solve the problem of finding online sessions only from the main distributed cache in the current system architecture constructed by multiple Internet data centers. State redundancy, waste of resources, and low processing efficiency brought about by state.

依据本发明一个方面,提供了一种实时会话消息的处理方法,包括:According to one aspect of the present invention, a method for processing real-time conversation messages is provided, including:

当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;When a real-time session message is received, call all message routing interfaces in the local area, where all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;

当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;When through the message routing interface, it is found that there is an online session state matching the real-time session message in each distributed cache in the local area, then determine the target message routing interface and the target session connection, and the distributed cache and A message routing interface corresponds to;

通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。Invoking the target session connection through the target message routing interface, and delivering the processed real-time session message through the target session connection.

进一步的,所述调取局域范围内的全部消息路由接口之前,所述方法还包括:Further, before calling all message routing interfaces in the local area, the method further includes:

搜索局域范围的全部非本地消息路由接口,其中,各所述非本地消息路由接口匹配有相应的会话连接;Searching for all non-local message routing interfaces in the local area, wherein each of the non-local message routing interfaces is matched with a corresponding session connection;

将搜索的所述非本地消息路由接口与本地消息路由接口建立关联关系,确定至少一个关联消息路由接口。Establish an association relationship between the searched non-local message routing interface and a local message routing interface, and determine at least one associated message routing interface.

进一步的,所述确定目标消息路由接口以及目标会话连接之前,所述方法还包括:Further, before determining the target message routing interface and the target session connection, the method further includes:

获取所述实时会话消息中的接口参数,所述接口参数包括消息内容、目标用户信息、会话请求标识;Obtain interface parameters in the real-time session message, where the interface parameters include message content, target user information, and a session request identifier;

基于所述接口参数调用所述消息路由接口,从所述分布式缓存中查找与所述实时会话消息对应的会话状态;calling the message routing interface based on the interface parameters, and searching the distributed cache for a session state corresponding to the real-time session message;

若查找到所述会话状态且所述会话状态为在线状态,则确定查找到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态。If the session state is found and the session state is an online state, it is determined that there is an online session state matching the real-time session message in each distributed cache within the local area.

进一步的,所述确定目标消息路由接口以及目标会话连接包括:Further, the determining the target message routing interface and the target session connection includes:

确定所述在线会话状态所对应会话状态所存储的目标分布式缓存,并将所述目标分布式缓存所对应的消息路由接口确定为目标消息路由接口;Determine the target distributed cache stored in the session state corresponding to the online session state, and determine the message routing interface corresponding to the target distributed cache as the target message routing interface;

获取所述目标消息路由接口所配置的连接服务,并将所述连接服务创建的会话连接确定为目标会话连接。Obtain the connection service configured by the target message routing interface, and determine the session connection created by the connection service as the target session connection.

进一步的,所述通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发包括:Further, the calling the target session connection through the target message routing interface, and delivering the processed real-time session message through the target session connection includes:

通过所述实时会话消息中的消息内容、目标用户信息、会话请求标识配置所述目标消息路由接口的接口参数;Configure the interface parameters of the target message routing interface through the message content, target user information, and session request identifier in the real-time session message;

基于完成所述接口参数配置的目标消息路由接口调用目标会话连接,并获取基于所述消息内容完成消息处理的所述实时会话消息;Invoking the target session connection based on the target message routing interface that has completed the interface parameter configuration, and acquiring the real-time session message that completes message processing based on the message content;

通过所述目标会话连接将所述实时会话消息下发至与所述目标用户信息、所述会话请求标识匹配的目标用户。Sending the real-time session message to the target user matching the target user information and the session request identifier through the target session connection.

进一步的,所述方法还包括:Further, the method also includes:

检测调用所述全部消息路由接口的多个调用时间是否大于预设调用时间阈值;Detecting whether the multiple call times for calling all the message routing interfaces are greater than a preset call time threshold;

若存在所述调用时间大于预设调用时间阈值,则确定与所述调用时间对应的消息路由接口为调用失败;If the invocation time is greater than the preset invocation time threshold, it is determined that the message routing interface corresponding to the invocation time is invocation failure;

当再次接收到实时会话消息时,重新调取所述调用失败的消息路由接口,并通过调用失败的消息路由接口查询对应的分布式缓存中是否存在与所述实时会话消息匹配的在线会话状态,以确定所述调用失败的消息路由接口是否为目标消息路由接口。When the real-time session message is received again, re-call the message routing interface that failed to call, and query whether there is an online session state that matches the real-time session message in the corresponding distributed cache through the message routing interface that failed to call, to determine whether the message routing interface whose call fails is the target message routing interface.

进一步的,所述方法还包括:Further, the method also includes:

当检测到消息处理后的所述实时会话消息未通过所述目标会话连接下发到目标用户,则将未下发成功的所述实时会话消息转存至消息下发队列中,所述消息下发队列为按照轮询方式执行实时会话消息的下发;When it is detected that the real-time session message after message processing has not been delivered to the target user through the target session connection, the real-time session message that has not been successfully delivered is transferred to the message delivery queue, and the message delivery The sending queue is used to send real-time session messages in a polling manner;

当触发所述消息下发队列中所述实时会话消息所对应的轮询下发条件时,将所述实时会话消息下发至目标用户。When the polling delivery condition corresponding to the real-time session message in the message delivery queue is triggered, the real-time session message is delivered to the target user.

依据本发明另一个方面,提供了一种实时会话消息的处理装置,包括:According to another aspect of the present invention, a real-time conversation message processing device is provided, including:

接口调取模块,用于当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;An interface calling module, configured to call all message routing interfaces in the local area when receiving a real-time session message, where all message routing interfaces include a local message routing interface and at least one message routing interface associated with the local message routing interface Associate message routing interface;

确定模块,用于当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;A determining module, configured to determine the target message routing interface and the target session connection when it is found that there is an online session state matching the real-time session message in each distributed cache in the local area through the message routing interface, The above distributed cache corresponds to a message routing interface;

消息下发模块,用于通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。A message delivery module, configured to call the target session connection through the target message routing interface, and deliver the processed real-time session message through the target session connection.

依据本发明又一个方面,提供了一种存储介质,所述存储介质中存储有至少一可执行指令,所述可执行指令使处理器执行如上述实时会话消息的处理方法对应的操作。According to yet another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform operations corresponding to the above-mentioned real-time conversation message processing method.

根据本发明的再一方面,提供了一种终端,包括:According to another aspect of the present invention, a terminal is provided, including:

处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface complete mutual communication through the communication bus;

所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如上述任一项所述的实时会话消息的处理方法对应的操作。The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform an operation corresponding to the method for processing a real-time conversation message as described in any one of the above.

借由上述技术方案,本发明实施例提供的技术方案至少具有下列优点:With the above technical solutions, the technical solutions provided by the embodiments of the present invention have at least the following advantages:

本发明提供了一种实时会话消息的处理方法及装置、存储介质、终端,与现有技术相比,本发明实施例通过当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。实现了在多个互联网数据中心构建的系统架构中,从局域范围内各分布式缓存中查找在线会话状态,将会话请求中的消息内容下发到局域范围内的目标用户。由于不需要将各分布式缓存中的会话状态更新至主分布式缓存中,避免了在线会话状态的冗余和资源浪费的现象。由于不需要跨互联网数据中心查找在线会话状态,避免了网络抖动等因素影响,提高了实时会话消息的处理效率。The present invention provides a processing method and device, a storage medium, and a terminal for a real-time session message. Compared with the prior art, the embodiment of the present invention calls all message routes within the local area when a real-time session message is received. interface, all the message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface; If there is an online session state matching the real-time session message, then determine a target message routing interface and a target session connection, the distributed cache corresponds to a message routing interface; call the target session connection through the target message routing interface, and send the processed real-time session message through the target session connection. In the system architecture built in multiple Internet data centers, the online session status is searched from various distributed caches in the local area, and the message content in the session request is delivered to the target user in the local area. Since there is no need to update the session states in each distributed cache to the main distributed cache, the redundancy of online session states and the waste of resources are avoided. Since there is no need to search the online session state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time session messages is improved.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:

图1示出了本发明实施例提供的一种实时会话消息的处理方法的流程图;FIG. 1 shows a flowchart of a method for processing real-time conversation messages provided by an embodiment of the present invention;

图2示出了本发明实施例提供的另一种实时会话消息的处理方法的流程图;FIG. 2 shows a flowchart of another method for processing real-time conversation messages provided by an embodiment of the present invention;

图3示出了本发明实施例提供的又一种实时会话消息的处理方法的流程图;FIG. 3 shows a flow chart of another method for processing real-time conversation messages provided by an embodiment of the present invention;

图4示出了本发明实施例提供的再一种实时会话消息的处理方法的流程图;FIG. 4 shows a flowchart of another method for processing real-time conversation messages provided by an embodiment of the present invention;

图5示出了本发明实施例提供的还一种实时会话消息的处理方法的流程图;FIG. 5 shows a flow chart of another method for processing real-time conversation messages provided by an embodiment of the present invention;

图6示出了本发明实施例提供的一种实时会话消息的处理装置的结构示意图;FIG. 6 shows a schematic structural diagram of an apparatus for processing real-time conversation messages provided by an embodiment of the present invention;

图7示出了本发明实施例提供的一种终端的结构示意图。FIG. 7 shows a schematic structural diagram of a terminal provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

本发明实施例提供了一种实时会话消息的处理方法,如图1所示,该方法包括:The embodiment of the present invention provides a method for processing real-time conversation messages, as shown in Figure 1, the method includes:

101、当接收到实时会话消息时,调取局域范围内的全部消息路由接口;101. When a real-time session message is received, call all message routing interfaces within the local area;

本发明实施例中,当前执行端接收到用户的实时会话消息时,调取当前执行端所在的局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;局域范围可以用于表征在地理位置上处于一个区域的范围,如同城范围;也可以用于表征相互关联的多个互联网数据中心组成的网络范围,如多活架构的网络系统范围,本发明实施例中不做具体限定。消息路由为确定消息下一跳地址的软路由,具有较高的稳定性。In the embodiment of the present invention, when the current execution end receives the user's real-time session message, it calls all the message routing interfaces within the local area where the current execution end is located, and the all message routing interfaces include the local message routing interface and the At least one associated message routing interface associated with the local message routing interface; the local area can be used to represent the geographically located area, such as the urban area; it can also be used to represent a network composed of multiple interconnected Internet data centers The scope, such as the scope of the network system of the multi-active architecture, is not specifically limited in this embodiment of the present invention. The message routing is a soft routing for determining the next hop address of the message, which has high stability.

需要说明的是,由于局域范围内存在多个执行端,在多个执行端间进行数据通信时,通过同时调取局域范围内的全部消息路由接口的方法可以提高消息路由接口的工作效率。It should be noted that since there are multiple execution ends in the local area, when performing data communication between multiple execution ends, the work efficiency of the message routing interface can be improved by calling all the message routing interfaces in the local area at the same time .

102、当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接;102. When it is found through the message routing interface that there is an online session state matching the real-time session message in each distributed cache in the local area, determine the target message routing interface and the target session connection;

本发明实施例中,当前执行端通过对局域范围内各分布式缓存进行在线会话查询,当查询到与用户发出的实时会话消息相匹配的在线会话状态,则将查询到匹配在线会话状态的消息路由接口确定为目标消息路由接口。由于消息路由接口匹配有相应的会话连接,通过确定的目标消息路由接口得到目标会话连接。会话连接为用户参与会话的服务器进程建立的物理链路,一旦用户建立连接,就有一个服务器进程被创建,并处理这个用户的会话请求,当用户断开连接时,这个用户参与会话的服务器进程就终止。In the embodiment of the present invention, the current execution end performs online session query on each distributed cache in the local area. The message routing interface is identified as the target message routing interface. Since the message routing interface is matched with a corresponding session connection, the target session connection is obtained through the determined target message routing interface. The session connection is a physical link established by the server process for the user to participate in the session. Once the user establishes a connection, a server process is created and processes the user's session request. When the user disconnects, the server process for the user to participate in the session just terminate.

需要说明的是,在局域范围内各消息路由接口都对应有一个分布式缓存,用于存储用户的会话状态信息,当用户处于登录状态时,将用户的在线会话状态写入对应的分布式缓存中,当用户处于退出状态时,将用户的在线会话状态从分布式缓存中剔除。It should be noted that each message routing interface in the local area corresponds to a distributed cache, which is used to store the user's session state information. When the user is in the login state, the user's online session state is written into the corresponding distributed cache. In the cache, when the user is in the logout state, the user's online session state is removed from the distributed cache.

103、通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。103. Call the target session connection through the target message routing interface, and deliver the processed real-time session message through the target session connection.

本发明实施例中,当前执行端通过查找到的目标消息路由接口调用目标用户的目标会话连接,将消息处理后的实时会话消息通过目标会话连接下发给目标用户。消息处理用于表征对用户发出的消息进行存储和验证的过程,验证时可以验证消息发送方与目标用户之间是否为好友关系,也可以验证发送方是否为群成员,或者发送方在群内是否被禁言,本发明实施例中不做具体限定。只有经消息处理过程中验证通过的消息才能通过目标会话连接进行下发。In the embodiment of the present invention, the current execution end invokes the target session connection of the target user through the found target message routing interface, and delivers the processed real-time session message to the target user through the target session connection. Message processing is used to represent the process of storing and verifying messages sent by users. During verification, it can be verified whether the message sender and the target user are friends, whether the sender is a group member, or whether the sender is in the group. Forbidden, no specific limitation is made in the embodiment of the present invention. Only messages that pass the verification during message processing can be sent through the target session connection.

在另一个本发明实施例中,为了进一步限定及说明,如图2所示,步骤所述调取局域范围内的全部消息路由接口之前,所述方法还包括:In another embodiment of the present invention, for further limitation and description, as shown in FIG. 2, before calling all message routing interfaces in the local area in the step, the method further includes:

201、搜索局域范围的全部非本地消息路由接口;201. Search for all non-local message routing interfaces in the local area;

本发明实施例中,为了在非本地的数据中心或者服务器上查找到目标用户的会话状态,需要先建立一个局域范围内的网络系统。当前执行端需要在局域范围内搜索全部非本地消息路由接口,各非本地消息路由接口均匹配有相应的会话连接;此处的会话连接为非本地用户参与会话的服务器进程建立的物理链路,一旦用户建立连接,就有一个服务器进程被创建,并处理这个用户的会话请求,当用户断开连接时,这个用户参与会话的服务器进程就终止,即无法通过终止的会话服务进程上传或者下发会话消息内容。In the embodiment of the present invention, in order to find the session state of the target user on a non-local data center or server, it is necessary to first establish a network system within a local area. The current execution end needs to search for all non-local message routing interfaces in the local area, and each non-local message routing interface is matched with a corresponding session connection; the session connection here is the physical link established by the server process where the non-local user participates in the session , once the user establishes a connection, a server process is created and processes the user's session request. When the user disconnects, the server process in which the user participates in the session is terminated, that is, the terminated session service process cannot be uploaded or downloaded. Send the content of the conversation message.

202、将搜索的所述非本地消息路由接口与本地消息路由接口建立关联关系,确定至少一个关联消息路由接口。202. Establish an association relationship between the searched non-local message routing interface and a local message routing interface, and determine at least one associated message routing interface.

本发明实施例中,当前执行端将搜索到的非本地消息路由接口与本地消息路由接口建立关联关系,与本地消息路由接口建立关联关系的非本地消息路由接口被称为关联消息路由接口。局域范围内的关联消息路由接口的数量大于等于1个,即实现了将本地消息路由与非本地消息路由间的信息通信。In the embodiment of the present invention, the current execution end associates the searched non-local message routing interface with the local message routing interface, and the non-local message routing interface associated with the local message routing interface is called an associated message routing interface. The number of associated message routing interfaces in the local area is greater than or equal to one, that is, information communication between local message routing and non-local message routing is realized.

在另一个本发明实施例中,为了进一步限定及说明,如图3所示,步骤所述确定目标消息路由接口以及目标会话连接之前,所述方法还包括:In another embodiment of the present invention, for further limitation and description, as shown in FIG. 3, before the step of determining the target message routing interface and the target session connection, the method further includes:

301、获取所述实时会话消息中的接口参数;301. Acquire interface parameters in the real-time session message;

本发明实施例中,为了在局域范围内匹配到目标用户,需要先对本地用户发出的实时会话消息进行处理。当前执行端需要获取本地用户发出的实时会话消息中的接口参数,所述接口参数包括消息内容、目标用户信息、会话请求标识。消息内容为本地用户需要发送给目标用户的具体的对话内容。目标用户信息包括目标用户id、目标用户在线信息等,本发明实施例不做具体限定。目标用户信息在消息处理的过程中还可以以了列表的形式进行存储,本发明实施例不做具体限定。会话请求标识用于标记本地用户(即会话发送方)所在的互联网数据中心或服务器的标识。In the embodiment of the present invention, in order to match a target user within a local area, it is necessary to process the real-time session message sent by the local user first. The current execution end needs to obtain the interface parameters in the real-time session message sent by the local user, and the interface parameters include message content, target user information, and session request identifier. The content of the message is the specific dialogue content that the local user needs to send to the target user. The target user information includes target user id, target user online information, etc., which are not specifically limited in this embodiment of the present invention. The target user information may also be stored in the form of a list during message processing, which is not specifically limited in this embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (that is, the session sender) is located.

302、基于所述接口参数调用所述消息路由接口,从所述分布式缓存中查找与所述实时会话消息对应的会话状态;302. Call the message routing interface based on the interface parameter, and search the distributed cache for a session state corresponding to the real-time session message;

本发明实施例中,当前执行端获取到接口参数后,基于接口参数调用局域范围内全部的消息路由接口,从消息路由接口所对应的分布式缓存中查找实时会话消息请求中实时会话消息对应的用户会话状态。In the embodiment of the present invention, after the current execution end obtains the interface parameters, it invokes all the message routing interfaces in the local area based on the interface parameters, and searches the real-time session message corresponding to the real-time session message request from the distributed cache corresponding to the message routing interface. user session state.

303、若查找到所述会话状态且所述会话状态为在线状态,则确定查找到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态。303. If the session state is found and the session state is an online state, determine that an online session state matching the real-time session message exists in each distributed cache within the local area.

本发明实施例中,为了在局域范围内匹配到目标用户,需要先在局域范围内匹配在线会话状态。当前执行端如果查找到用户会话状态,并且对应的用户会话状态为在线状态,就能确定在局域范围内的各分布式缓存中查找到了与实时会话消息相匹配的在线会话状态。查找匹配的在线会话状态是确定目标消息路由接口以及目标会话连接的前提,当前执行端将查找到匹配的在线会话状态所在的分布式缓存所对应的消息路由接口定为目标消息路由接口,并从查找到匹配的在线会话状态所在的分布式缓存中查找目标用户所对应的会话连接定为目标会话连接。In the embodiment of the present invention, in order to match the target user in the local area, it is necessary to first match the online session status in the local area. If the current execution end finds the user session status and the corresponding user session status is online, it can determine that the online session status matching the real-time session message is found in each distributed cache within the local area. Finding the matching online session state is the premise of determining the target message routing interface and the target session connection. The current execution end will find the message routing interface corresponding to the distributed cache where the matching online session state is located as the target message routing interface, and from Find the session connection corresponding to the target user in the distributed cache where the matching online session state is located, and set it as the target session connection.

在另一个本发明实施例中,为了进一步限定及说明,步骤所述确定目标消息路由接口以及目标会话连接包括:In another embodiment of the present invention, for further definition and description, the step of determining the target message routing interface and the target session connection includes:

确定所述在线会话状态所对应会话状态所存储的目标分布式缓存,并将所述目标分布式缓存所对应的消息路由接口确定为目标消息路由接口;Determine the target distributed cache stored in the session state corresponding to the online session state, and determine the message routing interface corresponding to the target distributed cache as the target message routing interface;

获取所述目标消息路由接口所配置的连接服务,并将所述连接服务创建的会话连接确定为目标会话连接。Obtain the connection service configured by the target message routing interface, and determine the session connection created by the connection service as the target session connection.

本发明实施例中,为了对会话状态进行更新和存储,设置了分布式缓存;为了创建用户间的会话连接,在消息路由接口配置了连接服务。连接服务为建立网络连接的一种服务形式。当前执行端在确定在线会话状态后,将对应存储该在线会话状态的分布式缓存定为目标分布式缓存,并将目标分布式缓存所对应的消息路由接口确定为目标消息路由接口。在得到目标消息路由接口之后,当前执行端需要获取目标消息路由接口所配置的连接服务,通过连接服务查找到目标用户所对应的目标会话连接。In the embodiment of the present invention, in order to update and store the session state, a distributed cache is set; in order to create a session connection between users, a connection service is configured in the message routing interface. A connection service is a form of service that establishes a network connection. After determining the online session state, the current execution end determines the distributed cache corresponding to the online session state as the target distributed cache, and determines the message routing interface corresponding to the target distributed cache as the target message routing interface. After obtaining the target message routing interface, the current execution end needs to obtain the connection service configured by the target message routing interface, and find the target session connection corresponding to the target user through the connection service.

在另一个本发明实施例中,为了进一步限定及说明,如图4所示,步骤所述通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发包括:In another embodiment of the present invention, for further limitation and description, as shown in FIG. 4 , the step is to call the target session connection through the target message routing interface, and pass the processed real-time session message through The delivery of the target session connection includes:

401、通过所述实时会话消息中的消息内容、目标用户信息、会话请求标识配置所述目标消息路由接口的接口参数;401. Configure the interface parameters of the target message routing interface according to the message content, target user information, and session request identifier in the real-time session message;

本发明实施例中,为了将处理后的消息准确下发到目标用户端,需要对目标消息路由接口进行参数配置,以实现目标消息路由与当前执行端的本地消息路由之间的消息通信。当前执行端通过实时会话消息中的消息内容、目标用户信息、会话请求标识配置目标消息路由接口的接口参数。消息内容为本地用户需要发送给目标用户的具体的对话内容。目标用户信息包括目标用户id、目标用户在线信息等,本发明实施例不做具体限定。目标用户信息在消息处理的过程中还可以以了列表的形式进行存储,本发明实施例不做具体限定。会话请求标识用于标记本地用户(即会话发送方)所在的互联网数据中心或服务器的标识。In the embodiment of the present invention, in order to accurately send the processed message to the target client, parameter configuration needs to be performed on the target message routing interface to realize message communication between the target message routing and the local message routing of the current execution end. The current execution end configures the interface parameters of the target message routing interface through the message content in the real-time session message, the target user information, and the session request identifier. The content of the message is the specific dialogue content that the local user needs to send to the target user. The target user information includes target user id, target user online information, etc., which are not specifically limited in this embodiment of the present invention. The target user information may also be stored in the form of a list during message processing, which is not specifically limited in this embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (that is, the session sender) is located.

402、基于完成所述接口参数配置的目标消息路由接口调用目标会话连接,并获取基于所述消息内容完成消息处理的所述实时会话消息;402. Invoke the target session connection based on the target message routing interface that has completed the interface parameter configuration, and acquire the real-time session message that completes message processing based on the message content;

403、通过所述目标会话连接将所述实时会话消息下发至与所述目标用户信息、所述会话请求标识匹配的目标用户。403. Deliver the real-time session message to a target user matching the target user information and the session request identifier through the target session connection.

本发明实施例中,当前执行端在完成接口参数配置的目标消息路由接口处调用与目标用户所对应的目标会话连接,在调用到目标会话连接之后,当前执行端获取经消息处理过的实时会话消息。消息处理用于表征对用户发出的消息进行存储和验证的过程,验证时可以验证消息发送方与目标用户之间是否为好友关系,也可以验证发送方是否为群成员,或者发送方在群内是否被禁言,本发明实施例中不做具体限定。只有经消息处理过程中验证通过的消息才能通过目标会话连接进行下发。In the embodiment of the present invention, the current execution end invokes the target session connection corresponding to the target user at the target message routing interface where the interface parameter configuration is completed. After calling the target session connection, the current execution end obtains the real-time session processed by the message information. Message processing is used to represent the process of storing and verifying messages sent by users. During verification, it can be verified whether the message sender and the target user are friends, whether the sender is a group member, or whether the sender is in the group. Forbidden, no specific limitation is made in the embodiment of the present invention. Only messages that pass the verification during message processing can be sent through the target session connection.

当前执行端在获取到消息处理后的实时会话消息之后,通过目标会话连接将实时会话消息下发给与目标用户信息和会话请求标识均匹配的相应的目标用户。目标用户信息包括但不限于目标用户id、目标用户在线信息等,本发明实施例不做具体限定。会话请求标识用于标记本地用户(即会话发送方)所在的互联网数据中心或服务器的标识。After obtaining the processed real-time session message, the current execution end sends the real-time session message to the corresponding target user matching both the target user information and the session request identifier through the target session connection. The target user information includes, but is not limited to, the target user id, the online information of the target user, etc., which are not specifically limited in this embodiment of the present invention. The session request identifier is used to mark the identifier of the Internet data center or server where the local user (that is, the session sender) is located.

在另一个本发明实施例中,为了进一步限定及说明,如图5所示,所述方法还包括:In another embodiment of the present invention, for further definition and description, as shown in FIG. 5, the method further includes:

501、检测调用所述全部消息路由接口的多个调用时间是否大于预设调用时间阈值;501. Detect whether multiple call times for calling all the message routing interfaces are greater than a preset call time threshold;

502、若存在所述调用时间大于预设调用时间阈值,则确定与所述调用时间对应的消息路由接口为调用失败;502. If the invocation time is greater than the preset invocation time threshold, determine that the message routing interface corresponding to the invocation time is invocation failure;

本发明实施例中,为了处理调用超时的情况,预设了调用时间阈值。当前执行端对全部消息路由接口的多个调用时间进行检测,将检测到的多个调用时间与预设的调用时间阈值进行比较。当多个调用时间中存在调用时间大于预设的调用时间阈值的情况,则将调用时间大于预设调用时间所对应的消息路由接口认定为调用失败的消息路由接口。预设调用时间为人为设定的一个时间值,可以是2秒、3秒、4秒等,本发明实施例不做具体限定。In the embodiment of the present invention, in order to deal with the call timeout situation, a call time threshold is preset. The current execution end detects multiple call times of all message routing interfaces, and compares the detected multiple call times with a preset call time threshold. When the invocation time is greater than the preset invocation time threshold among the multiple invocation times, the message routing interface corresponding to the invocation time greater than the preset invocation time is identified as the message routing interface that fails to be invoked. The preset call time is a time value set manually, which may be 2 seconds, 3 seconds, 4 seconds, etc., which is not specifically limited in the embodiment of the present invention.

503、当再次接收到实时会话消息时,重新调取所述调用失败的消息路由接口,并通过调用失败的消息路由接口查询对应的分布式缓存中是否存在与所述实时会话消息匹配的在线会话状态,以确定所述调用失败的消息路由接口是否为目标消息路由接口。503. When the real-time session message is received again, re-call the message routing interface that failed to call, and query whether there is an online session that matches the real-time session message in the corresponding distributed cache through the message routing interface that failed to call Status, to determine whether the message routing interface where the call fails is the target message routing interface.

本发明实施例中,为了提高调用消息路由接口的效率,节约实时会话消息的处理时间,在当前执行端再次接收到实时会话消息时,不再重复调取调用成功的消息路由接口,仅针对调用失败的消息路由进行重复调取,调取成功后通过调用失败的消息路由接口查询对应的分布式缓存中是否存在与实时会话消息相匹配的在线会话状态,如存在与实时会话消息相匹配的在线会话状态,则将其对应的调用失败的消息路由接口确定为目标消息路由接口。当前执行端通过目标消息路由接口调用目标会话连接,并将消息处理后的实时会话消息通过目标会话连接下发到对应的目标用户。In the embodiment of the present invention, in order to improve the efficiency of calling the message routing interface and save the processing time of the real-time session message, when the current execution end receives the real-time session message again, it will not repeatedly call the successfully called message routing interface, and only for calling Failed message routes are called repeatedly. After the call is successful, check whether there is an online session status that matches the real-time session message in the corresponding distributed cache by calling the failed message route interface. If there is an online session status that matches the real-time session message session state, the corresponding message routing interface whose call fails is determined as the target message routing interface. The current execution end invokes the target session connection through the target message routing interface, and delivers the processed real-time session message to the corresponding target user through the target session connection.

在另一个本发明实施例中,为了进一步限定及说明,所述方法还包括:In another embodiment of the present invention, for further definition and description, the method further includes:

当检测到消息处理后的所述实时会话消息未通过所述目标会话连接下发到目标用户,则将未下发成功的所述实时会话消息转存至消息下发队列中;When it is detected that the real-time session message after message processing has not been delivered to the target user through the target session connection, the real-time session message that has not been successfully delivered is transferred to the message delivery queue;

当触发所述消息下发队列中所述实时会话消息所对应的轮询下发条件时,将所述实时会话消息下发至目标用户。When the polling delivery condition corresponding to the real-time session message in the message delivery queue is triggered, the real-time session message is delivered to the target user.

本发明实施例中,为了处理下发消息失败的问题,设置了消息下发队列,对消息下发失败的实时会话消息进行处理,保证在断网或断电等因素的影响下,也能实现实时会话消息的下发。当前执行端需要对实时会话消息消息的下发情况进行检测,当检测到消息处理后的实时会话消息未通过目标会话连接下发到目标用户时,当前执行端需要将未下发成功的实时会话消息转存到预先设置的消息队列中去。所述消息下发队列为按照轮询方式执行实时会话消息的下发,轮询方式为按一定的时间间隔,重复的执行某一操作的方式。本发明实施例中,当前执行端首先设置一个时间间隔作为轮询下发的条件,如5秒、7秒等,本发明实施例不做具体限定。当触发消息队列中实时会话消息所对应的轮询下发条件时,将实时会话消息下发到目标用户。In the embodiment of the present invention, in order to deal with the problem of message delivery failure, a message delivery queue is set up to process the real-time session messages of message delivery failure, so as to ensure that it can also be realized under the influence of factors such as network disconnection or power failure. Delivery of real-time session messages. The current execution end needs to detect the delivery of real-time session messages. When it detects that the processed real-time session messages have not been delivered to the target user through the target session connection, the current execution end needs to send the real-time session messages that have not been delivered successfully The message is dumped to the preset message queue. The message sending queue is for sending real-time session messages in a polling manner, and the polling method is a manner of repeatedly executing a certain operation at a certain time interval. In the embodiment of the present invention, the current execution end first sets a time interval as the condition for polling delivery, such as 5 seconds, 7 seconds, etc., which is not specifically limited in the embodiment of the present invention. When the polling delivery condition corresponding to the real-time session message in the message queue is triggered, the real-time session message is delivered to the target user.

本发明实施例提供了一种实时会话消息的处理方法,与现有技术相比,本发明实施例通过当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。实现了在多个互联网数据中心构建的系统架构中,从局域范围内各分布式缓存中查找在线会话状态,将会话请求中的消息内容下发到局域范围内的目标用户。由于不需要将各分布式缓存中的会话状态更新至主分布式缓存中,避免了在线会话状态的冗余和资源浪费的现象。由于不需要跨互联网数据中心查找在线会话状态,避免了网络抖动等因素影响,提高了实时会话消息的处理效率。The embodiment of the present invention provides a processing method for a real-time session message. Compared with the prior art, the embodiment of the present invention invokes all message routing interfaces within the local area when a real-time session message is received, and all of the The message routing interface includes a local message routing interface and at least one associated message routing interface associated with the local message routing interface; If the online session state of the session message matches, the target message routing interface and the target session connection are determined, and the distributed cache corresponds to a message routing interface; the target session connection is called through the target message routing interface, and the message is processed The real-time session message is delivered through the target session connection. In the system architecture built in multiple Internet data centers, the online session status is searched from various distributed caches in the local area, and the message content in the session request is delivered to the target user in the local area. Since there is no need to update the session states in each distributed cache to the main distributed cache, the redundancy of online session states and the waste of resources are avoided. Since there is no need to search the online session state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time session messages is improved.

进一步的,作为对上述图1所示方法的实现,本发明实施例提供了一种实时会话消息的处理装置,如图6所示,该装置包括:Further, as an implementation of the method shown in FIG. 1 above, an embodiment of the present invention provides a device for processing real-time conversation messages. As shown in FIG. 6 , the device includes:

接口调取模块61,用于当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;The interface calling module 61 is configured to call all the message routing interfaces in the local area when receiving the real-time session message, and the all message routing interfaces include the local message routing interface and at least the message routing interface associated with the local message routing interface. an associated message routing interface;

确定模块62,用于当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;The determination module 62 is configured to determine the target message routing interface and the target session connection when it is found that there is an online session state matching the real-time session message in each distributed cache in the local area through the message routing interface, The distributed cache corresponds to a message routing interface;

消息下发模块63,用于通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。The message delivery module 63 is configured to invoke the target session connection through the target message routing interface, and deliver the processed real-time session message through the target session connection.

进一步的,所述装置还包括:Further, the device also includes:

接口搜索模块,用于搜索局域范围的全部非本地消息路由接口,其中,各所述非本地消息路由接口匹配有相应的会话连接;An interface search module, configured to search for all non-local message routing interfaces in the local area, wherein each of the non-local message routing interfaces is matched with a corresponding session connection;

关联模块,用于将搜索的所述非本地消息路由接口与本地消息路由接口建立关联关系,确定至少一个关联消息路由接口。An associating module, configured to establish an association relationship between the searched non-local message routing interface and a local message routing interface, and determine at least one associated message routing interface.

进一步的,所述装置还包括:Further, the device also includes:

参数获取模块,用于获取所述实时会话消息中的接口参数,所述接口参数包括消息内容、目标用户信息、会话请求标识;A parameter acquisition module, configured to acquire interface parameters in the real-time session message, where the interface parameters include message content, target user information, and session request identifier;

状态查找模块,用于基于所述接口参数调用所述消息路由接口,从所述分布式缓存中查找与所述实时会话消息对应的会话状态;A state lookup module, configured to call the message routing interface based on the interface parameters, and look up the session state corresponding to the real-time session message from the distributed cache;

匹配确定模块,用于若查找到所述会话状态且所述会话状态为在线状态,则确定查找到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态。The matching determining module is configured to determine that if the session state is found and the session state is an online state, it is found that there is an online session state matching the real-time session message in each distributed cache within the local area.

进一步的,所述确定模块62包括:Further, the determining module 62 includes:

目标消息路由接口确定单元,用于确定所述在线会话状态所对应会话状态所存储的目标分布式缓存,并将所述目标分布式缓存所对应的消息路由接口确定为目标消息路由接口;A target message routing interface determining unit, configured to determine the target distributed cache stored in the session state corresponding to the online session state, and determine the message routing interface corresponding to the target distributed cache as the target message routing interface;

目标会话连接确定单元,用于获取所述目标消息路由接口所配置的连接服务,并将所述连接服务创建的会话连接确定为目标会话连接。The target session connection determining unit is configured to acquire the connection service configured by the target message routing interface, and determine the session connection created by the connection service as the target session connection.

进一步的,所述消息下发模块63包括:Further, the message sending module 63 includes:

接口参数配置单元,用于通过所述实时会话消息中的消息内容、目标用户信息、会话请求标识配置所述目标消息路由接口的接口参数;An interface parameter configuration unit, configured to configure the interface parameters of the target message routing interface through the message content, target user information, and session request identifier in the real-time session message;

消息获取单元,用于基于完成所述接口参数配置的目标消息路由接口调用目标会话连接,并获取基于所述消息内容完成消息处理的所述实时会话消息;A message obtaining unit, configured to call a target session connection based on the target message routing interface that has completed the configuration of the interface parameters, and obtain the real-time session message that completes message processing based on the message content;

下发单元,用于通过所述目标会话连接将所述实时会话消息下发至与所述目标用户信息、所述会话请求标识匹配的目标用户。A sending unit, configured to send the real-time session message to a target user matching the target user information and the session request identifier through the target session connection.

进一步的,所述装置还包括:Further, the device also includes:

调用时间检测模块,用于检测调用所述全部消息路由接口的多个调用时间是否大于预设调用时间阈值;A calling time detection module, configured to detect whether multiple calling times for calling all the message routing interfaces are greater than a preset calling time threshold;

调用失败确定模块,用于若存在所述调用时间大于预设调用时间阈值,则确定与所述调用时间对应的消息路由接口为调用失败;An invocation failure determination module, configured to determine that the message routing interface corresponding to the invocation time is an invocation failure if the invocation time is greater than a preset invocation time threshold;

目标消息路由接口再确定模块,用于当再次接收到实时会话消息时,重新调取所述调用失败的消息路由接口,并通过调用失败的消息路由接口查询对应的分布式缓存中是否存在与所述实时会话消息匹配的在线会话状态,以确定所述调用失败的消息路由接口是否为目标消息路由接口。The target message routing interface re-determining module is used to re-call the failed message routing interface when the real-time session message is received again, and query the corresponding distributed cache by calling the failed message routing interface. The online session status matched with the real-time session message to determine whether the message routing interface whose call failed is the target message routing interface.

进一步的,所述装置还包括:Further, the device also includes:

下发异常预处理模块,用于当检测到消息处理后的所述实时会话消息未通过所述目标会话连接下发到目标用户,则将未下发成功的所述实时会话消息转存至消息下发队列中,所述下发消息队列为按照轮询方式执行实时会话消息的下发;Sending an abnormal preprocessing module, for when it is detected that the real-time session message after message processing has not been sent to the target user through the target session connection, then the real-time session message that has not been delivered successfully is transferred to the message In the sending queue, the sending message queue is to execute the sending of real-time session messages in a polling manner;

消息再下发模块,用于当触发所述下发消息队列中所述实时会话消息所对应的轮询下发条件时,将所述实时会话消息下发至目标用户。The message re-delivery module is configured to deliver the real-time session message to the target user when the polling delivery condition corresponding to the real-time session message in the message delivery queue is triggered.

本发明实施例提供了一种实时会话消息的处理装置,与现有技术相比,本发明实施例通过当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。实现了在多个互联网数据中心构建的系统架构中,从局域范围内各分布式缓存中查找在线会话状态,将会话请求中的消息内容下发到局域范围内的目标用户。由于不需要将各分布式缓存中的会话状态更新至主分布式缓存中,避免了在线会话状态的冗余和资源浪费的现象。由于不需要跨互联网数据中心查找在线会话状态,避免了网络抖动等因素影响,提高了实时会话消息的处理效率。The embodiment of the present invention provides a real-time session message processing device. Compared with the prior art, the embodiment of the present invention invokes all message routing interfaces in the local area when receiving a real-time session message, and all The message routing interface includes a local message routing interface and at least one associated message routing interface associated with the local message routing interface; If the online session state of the session message matches, the target message routing interface and the target session connection are determined, and the distributed cache corresponds to a message routing interface; the target session connection is called through the target message routing interface, and the message is processed The real-time session message is delivered through the target session connection. In the system architecture built in multiple Internet data centers, the online session status is searched from various distributed caches in the local area, and the message content in the session request is delivered to the target user in the local area. Since there is no need to update the session states in each distributed cache to the main distributed cache, the redundancy of online session states and the waste of resources are avoided. Since there is no need to search the online session state across Internet data centers, the influence of factors such as network jitter is avoided, and the processing efficiency of real-time session messages is improved.

根据本发明一个实施例提供了一种存储介质,所述存储介质存储有至少一可执行指令,该计算机可执行指令可执行上述任意方法实施例中的实时会话的处理方法。According to one embodiment of the present invention, a storage medium is provided, the storage medium stores at least one executable instruction, and the computer-executable instruction can execute the real-time session processing method in any of the above method embodiments.

图7示出了根据本发明一个实施例提供的一种终端的结构示意图,本发明具体实施例并不对计算机设备的具体实现做限定。Fig. 7 shows a schematic structural diagram of a terminal provided according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of computer equipment.

如图7所示,该计算机设备可以包括:处理器(processor)702、通信接口(Communications Interface)704、存储器(memory)706、以及通信总线708。As shown in FIG. 7 , the computer device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .

其中:处理器702、通信接口704、以及存储器706通过通信总线708完成相互间的通信。Wherein: the processor 702 , the communication interface 704 , and the memory 706 communicate with each other through the communication bus 708 .

通信接口704,用于与其它设备比如客户端或其它服务器等的网元通信。The communication interface 704 is configured to communicate with network elements of other devices such as clients or other servers.

处理器702,用于执行程序710,具体可以执行上述公共业务数据的处理方法实施例中的相关步骤。The processor 702 is configured to execute the program 710, specifically, may execute relevant steps in the above-mentioned embodiment of the method for processing public service data.

具体地,程序710可以包括程序代码,该程序代码包括计算机操作指令。Specifically, the program 710 may include program codes including computer operation instructions.

处理器702可能是中央处理器CPU,或者是特定集成电路ASIC(ApplicationSpecific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。计算机设备包括的一个或多个处理器,可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多个ASIC。The processor 702 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be of the same type, such as one or more CPUs, or may be different types of processors, such as one or more CPUs and one or more ASICs.

存储器706,用于存放程序710。存储器706可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 706 is used to store the program 710 . The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

程序710具体可以用于使得处理器702执行以下操作:The program 710 can specifically be used to make the processor 702 perform the following operations:

当接收到实时会话消息时,调取局域范围内的全部消息路由接口,所述全部消息路由接口包括本地消息路由接口以及与所述本地消息路由接口关联的至少一个关联消息路由接口;When a real-time session message is received, call all message routing interfaces in the local area, where all message routing interfaces include a local message routing interface and at least one associated message routing interface associated with the local message routing interface;

当通过所述消息路由接口查询到所述局域范围内各分布式缓存中存在与所述实时会话消息匹配的在线会话状态,则确定目标消息路由接口以及目标会话连接,所述分布式缓存与一个消息路由接口对应;When through the message routing interface, it is found that there is an online session state matching the real-time session message in each distributed cache in the local area, then determine the target message routing interface and the target session connection, and the distributed cache and A message routing interface corresponds to;

通过所述目标消息路由接口调用所述目标会话连接,并将消息处理后的所述实时会话消息通过所述目标会话连接进行下发。Invoking the target session connection through the target message routing interface, and delivering the processed real-time session message through the target session connection.

显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each step of the above-mentioned present invention can be realized by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed in a network formed by multiple computing devices Alternatively, they may be implemented in program code executable by a computing device so that they may be stored in a storage device to be executed by a computing device, and in some cases in an order different from that shown here The steps shown or described are carried out, or they are separately fabricated into individual integrated circuit modules, or multiple modules or steps among them are fabricated into a single integrated circuit module for implementation. As such, the present invention is not limited to any specific combination of hardware and software.

以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims (10)

1. A method for processing a real-time session message, comprising:
when a real-time session message is received, all message routing interfaces in a local area range are called, wherein all message routing interfaces comprise a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
when the online session state matched with the real-time session message exists in each distributed cache in the local area range through the message routing interface, determining a target message routing interface and a target session connection, wherein the distributed caches correspond to one message routing interface;
and calling the target session connection through the target message routing interface, and issuing the real-time session message after message processing through the target session connection.
2. The method of claim 1, wherein prior to said invoking all message routing interfaces within a local area scope, the method further comprises:
searching all non-local message routing interfaces of a local area range, wherein each non-local message routing interface is matched with corresponding session connection;
and establishing an association relation between the searched non-local message routing interface and a local message routing interface, and determining at least one associated message routing interface.
3. The method of claim 1, wherein prior to determining the target message routing interface and the target session connection, the method further comprises:
acquiring interface parameters in the real-time session message, wherein the interface parameters comprise message content, target user information and session request identification;
calling the message routing interface based on the interface parameters, and searching a session state corresponding to the real-time session message from the distributed cache;
and if the session state is found and the session state is an online state, determining that the online session state matched with the real-time session message exists in each distributed cache in the local area range.
4. The method of claim 3, wherein determining the target message routing interface and the target session connection comprises:
determining a target distributed cache stored in a session state corresponding to the online session state, and determining a message routing interface corresponding to the target distributed cache as a target message routing interface;
and acquiring the connection service configured by the target message routing interface, and determining the session connection established by the connection service as the target session connection.
5. The method of claim 1, wherein the invoking the target session connection through the target message routing interface and issuing the message-processed real-time session message through the target session connection comprises:
configuring interface parameters of the target message routing interface through message content, target user information and a session request identifier in the real-time session message;
calling a target session connection based on a target message routing interface which completes the interface parameter configuration, and acquiring the real-time session message which completes message processing based on the message content;
and sending the real-time session message to a target user matched with the target user information and the session request identifier through the target session connection.
6. The method of claim 1, further comprising:
detecting whether a plurality of calling times for calling all the message routing interfaces are greater than a preset calling time threshold value or not;
if the calling time is larger than a preset calling time threshold, determining that a message routing interface corresponding to the calling time is calling failure;
when the real-time session message is received again, the message routing interface which is failed to call is called again, whether an online session state matched with the real-time session message exists in the corresponding distributed cache is inquired through the message routing interface which is failed to call, and whether the message routing interface which is failed to call is a target message routing interface is determined.
7. The method according to any one of claims 1-6, further comprising:
when the real-time session message processed by the message is detected not to be issued to a target user through the target session connection, the real-time session message which is not successfully issued is transferred to a message issuing queue, and the message issuing queue executes the issuing of the real-time session message according to a polling mode;
and when the polling issuing condition corresponding to the real-time session message in the message issuing queue is triggered, issuing the real-time session message to a target user.
8. An apparatus for processing a real-time conversation message, comprising:
the interface calling module is used for calling all message routing interfaces in a local area range when a real-time session message is received, wherein the all message routing interfaces comprise a local message routing interface and at least one associated message routing interface associated with the local message routing interface;
a determining module, configured to determine a target message routing interface and a target session connection when an online session state matching the real-time session message exists in each distributed cache in the local area range through the message routing interface, where the distributed cache corresponds to one message routing interface;
and the message issuing module is used for calling the target session connection through the target message routing interface and issuing the real-time session message after message processing through the target session connection.
9. A storage medium, wherein at least one executable software is stored in the storage medium, and the executable software performs an operation corresponding to the processing method of the real-time conversation message according to any one of claims 1 to 7.
10. A terminal comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface are communicated with each other through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the processing method of the real-time conversation message according to any one of claims 1-7.
CN202210925623.4A 2022-08-03 2022-08-03 Real-time conversation message processing method and device, storage medium, and terminal Active CN115277647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210925623.4A CN115277647B (en) 2022-08-03 2022-08-03 Real-time conversation message processing method and device, storage medium, and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210925623.4A CN115277647B (en) 2022-08-03 2022-08-03 Real-time conversation message processing method and device, storage medium, and terminal

Publications (2)

Publication Number Publication Date
CN115277647A true CN115277647A (en) 2022-11-01
CN115277647B CN115277647B (en) 2025-03-14

Family

ID=83747072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210925623.4A Active CN115277647B (en) 2022-08-03 2022-08-03 Real-time conversation message processing method and device, storage medium, and terminal

Country Status (1)

Country Link
CN (1) CN115277647B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024687A (en) * 2011-09-20 2013-04-03 阿尔卡特朗讯公司 Method and equipment for establishing instant messaging
US20140379938A1 (en) * 2013-06-20 2014-12-25 Cisco Technology, Inc. Hierarchical load balancing in a network environment
US9503485B1 (en) * 2013-03-01 2016-11-22 Whatsapp Inc. Connecting communicating devices in a multi-server communication system
CN109429215A (en) * 2017-07-04 2019-03-05 中兴通讯股份有限公司 Data transmission method, relevant device and computer readable storage medium
CN109525620A (en) * 2017-09-20 2019-03-26 中移(杭州)信息技术有限公司 A kind of message push system, method and device
CN109905482A (en) * 2019-03-12 2019-06-18 北京工业大学 Cache Method Based on Video Live System in Named Data Network
CN110709869A (en) * 2017-06-15 2020-01-17 谷歌有限责任公司 Suggestion items for use with embedded applications in chat conversations
CN111641690A (en) * 2020-05-20 2020-09-08 北京字节跳动网络技术有限公司 Session message processing method and device and electronic equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024687A (en) * 2011-09-20 2013-04-03 阿尔卡特朗讯公司 Method and equipment for establishing instant messaging
US9503485B1 (en) * 2013-03-01 2016-11-22 Whatsapp Inc. Connecting communicating devices in a multi-server communication system
US20140379938A1 (en) * 2013-06-20 2014-12-25 Cisco Technology, Inc. Hierarchical load balancing in a network environment
CN110709869A (en) * 2017-06-15 2020-01-17 谷歌有限责任公司 Suggestion items for use with embedded applications in chat conversations
CN109429215A (en) * 2017-07-04 2019-03-05 中兴通讯股份有限公司 Data transmission method, relevant device and computer readable storage medium
CN109525620A (en) * 2017-09-20 2019-03-26 中移(杭州)信息技术有限公司 A kind of message push system, method and device
CN109905482A (en) * 2019-03-12 2019-06-18 北京工业大学 Cache Method Based on Video Live System in Named Data Network
CN111641690A (en) * 2020-05-20 2020-09-08 北京字节跳动网络技术有限公司 Session message processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN115277647B (en) 2025-03-14

Similar Documents

Publication Publication Date Title
CN107465767A (en) A kind of method and system of data syn-chronization
CN101753597B (en) Keeping alive method between peer node and client under peer node-client architecture
CN113259479B (en) Data processing method and equipment
CN109729397A (en) Streaming method, system and server
CN115023919B (en) Firewall rule updating method and device, server and storage medium
CN114024972A (en) Long connection communication method, system, device, equipment and storage medium
WO2020237453A1 (en) Method and apparatus for implementing secure multi-party computation, computer device, and storage medium
CN103546528B (en) Distributed message method for pushing and system
US7543030B2 (en) Peer-to-peer communication for instant messaging between different instant message application types
CN110247960B (en) Method and device for realizing secure multi-party computation, computer equipment and storage medium
KR20110001863A (en) SPI Servlet Application Co-Hosting Methods, Servers, and Computer-readable Storage Media
WO2017032110A1 (en) Application message processing system and method, and application device
CN115277647A (en) Method and device for processing real-time session message, storage medium and terminal
CN105656769A (en) Service data processing method, apparatus and system
CN110278120A (en) A test environment adaptation method and proxy server
CN117596288A (en) Message transmission method and device, electronic equipment and storage medium
CN108206823B (en) A method, system and network device for processing messages
CN117478590A (en) Message processing method and device, electronic equipment and storage medium
CN106936718B (en) PPPoE packet transmission method and PPPoE server
US10893237B2 (en) Method and system for multi-group audio-video interaction
CN111240867B (en) Information communication system and method
CN106790168B (en) A communication preprocessing method, client and server
CN111858100A (en) A kind of BMC message transmission method and related device
CN115694843B (en) Avoid counterfeit camera access management methods, systems, devices and media
CN114389988B (en) Remote procedure call method, device, equipment and medium based on network architecture

Legal Events

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