[go: up one dir, main page]

CN111800354A - Message processing method and device, message processing device and storage medium - Google Patents

Message processing method and device, message processing device and storage medium Download PDF

Info

Publication number
CN111800354A
CN111800354A CN201910277493.6A CN201910277493A CN111800354A CN 111800354 A CN111800354 A CN 111800354A CN 201910277493 A CN201910277493 A CN 201910277493A CN 111800354 A CN111800354 A CN 111800354A
Authority
CN
China
Prior art keywords
message
information
queue
target
target message
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
CN201910277493.6A
Other languages
Chinese (zh)
Other versions
CN111800354B (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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201910277493.6A priority Critical patent/CN111800354B/en
Publication of CN111800354A publication Critical patent/CN111800354A/en
Application granted granted Critical
Publication of CN111800354B publication Critical patent/CN111800354B/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
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/74Admission control; Resource allocation measures in reaction to resource unavailability
    • H04L47/746Reaction triggered by a failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/78Architectures of resource allocation
    • H04L47/783Distributed allocation of resources, e.g. bandwidth brokers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a message processing method and device, message processing equipment and a storage medium. The method comprises the following steps: receiving a target message; determining item information of the target message; according to the project information and the message strategy, transmitting the target message by using a message queue corresponding to the project information; therefore, when the middleware transmits the message between the producer and the consumer of the message by using the message queue, the message to be processed is pertinently pressed into the corresponding message queue according to the message strategy; therefore, when the message transmission fails, the message queue with the message failure can be positioned at least according to the item of the message with the current transmission failure, and the positioning and problem troubleshooting of the message error queue are facilitated to be simplified.

Description

消息处理方法及装置、消息处理设备及存储介质Message processing method and device, message processing device and storage medium

技术领域technical field

本发明涉及信息技术领域,尤其涉及一种消息处理方法及装置、消息处理设备及存储介质。The present invention relates to the field of information technology, and in particular, to a message processing method and device, a message processing device and a storage medium.

背景技术Background technique

消息实现分布式服务,在当前已成为一种必然趋势。在Openstack云平台下,消息代理方式比较多,包括Rabbitmq、Qpid等。以Rabbitmq这个工具进行详细阐述。当前,Rabbitmq的实现,如图1所示,生产者(publisher)负责产生消息,消息会根据绑定规则,路由到指定的队列,再由消费者端(consumer)的订阅者(Subscriber)负责从队列拉去消息并处理。中间件(broker)通过交换(exchange)并利用队列(Queue)进行消息的生产者和消费者之间的交互。It has become an inevitable trend for messages to realize distributed services. Under the Openstack cloud platform, there are many message brokers, including Rabbitmq, Qpid, etc. The Rabbitmq tool is used to elaborate. At present, the implementation of Rabbitmq, as shown in Figure 1, the producer (publisher) is responsible for generating messages, the messages will be routed to the specified queue according to the binding rules, and then the subscriber (Subscriber) of the consumer (consumer) is responsible for sending messages from The queue pulls the message and processes it. Middleware (broker) interacts between message producers and consumers through exchanges and using queues.

而Openstack云平台下的服务在消息的使用上,体现在两个方面:The services under the Openstack cloud platform are reflected in two aspects in the use of messages:

一方面是消息的监听,在服务启动的过程中,会通过指定的目标(target)对象及监听的消息类型,同时创建到Rabbitmq server端的连接,实现服务对于消息的监听;On the one hand, it is the monitoring of messages. In the process of starting the service, it will create a connection to the Rabbitmq server through the specified target object and the type of messages to be monitored, so that the service can monitor messages;

另一方面是客户端消息的发送,客户端通过初始化远程过程调用(RemoteProcedure Call,RPC)的流程,指定消息的目标对象,及上下文消息的通道,获得连接到Rabbitmq server的通道,从而进一步根据消息的类型。On the other hand, the client message is sent. The client obtains the channel connected to the Rabbitmq server by initializing the remote procedure call (RemoteProcedure Call, RPC) process, specifying the target object of the message, and the channel of the context message, and further according to the message type.

路由规则发送消息到消息队列中间人(Broker)。Routing rules send messages to the message queue broker (Broker).

从上述两方面,得知消息在Openstack云平台的流转过程,首先是客户端,获取RPC客户端连接通道,然后按照客户端想要发送的消息模式,封装消息并发送到Broker,然后消费者服务监听到消息的到来,会立即拉取消息,进行处理,如果是同步消息,会返回处理结果,否则不返回。From the above two aspects, we know the flow of messages in the Openstack cloud platform. First, the client obtains the RPC client connection channel, and then encapsulates the message and sends it to the broker according to the message mode the client wants to send, and then the consumer service When listening to the arrival of a message, it will immediately pull the message and process it. If it is a synchronous message, it will return the processing result, otherwise it will not return.

Openstack下的消息种类分为direct、fanout、topic三种类型,其中服务在启动的时候,一般会监听fanout和topic两种类型的消息,表示监听匹配模式和所有发送到这个路由上的消息,direct类型的消息,一般会在进程中用到,用于接收同步请求的消息返回结果。The types of messages under Openstack are divided into three types: direct, fanout, and topic. When the service is started, it generally listens to two types of messages, fanout and topic, which means monitoring matching patterns and all messages sent to this route. Direct The type of message, which is generally used in the process, is used to receive the message return result of the synchronization request.

在现有消息队列的框架下,首先,一旦平台出了问题,运维人员往往比较不知所措,对于后端服务的认知能力并没有达到研发的水平下,即使知道了出问题的队列,也依旧不能排查问题。Under the framework of the existing message queue, first of all, once there is a problem with the platform, the operation and maintenance personnel are often at a loss, and the cognitive ability of the back-end service has not reached the level of research and development. Still can't troubleshoot the problem.

其次,消息的出错的具体位置也难以确定。Secondly, it is also difficult to determine the specific location of the error in the message.

最后,消息队列是云平台的一个重要的性能瓶颈点,这并不是消息队列本身的能力问题,而是消费者服务能力不足导致的。Finally, the message queue is an important performance bottleneck of the cloud platform. This is not a problem with the capability of the message queue itself, but is caused by the insufficient service capability of consumers.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例期望提供一种消息处理方法及装置、消息处理设备及存储介质In view of this, embodiments of the present invention are expected to provide a message processing method and apparatus, a message processing device, and a storage medium

本发明的技术方案是这样实现的:The technical scheme of the present invention is realized as follows:

一种消息处理方法,包括:A message processing method, including:

接收目标消息;receive the target message;

确定所述目标消息的项目信息;determining item information of the target message;

根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。According to the item information and the message policy, the target message is transmitted by using the message queue corresponding to the item information.

基于上述方案,所述方法还包括:Based on the above scheme, the method further includes:

获取所述目标消息的属性信息;obtain attribute information of the target message;

根据所述属性信息,确定是否追踪所述目标消息;According to the attribute information, determine whether to track the target message;

若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。If it is determined to track the target message, the message record and/or link track information of the target message is recorded in the metadata.

基于上述方案,所述获取所述目标消息的属性信息,包括:Based on the above solution, the acquiring attribute information of the target message includes:

根据追踪模式,获取所述目标消息的属性信息。According to the tracking mode, the attribute information of the target message is acquired.

基于上述方案,所述根据追踪模式,获取所述目标消息的属性信息,包括以下之一:Based on the above solution, the obtaining attribute information of the target message according to the tracking mode includes one of the following:

根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode;

根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode;

根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode.

基于上述方案,所述根据所述属性信息,确定是否追踪所述目标消息,包括:Based on the above solution, determining whether to track the target message according to the attribute information includes:

将所述属性信息与追踪设定的属性信息进行匹配;matching the attribute information with the attribute information set by the tracking;

若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。If the matching is successful, it is determined to track the message record and/or link track information of the target message.

基于上述方案,所述若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中,包括以下至少之一:Based on the above solution, if it is determined to track the target message, record the message record and/or link track information of the target message into metadata, including at least one of the following:

在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata;

在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata;

在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata.

基于上述方案,所述方法还包括:Based on the above scheme, the method further includes:

根据所述属性信息,确定所述目标消息的追踪优先级;determining the tracking priority of the target message according to the attribute information;

根据所述追踪优先级,确定追踪所述目标消息的记录方式。According to the tracking priority, a recording mode for tracking the target message is determined.

基于上述方案,所述记录方式包括以下至少之一:Based on the above solution, the recording method includes at least one of the following:

信息info方式;information info method;

错误error方式;error error method;

除错debug方式。Debug debug mode.

基于上述方案,所述方法还包括:Based on the above scheme, the method further includes:

若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。If the first cluster where the message queue of the target message is located is abnormal, the message queue and/or the middleware for message processing is switched to the second cluster that is mutually backup with the first cluster.

基于上述方案,所述方法还包括:Based on the above scheme, the method further includes:

若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。If the first cluster is abnormal, according to the recovery mechanism of the project where the target message is located, the abnormal message of the project where the target message is located is recovered through the second cluster.

基于上述方案,所述元数据包括以下数据对象的至少之一:Based on the above solution, the metadata includes at least one of the following data objects:

队列对象;queue object;

请求对象;request object;

路由对象;route object;

资源对象。resource object.

基于上述方案,所述队列对象包括以下字段的至少之一:Based on the above solution, the queue object includes at least one of the following fields:

消息标识、路由键、消息头、消息体、消息的生产者、消息的目的;Message ID, routing key, message header, message body, message producer, message purpose;

所述请求对象包括以下字段的至少之一:The request object includes at least one of the following fields:

标识,所述标识包括以下之一:请求标识、项目标识、队列标识、路由标识、消息标识;An identifier, the identifier includes one of the following: a request identifier, an item identifier, a queue identifier, a routing identifier, and a message identifier;

创建时间;creation time;

所述路由对象包括以下字段的至少之一:The routing object includes at least one of the following fields:

路由标识;routing identifier;

路由名称;route name;

项目名称;project name;

队列名称;queue name;

所述资源对象包括以下字段的至少之一:The resource object includes at least one of the following fields:

中间件的资源标识;The resource identifier of the middleware;

主机资源所在的节点位置;The node location where the host resource is located;

队列的资源信息;resource information of the queue;

服务资源所在的服务信息;Service information where the service resource is located;

端口信息。port information.

基于上述方案,所述方法还包括:Based on the above scheme, the method further includes:

基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;Based on the query request, query the metadata to obtain the message record and/or link track information of the message to be tracked;

根据所述消息记录和/或链路轨迹信息,进行信息处理。Information processing is performed according to the message record and/or the link trace information.

基于上述方案,所述根据所述消息记录和/或链路轨迹信息,进行信息处理,包括以下至少之一:Based on the above solution, performing information processing according to the message record and/or link track information includes at least one of the following:

根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;According to the message record and/or the link track information, carry out statistics of the number of messages of a project, statistics of the number of messages delivered per unit time, and evaluation of the service capability of the message server that processes the messages;

根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。According to the message record and/or the link track information, at least one of locating an erroneous node, locating an erroneous service, and locating an error cause is performed.

一种消息处理装置,包括:A message processing device, comprising:

第一接收模块,用于接收目标消息;a first receiving module, configured to receive a target message;

第一确定模块,用于确定所述目标消息的项目信息;a first determining module for determining item information of the target message;

传输模块,用于根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。The transmission module is configured to use the message queue corresponding to the item information to transmit the target message according to the item information and the message policy.

基于上述方案,所述装置还包括:Based on the above solution, the device further includes:

第一获取模块,用于获取所述目标消息的属性信息;a first acquiring module, used for acquiring attribute information of the target message;

第二确定模块,用于根据所述属性信息,确定是否追踪所述目标消息;a second determining module, configured to determine whether to track the target message according to the attribute information;

记录模块,用于若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。A recording module, configured to record the message record and/or link track information of the target message into metadata if it is determined to track the target message.

基于上述方案,所述第一获取模块,用于根据追踪模式,获取所述目标消息的属性信息。Based on the above solution, the first acquisition module is configured to acquire attribute information of the target message according to the tracking mode.

基于上述方案,所述第一获取模块,具体用于执行以下之一:Based on the above solution, the first acquisition module is specifically configured to execute one of the following:

根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode;

根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode;

根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode.

基于上述方案,所述第二确定模块,用于将所述属性信息与追踪设定的属性信息进行匹配;若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。Based on the above solution, the second determination module is configured to match the attribute information with the attribute information set for tracking; if the matching is successful, determine the message record and/or link track information of the target message to be tracked.

基于上述方案,所述记录模块,具体用于执行以下之一:Based on the above solution, the recording module is specifically configured to execute one of the following:

在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata;

在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata;

在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata.

基于上述方案,所述装置还包括:Based on the above solution, the device further includes:

第三确定模块,用于根据所述属性信息,确定所述目标消息的追踪优先级;a third determining module, configured to determine the tracking priority of the target message according to the attribute information;

第四确定模块,用于根据所述追踪优先级,确定追踪所述目标消息的记录方式。The fourth determining module is configured to determine a recording method for tracking the target message according to the tracking priority.

基于上述方案,所述装置还包括:Based on the above solution, the device further includes:

切换模块,用于若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。A switching module, configured to switch the message queue and/or the middleware for message processing to a second cluster that is mutually backup with the first cluster if the first cluster where the message queue of the target message is located is abnormal.

基于上述方案,所述装置还包括:Based on the above solution, the device further includes:

恢复模块,用于若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。The recovery module is configured to, if the first cluster is abnormal, recover the abnormal message of the project where the target message is located through the second cluster according to the recovery mechanism of the project where the target message is located.

基于上述方案,所述装置还包括:Based on the above solution, the device further includes:

查询模块,用于基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;a query module, configured to query the metadata to obtain the message record and/or link track information of the message to be tracked based on the query request;

处理模块,用于根据所述消息记录和/或链路轨迹信息,进行信息处理。A processing module, configured to perform information processing according to the message record and/or the link track information.

基于上述方案,所述处理模块,用于执行以下至少之一:Based on the above solution, the processing module is configured to execute at least one of the following:

根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;According to the message record and/or the link track information, carry out statistics of the number of messages of a project, statistics of the number of messages delivered per unit time, and evaluation of the service capability of the message server that processes the messages;

根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。According to the message record and/or the link track information, at least one of locating an erroneous node, locating an erroneous service, and locating an error cause is performed.

一种消息处理设备,包括:A message processing device, comprising:

存储器;memory;

处理器,与所述处理器连接,用于通过执行存储在所述存储器上的计算机可执行指令,能够实现前述一个或多个技术方案提供的消息处理方法。A processor, connected to the processor, is configured to implement the message processing method provided by one or more of the foregoing technical solutions by executing the computer-executable instructions stored in the memory.

一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令;所述计算机可执行指令被处理器执行后,能够实现前述一个或多个技术方案提供的消息处理方法。A computer storage medium storing computer-executable instructions; after the computer-executable instructions are executed by a processor, the message processing method provided by one or more of the foregoing technical solutions can be implemented.

本发明实施例提供的消息处理方法及装置、消息处理设备及存储介质,会在分项目设置不同的消息队列,如此中间件在消息的生产者和消费者之间利用消息队列传输消息时,会根据消息策略将待处理消息有针对性压入对应的消息队列;如此,在出现消息传递失败时,至少可以根据当前传输失败的消息所在的项目,定位出消息出现故障的消息队列,有利于简化消息的出错的定位,和问题排查。In the message processing method and device, message processing device, and storage medium provided by the embodiments of the present invention, different message queues are set in sub-projects, so that when the middleware uses the message queue to transmit messages between message producers and consumers, it will According to the message policy, the to-be-processed message is pushed into the corresponding message queue in a targeted manner; in this way, when a message delivery failure occurs, at least the message queue where the message has failed can be located according to the project where the message currently failed to transmit is located, which is conducive to simplifying Error location of the message, and troubleshooting.

附图说明Description of drawings

图1为一种消息的传输路径示意图;1 is a schematic diagram of a transmission path of a message;

图2为本发明实施例提供的一种消息处理方法的流程示意图;2 is a schematic flowchart of a message processing method according to an embodiment of the present invention;

图3为本发明实施例提供的另一种消息处理方法的流程示意图;3 is a schematic flowchart of another message processing method provided by an embodiment of the present invention;

图4为本发明实施例提供的一种消息处理装置的结构示意图;4 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present invention;

图5为本发明实施例提供的再一种消息处理方法的流程示意图;5 is a schematic flowchart of still another message processing method provided by an embodiment of the present invention;

图6为本发明实施例提供的一种消息传递示意图;6 is a schematic diagram of a message transmission provided by an embodiment of the present invention;

图7为本发明实施例提供的一种元数据的数据结构示意图;FIG. 7 is a schematic diagram of a data structure of metadata according to an embodiment of the present invention;

图8为本发明实施例提供的一种云平台、消息服务器及集群之间的对应关系示意图。FIG. 8 is a schematic diagram of a correspondence relationship among a cloud platform, a message server, and a cluster according to an embodiment of the present invention.

具体实施方式Detailed ways

以下结合说明书附图及具体实施例对本发明的技术方案做进一步的详细阐述。The technical solutions of the present invention will be further elaborated below with reference to the accompanying drawings and specific embodiments of the description.

如图2所示,本实施例提供一种消息处理方法,包括:As shown in FIG. 2, this embodiment provides a message processing method, including:

步骤S110:接收目标消息;Step S110: receiving the target message;

步骤S120:确定所述目标消息的项目信息;Step S120: determine the item information of the target message;

步骤S130:根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。Step S130: According to the item information and the message policy, use a message queue corresponding to the item information to transmit the target message.

在本实施例中,该消息处理方法可以应用于云平台和消息服务器的中间件中。In this embodiment, the message processing method can be applied to the middleware of the cloud platform and the message server.

该中间件可以以插件的形式嵌入到云平台和/或消息服务器中;如此,不用改造云平台和/或消息服务器的物理架构,与现有技术的兼容性强,与此同时可以实现按照项目进行消息队列的区分,实现项目粒度的消息转发及传输等处理。The middleware can be embedded in the cloud platform and/or message server in the form of a plug-in; in this way, the physical architecture of the cloud platform and/or message server does not need to be modified, and the compatibility with the existing technology is strong, and at the same time, the project can be implemented according to the project. Distinguish message queues and implement project-level message forwarding and transmission processing.

中间件为位于消息的生产者(Provider)和消费者(Consumer)之间的。中间件至少可用于对需要压入队列的消息或者从队列提取消息的中转。例如,中间件将从生产者提供的消息,按照消息所在的项目,压入对应的消息队列中,以方便消息的消费者从对应的消息队列中拉取消息。The middleware is located between the message producer (Provider) and the consumer (Consumer). Middleware can at least be used to relay messages that need to be pushed into the queue or extracted from the queue. For example, the middleware will push the message provided by the producer into the corresponding message queue according to the project where the message is located, so as to facilitate the consumer of the message to pull the message from the corresponding message queue.

本实施例中所述项目可为一个或多个服务组成。若一个项目由多个服务组成,这些服务之间为具有关联性的服务。例如,一个软件的管理项目可包括:该软件的认证服务、该软件的升级服务等;这几个服务的关联性就体现在对应于同一个软件。再例如,以移动通信收费项目为例,该通信收费项目可包括:通信计费服务、收费管理服务等。当然以上仅是举例。The items described in this embodiment may be composed of one or more services. If a project consists of multiple services, these services are related services. For example, a software management item may include: the software's certification service, the software's upgrade service, etc.; the correlation of these several services is reflected in that they correspond to the same software. For another example, taking a mobile communication charging item as an example, the communication charging item may include: a communication billing service, a charging management service, and the like. Of course the above are just examples.

在具体的实现过程中,所述项目的设置可以根据需要进行处理。在一些实施例中,一个所述项目可以是一个大服务下一个或多个子服务构成。In a specific implementation process, the setting of the item can be processed as required. In some embodiments, one such item may consist of one or more sub-services under a large service.

在本实施例中,所述目标消息可为任意需要在消息的生产者和消费者之间传输的任意消息,例如,某一个线程产生的触发消息等。In this embodiment, the target message may be any message that needs to be transmitted between a message producer and a consumer, for example, a trigger message generated by a certain thread, and the like.

在本实施例中,预先设置了消息策略,该消息策略可以由中间件运行。若接收到一条信息需要在云平台和消息服务器之间进行转发时,首先会确定出消息的项目信息,该项目信息会指示该目标消息所述的项目。不同的项目设置有不同的消息队列,在本实施例中称之为消息队列。In this embodiment, a message policy is preset, and the message policy can be run by the middleware. If a piece of information is received and needs to be forwarded between the cloud platform and the message server, the item information of the message will be determined first, and the item information will indicate the item described in the target message. Different projects are provided with different message queues, which are called message queues in this embodiment.

例如,项目A和项目B分别设置了各种用于收发消息的消息队列,项目A的队列可为A队列,项目B的队列可为B队列。在步骤S130中中间件进行消息中转时,可以利用A队列处理项目A的消息,利用B队列处理项目B的消息。For example, project A and project B are respectively set with various message queues for sending and receiving messages, the queue of project A may be the A queue, and the queue of project B may be the B queue. When the middleware performs message transfer in step S130, the A queue may be used to process the message of item A, and the B queue may be used to process the message of item B.

如此,在云平台和消息服务器之间传输的消息,将利用不同的消息队列实现不同项目的消息中转等消息处理,实现了项目级别的消息队列的区分,如此,在定位故障或者有消息堆积时,可以根据项目进行针对性调整,实现云平台和/或消息服务有针对性的性能优化,提升消息传输质量和效率。若消息传输过程中出现错误,至少可以根据目标消息所在项目,确定出现错误的消息队列是哪些,而非是所有队列可以接收所有消息,从而无法定位出出现错误导致消息无法正常传输的消息队列定位难度大的问题,从而有利于目标消息在传递过程中错误定位的简化。In this way, the messages transmitted between the cloud platform and the message server will use different message queues to realize message processing such as message transfer of different projects, and realize the distinction of message queues at the project level. In this way, when a fault is located or messages accumulate , which can be adjusted according to the project to achieve targeted performance optimization of the cloud platform and/or message service, and improve the quality and efficiency of message transmission. If an error occurs during message transmission, at least according to the project where the target message is located, it is possible to determine which message queues have errors, not all queues that can receive all messages, so that it is impossible to locate the message queues where the error causes the message to fail to be transmitted normally. It is a difficult problem, which is conducive to the simplification of the error location of the target message during the transmission process.

在一些实施例中,所述方法还包括:In some embodiments, the method further includes:

分项目记录消息队列的队列状态信息,该队列状态信息可以用于指示对应消息队列的设置的最大长度、平均占用的队列长度等;如此,后续可以根据队列状态信息,调整对应项目所对应的队列参数,此处的队列参数包括但不限于:队列条数、单个消息队列的最大长度等,以满足不同项目传输消息所需的消息队列。The queue status information of the message queue is recorded by item. The queue status information can be used to indicate the maximum length of the corresponding message queue settings, the average occupied queue length, etc.; in this way, the queue corresponding to the corresponding item can be adjusted according to the queue status information in the future. parameters, the queue parameters here include but are not limited to: the number of queues, the maximum length of a single message queue, etc., to meet the message queues required by different projects to transmit messages.

在一些实施例中,所述方法还包括:In some embodiments, the method further includes:

在一个项目的消息传输异常时,可以根据该项目所对应消息队列的所述队列状态消息,确定异常是出现在消息队列还是出现在消息接收的消费者,如此,所述队列状态信息还可以用于定位异常。若所述队列状态信息指示该项目对应的消息队列正常,无溢出现象时出现了消息传输失败,则可能异常出现在消费者,而非在消息队列上。When the message transmission of an item is abnormal, it can be determined whether the abnormality occurs in the message queue or in the consumer receiving the message according to the queue status message of the message queue corresponding to the item. In this way, the queue status information can also be used In the positioning abnormal. If the queue status information indicates that the message queue corresponding to the item is normal, and a message transmission failure occurs when there is no overflow phenomenon, the abnormality may occur in the consumer instead of the message queue.

在一些实施例中,如图3所示,所述方法还包括:In some embodiments, as shown in Figure 3, the method further includes:

步骤S210:获取所述目标消息的属性信息;Step S210: acquiring attribute information of the target message;

步骤S220:根据所述属性信息,确定是否追踪所述目标消息;Step S220: According to the attribute information, determine whether to track the target message;

步骤S230:若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。Step S230: If it is determined to track the target message, record the message record and/or link track information of the target message into metadata.

所述属性信息可以根据目标消息的消息头进行确定,也可以根据目标消息的上一处理节点的属性进行确定。例如,中间件可以根据生产者的属性进行确定,不同的生产者属于不同的服务或不同的项目,如此,可以根据生产者的属性确定目标消息的属性信息。The attribute information may be determined according to the message header of the target message, or may be determined according to the attribute of the last processing node of the target message. For example, the middleware can be determined according to the attributes of the producers, and different producers belong to different services or different projects. In this way, the attribute information of the target message can be determined according to the attributes of the producers.

在一些实施例中,有一些消息是需要追踪的,而有一些信息是可以不追踪的。例如,重要的信息进行追踪,而不重要的信息可以不进行追踪,如此相对于追踪所有的目标消息,可以减少追踪负荷,简化处理。In some embodiments, some messages need to be tracked, and some messages may not be tracked. For example, important information is tracked, and unimportant information may not be tracked, so compared with tracking all target messages, the tracking load can be reduced and processing can be simplified.

所述消息记录包括但不限于:The message records include but are not limited to:

消息的更新记录;此处的消息的更新记录包括:消息的封装体的更新、消息的内容的更新记录。所述消息的封装体的更新包括但不限于:消息的封装、解封装的相关记录。所述消息内容的更新记录包括:消息内容的添加、删除和/或替换等操作的记录。The update record of the message; the update record of the message here includes: the update record of the package body of the message and the update record of the content of the message. The update of the encapsulation body of the message includes, but is not limited to, related records of encapsulation and decapsulation of the message. The update record of the message content includes: a record of operations such as addition, deletion and/or replacement of the message content.

在一些实施例中,所述消息记录还包括:In some embodiments, the message record further includes:

消息的收发状态,例如,消息从一个节点传输到下一个节点的传输时间、传输成功与否等信息。The sending and receiving status of the message, for example, the transmission time of the message from one node to the next node, whether the transmission is successful or not, and other information.

所述链路轨迹信息,用于指示消息传输的路径;根据所述链路轨迹信息可以知道消息的生产者、传输者及接收者。The link trace information is used to indicate the path of message transmission; according to the link trace information, the producer, transmitter and receiver of the message can be known.

通过上述消息记录和/或链路轨迹信息的记录,可以方便后续在消息传输失败的过程中,进行出错分析,该出错分析包括但不限于:出错节点的定位、出错原因的定位等。By recording the above message records and/or link track information, it is convenient for subsequent error analysis in the process of message transmission failure.

在本实施例中,所述消息记录和/或链路轨迹信息存储在元数据中,利用元数据的记录功能,可以实现消息的持久记忆。In this embodiment, the message record and/or the link track information are stored in the metadata, and the persistent memory of the message can be realized by using the recording function of the metadata.

在一些实施例中,所述步骤S210可包括:In some embodiments, the step S210 may include:

根据追踪模式,获取所述目标消息的属性信息。According to the tracking mode, the attribute information of the target message is acquired.

不同的追踪模块所需的属性信息不同。该追踪模式可以是根据用户指示进行设置,也可以是根据项目的属性进行设置的。The attribute information required by different tracking modules is different. The tracking mode can be set according to the user's instruction or according to the properties of the item.

由于不同的追踪模式,需要获取不同的目标消息的属性信息,来判断是否需要追踪该目标消息。因此,在步骤S210中是根据当前设定的追踪模式,从目标消息自身或者收发节点来获取所述属性信息。Due to different tracking modes, attribute information of different target messages needs to be acquired to determine whether the target message needs to be tracked. Therefore, in step S210, the attribute information is obtained from the target message itself or the sending and receiving node according to the currently set tracking mode.

在一些实施例中,所述步骤S210具体可包括以下之一:In some embodiments, the step S210 may specifically include one of the following:

根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode;

根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode;

根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode.

在本实施例中,所述追踪模式可以根据不同粒度的划分。例如,若是项目模式,则需要追踪项目的所有目标消息都需要追踪,则此时在判断一条目标消息是否需要追踪时,首先需要获取当前目标消息的项目信息。In this embodiment, the tracking modes may be divided according to different granularities. For example, in the project mode, all target messages of the project need to be tracked. At this time, when judging whether a target message needs to be tracked, the project information of the current target message needs to be obtained first.

将获取的项目信息与需要追踪项目的项目信息进行匹配,若匹配一致,可确定出当前目标消息是需要追踪的消息。The acquired item information is matched with the item information of the item that needs to be tracked, and if the matching is consistent, it can be determined that the current target message is the message that needs to be tracked.

路由模式下可以用于限定追踪通过特定路由路径传输的信息的追踪。若当前追踪模式为路由模式,则需要获取所述目标消息的路由信息。在获取当前目标消息的路由信息之后,与需要追踪路由的路由消息进行匹配,若匹配一致,可确定出当前目标消息是需要追踪的目标消息。Routing mode can be used to qualify traces that trace information that travels through a specific routing path. If the current tracking mode is the routing mode, the routing information of the target message needs to be acquired. After the routing information of the current target message is acquired, it is matched with the routing message that needs to be traced. If the matching is consistent, it can be determined that the current target message is the target message that needs to be traced.

若当前追踪模式是以队列为粒度的队列模式,则可以获取目标消息需要压入队列的队列信息,将该队列信息与预先确定需要追踪队列的队列信息进行匹配,若匹配一致,则可认为当前目标消息是需要追踪的目标消息。If the current tracking mode is a queue mode with a queue as the granularity, you can obtain the queue information that the target message needs to be pushed into the queue, and match the queue information with the queue information that needs to be tracked in advance. If the matching is consistent, it can be considered that the current The target message is the target message that needs to be tracked.

在一些实施例中,所述追踪模式不限于所述项目模式、路由模式、队列模式,还可以包括以服务为粒度的服务模式。在服务模式下,可以获取目标消息所在服务的服务信息,通过与需要追踪服务的服务信息的匹配,若匹配一致则确定对应的目标消息为需要追踪的目标消息。In some embodiments, the tracking mode is not limited to the item mode, routing mode, and queue mode, and may also include a service-granularity service mode. In the service mode, the service information of the service where the target message is located can be obtained, and by matching with the service information of the service to be tracked, if the match is consistent, the corresponding target message is determined to be the target message to be tracked.

所述追踪模式有多种,在一些特定情况下多种追踪模式可以并存,但是若一条消息同时命中多种追踪模式时,仅进行一次追踪,不涉及重复冗余追踪。例如,当前追踪模式同时包括队列模式和项目模式,若一条目标消息同时需要追踪的项目和队列,则可以认为该目标消息是需要追踪的,但是仅进行一次追踪,不在两种模式下同时追踪。There are multiple tracking modes, and in some specific cases, multiple tracking modes can coexist, but if a message hits multiple tracking modes at the same time, only one tracking is performed, and repeated redundant tracking is not involved. For example, the current tracking mode includes both the queue mode and the item mode. If a target message needs to track both the item and the queue, it can be considered that the target message needs to be tracked, but it is only tracked once, and not tracked in both modes at the same time.

总之,所述步骤S220可包括:将所述属性信息与追踪设定的属性信息进行匹配;若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。In a word, the step S220 may include: matching the attribute information with the attribute information set by the tracking; if the matching is successful, determining the message record and/or the link track information of the tracking target message.

所述消息记录和所述链路轨迹信息的相关描述具体参见前述部分,此处就不再重复了。The relevant description of the message record and the link track information can be found in the foregoing section for details, and will not be repeated here.

在本实施例中,在追踪所述目标消息时获得的消息记录和/或链路轨迹信息等各种追踪信息,可记录在元数据中,实现长久记录,也方便查询。In this embodiment, various tracking information, such as message records and/or link track information obtained when tracking the target message, can be recorded in the metadata to achieve long-term records and facilitate query.

在一些实施例中,所述步骤S220可具体包括以下至少之一:In some embodiments, the step S220 may specifically include at least one of the following:

在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata;

在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata;

在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata.

在项目模式下,会将描述目标消息的路由路径的路由信息,目标消息压入队列的队列信息、路由时使用的路由键、消息内容、消息的生产者、消息的接收者,以及在各个中转路由节点上收发情况信息等信息中的一个或多个,都记录到元数据中。In the project mode, the routing information describing the routing path of the target message, the queue information of the target message being pushed into the queue, the routing key used in routing, the message content, the message producer, the message receiver, and each transit One or more of the information such as the sending and receiving situation information on the routing node are all recorded in the metadata.

所述收发情况信息可包括以下至少之一:The sending and receiving information may include at least one of the following:

指示是否成功接收到所述目标消息的收发状况信息;Indicate whether the sending and receiving status information of the target message is successfully received;

指示接收所述目标消息的第一时间信息;Indicate the first time information for receiving the target message;

指示发送所述目标消息的第二时间信息。Indicates second time information for sending the target message.

在所述路由模式下,且对应的目标消息需要追踪,则会将该目标消息的生产者、接收者、收发情况信息中的一个或多个都记录到元数据中。In the routing mode, and the corresponding target message needs to be tracked, one or more of the producer, receiver, and sending and receiving information of the target message will be recorded in the metadata.

在队列模式下,可以将包括消息的生产者、消息的接收者及消息的项目信息的至少其中之一写入到元数据中。In the queue mode, at least one of the message producer, the message receiver and the item information of the message can be written into the metadata.

在还有一些实施例中,在所述队列模式下还可以将所述目标消息的路由信息和/或服务消息也写入到所述元数据中。In still other embodiments, in the queue mode, the routing information and/or the service message of the target message may also be written into the metadata.

在一些实施例中,在所述项目模式、路由模式及队列模式的任意一个下,还可以将处理所述目标消息的中间件的标识信息、处理所述目标消息的资源信息、处理所述待处理信息的节点信息、传输端口的端口信息等信息中的一种或多种写入到所述元数据。In some embodiments, in any one of the item mode, the routing mode and the queue mode, the identification information of the middleware that processes the target message, the resource information of the One or more kinds of information such as node information of processing information and port information of transmission ports are written into the metadata.

所述资源信息可包括:计算资源的资源标识、存储资源的存储标识、带宽资源的带宽标识。所述节点信息用于指示处理所述待处理信息的物理节点和/或虚拟节点的节点标识。所述物理节点包括但不限于主机或集群。所述虚拟节点包括但不限于虚拟机或虚拟机集群。The resource information may include: resource identifiers of computing resources, storage identifiers of storage resources, and bandwidth identifiers of bandwidth resources. The node information is used to indicate a node identifier of a physical node and/or a virtual node that processes the to-be-processed information. The physical nodes include but are not limited to hosts or clusters. The virtual nodes include but are not limited to virtual machines or virtual machine clusters.

在一些实施例中,所述元数据存储的目标消息的消息记录和/或链路轨迹信息,至少用于确定出容易出错路由路段的路径信息,或者,可以用于确定出目标消息的完整路由路径的路由信息。In some embodiments, the message record and/or link trace information of the target message stored in the metadata is at least used to determine the path information of the error-prone route segment, or may be used to determine the complete route of the target message Routing information for the path.

如此,方便后续根据错误分析中错误排除的分析所需的各种信息。In this way, various information required for subsequent analysis based on error exclusion in error analysis is facilitated.

在一些实施例中,所述步骤S220还包括:In some embodiments, the step S220 further includes:

根据所述属性信息,确定所述目标消息的追踪优先级;determining the tracking priority of the target message according to the attribute information;

根据所述追踪优先级,确定追踪所述目标消息的记录方式。According to the tracking priority, a recording mode for tracking the target message is determined.

在本实施例中,还根据目标消息的属性信息,确定所述目标消息的追踪优先级。In this embodiment, the tracking priority of the target message is also determined according to the attribute information of the target message.

不同的属性信息的目标消息具有不同的追踪优先级,追踪优先级越高,则采用越加详细的记录方式进行目标消息的记录方式;如此,实现了优先级高的目标消息的详细追踪。Target messages of different attribute information have different tracking priorities. The higher the tracking priority, the more detailed recording method is used to record the target message; in this way, the detailed tracking of the target message with high priority is realized.

如此,可以根据用户设置或者消息的重要性,采用对应的记录方式进行追踪信息的记录,减少不必要的追踪信息的获取和/或记录。In this way, according to the user settings or the importance of the message, a corresponding recording method can be used to record the tracking information, thereby reducing unnecessary acquisition and/or recording of the tracking information.

在一些实施例中,所述记录方式有多种,以下提供几种可选方式:In some embodiments, there are multiple recording manners, and several optional manners are provided below:

信息info方式;information info method;

错误error方式;error error method;

除错debug方式。Debug debug mode.

在本实施例中,错误方式的记录详细程度高于信息方式;除错方式的记录详细程度高于错误方式。In this embodiment, the record detail level of the error mode is higher than that of the information method; the record detail level of the debug method is higher than that of the error method.

例如,在一些情况下,信息方式仅记录目标消息追踪过程中的一些通用信息;而错误方式除了会记录通用信息以外,还会记录错误信息,例如,出错的路由节点,错误类型等错误信息。所述除错方式除了记录通用信息、错误信息以外,还会记录一些描述信息,这些描述信息是对通用信息和/或错误信息中一个或多个信息点的进一步详细描述,或者,通用信息和/或错误信息以外的其他信息的详细信息。For example, in some cases, the information mode only records some general information in the process of tracking the target message; while the error mode records not only the general information, but also error information, such as the wrong routing node, error type and other error information. In addition to recording general information and error information, the debugging method also records some description information, which is a further detailed description of one or more information points in the general information and/or error information, or, general information and / or details of other information than error messages.

所述通用信息包括但不限于:队列信息、路由信息、项目信息、消息类型、消息所在的服务等。The general information includes but is not limited to: queue information, routing information, item information, message type, service where the message is located, and the like.

在另一些实施例中,所述方法还包括:In other embodiments, the method further includes:

若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。If the first cluster where the message queue of the target message is located is abnormal, the message queue and/or the middleware for message processing is switched to the second cluster that is mutually backup with the first cluster.

在本实施例中,为了减少单一中间件或单一消息队列异常导致的信息无法正常传输的问题,在本实施例中,所述中间件和消息队列都形成有备份。例如,将主中间件和主消息队列配置在第一集群,将备份中间件和备份消息队列配置在第二集群,若第一集群异常,则自动切换到第二集群上的中间件和备份消息队列上进行消息处理。In this embodiment, in order to reduce the problem that information cannot be transmitted normally due to the exception of a single middleware or a single message queue, in this embodiment, backups are formed for both the middleware and the message queue. For example, configure the primary middleware and the primary message queue on the first cluster, and configure the backup middleware and backup message queue on the second cluster. If the first cluster is abnormal, it will automatically switch to the middleware and backup messages on the second cluster. Message processing on the queue.

在一些实施例中,所述备份中间件和备份消息队列是预先配置在第二集群上的,但在一些情况下,也可以是在检测到主中间件和主消息队列异常时临时在预设的第二集群上配置的。In some embodiments, the backup middleware and the backup message queue are pre-configured on the second cluster, but in some cases, the backup middleware and the backup message queue may be temporarily pre-configured when an abnormality of the primary middleware and the main message queue is detected. configured on the second cluster.

在一些实施例中,中间件和消息队列的备份,可以以项目为粒度。例如,不同的项目使用不同的中间件和消息队列时,若项目A出现传输异常,可以对整个项目A的消息传输迁移到备份的第二集群上。In some embodiments, the backup of middleware and message queues can be at item granularity. For example, when different projects use different middleware and message queues, if a transmission exception occurs in project A, the message transmission of the entire project A can be migrated to the second backup cluster.

在还有一些实施例中,一个中间件可能处理多个项目的目标消息,而消息队列是分项目的,此时,可以仅对消息队列和中间件的主备份切换是分离的。In still other embodiments, one middleware may process target messages of multiple items, and the message queue is divided into items. In this case, only the main-backup switching of the message queue and the middleware may be separated.

判断第一集群异常的方式有很多种,以下提供几种可选方式:There are many ways to judge the abnormality of the first cluster. The following are several optional ways:

第一节点发送的消息在第二节点超时未接收到,例如,客户端发送的消息,接收端在60秒等设定时间内没有接收到;The message sent by the first node is not received when the second node times out, for example, the message sent by the client is not received by the receiver within a set time such as 60 seconds;

消息重传率达到重传阈值。The message retransmission rate reaches the retransmission threshold.

在一些实施例中,所述方法还包括:In some embodiments, the method further includes:

若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。If the first cluster is abnormal, according to the recovery mechanism of the project where the target message is located, the abnormal message of the project where the target message is located is recovered through the second cluster.

在本实施例中,为了正常提供服务,各项目都可以设置恢复机制,如项目中某一个服务的消息未成功传输,则在等待特定时间之后或者一旦确定出传输异常之后,就启动恢复机制自动重传等。如此,将中间件和/或消息队列迁移到第二集群上之后,可以基于恢复机制实现异常时间段内未提供服务的补充提供。In this embodiment, in order to provide services normally, a recovery mechanism can be set for each project. If the message of a certain service in the project is not successfully transmitted, the recovery mechanism is automatically activated after waiting for a specific time or once it is determined that the transmission is abnormal. retransmission, etc. In this way, after migrating the middleware and/or the message queue to the second cluster, supplementary provision of services not provided during the abnormal time period can be implemented based on the recovery mechanism.

在本实施例中,所述元数据设置了不同的数据对象。不同的记录方式可以从一个或多个数据对象来进行目标消息的消息记录和/或链路轨迹信息等追踪信息的记录。所述元数据包括以下数据对象的至少之一:In this embodiment, the metadata sets different data objects. Different recording methods can record the message recording of the target message and/or the tracking information such as link track information from one or more data objects. The metadata includes at least one of the following data objects:

队列对象;queue object;

请求对象;request object;

路由对象;route object;

资源对象。resource object.

所述数据对象至少包括一个字段。The data object includes at least one field.

不同的数据对象可包括一个不同的字段。Different data objects can include a different field.

例如,述队列对象包括以下字段的至少之一:For example, the queue object includes at least one of the following fields:

消息标识、路由键、消息头、消息体、消息的生产者、消息的目的。Message ID, routing key, message header, message body, message producer, message purpose.

所述消息标识用于记录消息的序号等唯一标识消息的信息。The message identifier is used to record information such as the sequence number of the message that uniquely identifies the message.

路由键可为进行消息的路由查询的关键字。A routing key may be a keyword for routing queries for messages.

所述消息头可包括:目标消息的包头。The message header may include: a header of the target message.

所述消息体可包括:目标消息的正文。The message body may include: the body of the target message.

所述消息的生产者可为消息的来源。The producer of the message may be the source of the message.

消息的目的可为消息的接收者或消费者。The destination of the message can be the recipient or consumer of the message.

所述请求对象包括以下字段的至少之一:The request object includes at least one of the following fields:

标识,所述标识包括以下之一:请求标识、项目标识、队列标识、路由标识、消息标识;An identifier, the identifier includes one of the following: a request identifier, an item identifier, a queue identifier, a routing identifier, and a message identifier;

创建时间。Creation time.

此处的创建时间字段可以用于存储创建元数据中各种数据对象的时间。The creation time field here can be used to store the creation time of various data objects in the metadata.

所述路由对象包括以下字段的至少之一:The routing object includes at least one of the following fields:

路由标识;routing identifier;

路由名称;route name;

项目名称;project name;

队列名称;queue name;

所述资源对象包括以下字段的至少之一:The resource object includes at least one of the following fields:

中间件的资源标识;The resource identifier of the middleware;

主机资源所在的节点位置;The node location where the host resource is located;

队列的资源信息;resource information of the queue;

服务资源所在的服务信息;Service information where the service resource is located;

端口信息。port information.

在一些实施例中,所述方法还包括:基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;根据所述消息记录和/或链路轨迹信息,进行信息处理。In some embodiments, the method further includes: based on the query request, querying the metadata to obtain message records and/or link track information of the message to be tracked; and, according to the message records and/or link track information, performing Information processing.

进行了追踪之后就会利用元数据记录各种追踪信息,后续可以基于查询请求查询所述元数据,从而获得所需的信息进行信息处理。After the tracking is performed, various tracking information is recorded using the metadata, and the metadata can be subsequently queried based on the query request to obtain the required information for information processing.

具体的如,所述根据所述消息记录和/或链路轨迹信息,进行信息处理,包括:根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。Specifically, the performing information processing according to the message record and/or the link track information includes: performing statistics on the number of messages in a project, unit time unit time, according to the message record and/or the link track information. Statistics on the number of transmitted messages, and evaluation of the service capability of the message server that processes the messages; at least one of faulty node location, faulty service location, and error cause location is performed according to the message record and/or link trajectory information .

如图4所示,本实施例提供一种消息处理装置,包括:As shown in FIG. 4 , this embodiment provides a message processing apparatus, including:

第一接收模块110,用于接收目标消息;a first receiving module 110, configured to receive a target message;

第一确定模块120,用于确定所述目标消息的项目信息;a first determining module 120, configured to determine item information of the target message;

传输模块130,用于根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。The transmission module 130 is configured to use the message queue corresponding to the item information to transmit the target message according to the item information and the message policy.

在一些实施例中,所述第一接收模块110、第一确定模块120及传输模块130均可为程序模块;所述程序模块被处理器执行后,能够实现前述的目标消息的接收、项目信息的确定及目标消息的传输等操作。In some embodiments, the first receiving module 110, the first determining module 120, and the transmitting module 130 can all be program modules; after the program modules are executed by the processor, they can realize the reception of the aforementioned target message, the project information The determination of the target message and the transmission of the target message.

在另一些实施例中,所述第一接收模块110、第一确定模块120及传输模块130可为软硬结合模块;所述软硬结合模块可包括各种可编程阵列,所述可编程阵列可为复杂可编程阵列或现场可编程阵列等。In other embodiments, the first receiving module 110 , the first determining module 120 and the transmitting module 130 may be software-hardware combination modules; the software-hardware combination modules may include various programmable arrays, the programmable arrays It can be a complex programmable array or a field programmable array, etc.

在还有一些实施例中,所述第一接收模块110、第一确定模块120及传输模块130可为纯硬件模块;所述纯硬件模块包括但不限于专用集成电路。In still other embodiments, the first receiving module 110, the first determining module 120 and the transmitting module 130 may be pure hardware modules; the pure hardware modules include but are not limited to application specific integrated circuits.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further includes:

第一获取模块,用于获取所述目标消息的属性信息;a first acquiring module, used for acquiring attribute information of the target message;

第二确定模块,用于根据所述属性信息,确定是否追踪所述目标消息;a second determining module, configured to determine whether to track the target message according to the attribute information;

记录模块,用于若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。A recording module, configured to record the message record and/or link track information of the target message into metadata if it is determined to track the target message.

在一些实施例中,所述第一获取模块,用于根据追踪模式,获取所述目标消息的属性信息。In some embodiments, the first obtaining module is configured to obtain attribute information of the target message according to a tracking mode.

在一些实施例中,所述第一获取模块,具体用于执行以下之一:In some embodiments, the first obtaining module is specifically configured to execute one of the following:

根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode;

根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode;

根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode.

在一些实施例中,所述第二确定模块,用于将所述属性信息与追踪设定的属性信息进行匹配;若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。In some embodiments, the second determining module is configured to match the attribute information with the attribute information set for tracking; if the matching is successful, determine the message record and/or link track information of the target message to be tracked .

在一些实施例中,所述记录模块,具体用于执行以下之一:In some embodiments, the recording module is specifically configured to execute one of the following:

在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata;

在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata;

在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further includes:

第三确定模块,用于根据所述属性信息,确定所述目标消息的追踪优先级;a third determining module, configured to determine the tracking priority of the target message according to the attribute information;

第四确定模块,用于根据所述追踪优先级,确定追踪所述目标消息的记录方式。The fourth determining module is configured to determine a recording method for tracking the target message according to the tracking priority.

在一些实施例中,所述记录方式包括以下至少之一:In some embodiments, the recording manner includes at least one of the following:

信息info方式;information info method;

错误error方式;error error method;

除错debug方式。Debug debug mode.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further includes:

切换模块,用于若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。A switching module, configured to switch the message queue and/or the middleware for message processing to a second cluster that is mutually backup with the first cluster if the first cluster where the message queue of the target message is located is abnormal.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further includes:

恢复模块,用于若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。The recovery module is configured to, if the first cluster is abnormal, recover the abnormal message of the project where the target message is located through the second cluster according to the recovery mechanism of the project where the target message is located.

在一些实施例中,所述元数据包括以下数据对象的至少之一:In some embodiments, the metadata includes at least one of the following data objects:

队列对象;queue object;

请求对象;request object;

路由对象;route object;

资源对象。resource object.

在一些实施例中,所述队列对象包括以下字段的至少之一:In some embodiments, the queue object includes at least one of the following fields:

消息标识、路由键、消息头、消息体、消息的生产者、消息的目的;Message ID, routing key, message header, message body, message producer, message purpose;

所述请求对象包括以下字段的至少之一:The request object includes at least one of the following fields:

标识,所述标识包括以下之一:请求标识、项目标识、队列标识、路由标识、消息标识;An identifier, the identifier includes one of the following: a request identifier, an item identifier, a queue identifier, a routing identifier, and a message identifier;

创建时间;creation time;

所述路由对象包括以下字段的至少之一:The routing object includes at least one of the following fields:

路由标识;routing identifier;

路由名称;route name;

项目名称;project name;

队列名称;queue name;

所述资源对象包括以下字段的至少之一:The resource object includes at least one of the following fields:

中间件的资源标识;The resource identifier of the middleware;

主机资源所在的节点位置;The node location where the host resource is located;

队列的资源信息;resource information of the queue;

服务资源所在的服务信息;Service information where the service resource is located;

端口信息。port information.

在一些实施例中,所述装置还包括:In some embodiments, the apparatus further includes:

查询模块,用于基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;a query module, configured to query the metadata to obtain the message record and/or link track information of the message to be tracked based on the query request;

处理模块,用于根据所述消息记录和/或链路轨迹信息,进行信息处理。A processing module, configured to perform information processing according to the message record and/or the link track information.

在一些实施例中,所述处理模块,用于执行以下至少之一:In some embodiments, the processing module is configured to perform at least one of the following:

根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;According to the message record and/or the link track information, carry out statistics of the number of messages of a project, statistics of the number of messages delivered per unit time, and evaluation of the service capability of the message server that processes the messages;

根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。According to the message record and/or the link track information, at least one of locating an erroneous node, locating an erroneous service, and locating an error cause is performed.

以下结合上述任意实施例提供几个具体示例:Several specific examples are provided below in conjunction with any of the above-mentioned embodiments:

示例1:Example 1:

本示例提出的一种消息队列的策略,是基于中间件技术和中间件的通知消息的能力联合使用的。A message queue strategy proposed in this example is based on the combined use of middleware technology and the ability of middleware to notify messages.

本示例提出的云平台消息策略的系统架构如图5所示,主要包括四部分,分别是云平台、消息策略、中间件、消息服务器。The system architecture of the cloud platform message strategy proposed in this example is shown in Figure 5, which mainly includes four parts, namely cloud platform, message strategy, middleware, and message server.

云平台是提供服务的平台,包含消费者(Consumer)、产生者(Producer)两个执行主体。A cloud platform is a platform that provides services, including two executive bodies: Consumer and Producer.

中间件,是封装消息在云平台和消息服务器传递接口层。Middleware is the interface layer that encapsulates messages between cloud platforms and message servers.

消息服务器,指提供消息存储转发的消息服务器。A message server refers to a message server that provides message storage and forwarding.

在初始化的过程中,首先云平台的服务启动,充当Consumer的角色,建立到消息服务器的通道,并通知消息服务器建立路由、队列等信息;然后监听对应的队列,此时服务启动完成了,可以提供服务。In the initialization process, first the cloud platform service starts, acts as the role of Consumer, establishes a channel to the message server, and notifies the message server to establish routing, queue and other information; Provide services.

当用户通过云平台发起请求的时候,客户端借助云平台中的生产者(Publisher)对象,向对应的服务队列发送消息。因此,当服务启动完成后,消息在上述框架中的流动过程,如图5的步骤;具体的步骤可如下:When a user initiates a request through the cloud platform, the client sends a message to the corresponding service queue with the help of the producer (Publisher) object in the cloud platform. Therefore, after the service startup is completed, the flow of messages in the above-mentioned framework is as shown in the steps in Figure 5; the specific steps can be as follows:

步骤1:生产者(Publisher)建立到消息服务器的连接,消息通过中间件接口;Step 1: The producer (Publisher) establishes a connection to the message server, and the message passes through the middleware interface;

步骤2:中间件基于消息策略进行消息处理的筛选;Step 2: The middleware filters the message processing based on the message policy;

步骤3:再发送给消息服务器;Step 3: Send to the message server again;

步骤4:消息服务器将消息通过路由之后压入到消息队列;Step 4: The message server pushes the message into the message queue after routing;

步骤5:云平台服务监听到队列中有消息到来,中间件将消息从消息队列拉取出来,会经过消息策略的筛选;Step 5: The cloud platform service listens to the arrival of a message in the queue, and the middleware pulls the message from the message queue, which will be filtered by the message policy;

步骤6,消息经过中间件的接口,最后传递到对应的云平台服务,由服务完成对消息的处理。In step 6, the message passes through the interface of the middleware and is finally transmitted to the corresponding cloud platform service, and the service completes the processing of the message.

本示例提出的消息策略的详细设计框架图,如图6所示。消息策略部分,以插件(Plugin)的方式,加入到Openstack框架等云平台中,这样可以兼容之前版本的消息使用方式,灵活方便。The detailed design frame diagram of the message strategy proposed in this example is shown in Figure 6. The message policy part is added to cloud platforms such as the Openstack framework in the form of plug-ins, so that it is compatible with the previous version of the message usage, which is flexible and convenient.

可配置的插件主要设计了两部分内容,元数据(Metadata)和策略(Policy)。The configurable plug-in is mainly designed with two parts, metadata and policy.

Metadata用于收集生产者、消费者连接中的元数据信息,并需要存储到可持久化存储中去。Metadata is used to collect metadata information in producer and consumer connections, and needs to be stored in persistent storage.

Policy用于设定策略,如指定项目或者指定队列或者指定服务等。Policy is used to set policies, such as specifying items or specifying queues or specifying services.

而上述两部分内容需要依据Openstack平台中的通知技术及本示例提出的追踪(Trace)插件的支持。依据这两项技术,是为了充分发掘有价值的信息,并实现消息的探索,从而能够分析出消费者的服务能力。The above two parts need to be based on the notification technology in the Openstack platform and the support of the Trace plug-in proposed in this example. Based on these two technologies, the purpose is to fully explore valuable information and realize the exploration of messages, so as to analyze the service capabilities of consumers.

通知技术是Openstack平台下的一项通知能力,能够记录用户操作行为,并分类进行。追踪(Trace)插件会根据用户设定的模式,将记录所有指定到模式行为的消息链路完整记录下来,包括消息的路由、路由键、发送队列、接发消息等。Notification technology is a notification capability under the Openstack platform, which can record user operation behavior and classify it. The Trace plug-in will record all message links specified to the pattern behavior according to the pattern set by the user, including message routing, routing keys, sending queues, sending and receiving messages, etc.

在本示例中,提出的Metadata的设计,包括4个对象,分别是队列(queue)、请求(request)、路由(router)、资源(resource),如图7所示。队列对象包括:Id消息id,routing_key消息路由键,headers消息头,body消息体,from_id消息的生产者,to_id接收的消息资源,type接收或者发送消息类型。In this example, the proposed Metadata design includes four objects, namely queue, request, router, and resource, as shown in Figure 7. Queue objects include: Id message id, routing_key message routing key, headers message header, body message body, producer of from_id message, message resource received by to_id, type received or sent message type.

request对象包括:id请求对象的唯一标志,这个值对应openstack项目中的请求id,如果没有的话,则随机生成,queue_id对应的队列id,对应queue对象中的id,msg_id消息中包含的消息唯一id,create_time请求的创建时间,这个值可以依据时间段对消息进行分析。The request object includes: the unique identifier of the id request object. This value corresponds to the request id in the openstack project. If not, it will be randomly generated. The queue id corresponding to queue_id corresponds to the id in the queue object, and the message unique id contained in the msg_id message. , the creation time of the create_time request, this value can analyze the message according to the time period.

router对象包括:id路由的唯一id,exchange_name路由名称,project_name项目名称,queue_name队列名称,有了这些设计,可以按照项目的内容,统计出队列资源的信息。The router object includes: the unique id of the id route, the exchange_name route name, the project_name project name, and the queue_name queue name. With these designs, the information of the queue resources can be counted according to the content of the project.

resource对象包括:id内部资源的id标志,host资源出现的节点位置,service资源所在的服务,port服务监听的端口,有了这个对象的设计,可以随时统计出消息的完整链路轨迹。The resource object includes: the id flag of the id internal resource, the node location where the host resource appears, the service where the service resource is located, and the port on which the port service listens. With the design of this object, the complete link trace of the message can be counted at any time.

本示例提出的policy的概念,是策略的核心内容。Policy可以根据用户的需求设定策略,设计为统计消息队列、追踪Notification的优先级、追踪指定项目的路由、追踪某一时间所有消息收发、查询消息链路、消息集群的主备切换。The concept of policy proposed in this example is the core content of the policy. Policy can be set according to the needs of users, and it is designed to count message queues, track the priority of Notifications, track the routing of specified items, track all messages sent and received at a certain time, query message links, and switch between active and standby message clusters.

本示例的具体实现步骤是根据用户设定的policy策略,然后统计出资源的metadata信息,再由元数据信息做出系统反应。在本示例中提到的policy的策略,是依据收集到的有价值信息进行处理,这些价值信息按照metadata设计的格式进行存储。The specific implementation steps of this example are to count the metadata information of the resource according to the policy policy set by the user, and then make a system response from the metadata information. The policy of the policy mentioned in this example is based on the collected valuable information, which is stored in the format designed by the metadata.

在本示例中,Policy中的统计消息队列,如图5所示,现有的技术方案是不包括消息策略部分的,即云平台中的服务在启动后,监听消息服务器中的队列,当有消息到达的时候,进行处理,这其中云平台有很多项目,并且各项目的服务也有很多。因此,消息服务器中的队列数目将会达到很多,显示不直观,用户无法直接确认各队列的所属情况。In this example, the statistical message queue in Policy, as shown in Figure 5, the existing technical solution does not include the message policy part, that is, after the service in the cloud platform is started, it listens to the queue in the message server. When the message arrives, it is processed. There are many projects on the cloud platform, and there are many services for each project. Therefore, the number of queues in the message server will reach a lot, the display is not intuitive, and the user cannot directly confirm the status of each queue.

本示例中提出的消息策略,主要实现是通过在元数据中的router对象进行记录,云平台中的服务,通过consumer对象,建立到消息队列的连接,进行初始化的工作,由云平台的服务发起建立队列、路由等信息的操作。由中间件从上下文中提取项目信息、路由信息、队列信息,记录到router对象的数据中,但是不会记录重复的数据,此时收集到的队列信息,就被保存在了metadata层,从而系统可以依据metadata的持久化数据存储,根据项目名称或者队列名称,查询到相应的信息,即系统可以具备划分队列的能力,使得消息的定位变得直观而简单。The message strategy proposed in this example is mainly implemented by recording the router object in the metadata. The service in the cloud platform establishes a connection to the message queue through the consumer object, and performs initialization work, which is initiated by the service of the cloud platform. Operations for establishing queues, routes, and other information. The middleware extracts project information, routing information, and queue information from the context, and records it in the data of the router object, but does not record duplicate data. The queue information collected at this time is saved in the metadata layer, so that the system According to the persistent data storage of metadata, according to the project name or queue name, the corresponding information can be queried, that is, the system can have the ability to divide the queue, making the positioning of the message intuitive and simple.

在本示例中,Policy中的追踪Notification的优先级,具体方案是根据Openstack项目设定的记录级别,包括info、error、debug等几个部分,用户可以自行设定策略,如error级别,这样可以收集到系统所有出错的消息记录,及完整的链路轨迹信息,这些轨迹通过本示例设计的trace模块完成,有了这些消息,用户可以快速查询消息出错的位置、出错的服务、找出根本原因。具体实现过程如下:In this example, the priority of tracking Notification in Policy is based on the record level set by the Openstack project, including info, error, debug and other parts. Users can set their own policies, such as the error level, so that All error message records in the system and complete link trace information are collected. These traces are completed by the trace module designed in this example. With these messages, users can quickly query the location of the error message, the service in error, and find out the root cause. . The specific implementation process is as follows:

Notification是云平台现有的通知消息的一种能力,并且可以按照消息的类型进行记录,比如错误操作的消息,会发送到错误记录队列,但是相关技术,只会在队列中存储消息的内容,并且由于其它原因造成的消息丢失,并不会进行记录或者告知。本示例设计的trace模块的执行者是中间件,设置了三种模式,包括项目、消息路由、队列名称3种模式,如果设定了项目模式,则会根据当前云平台的publisher对象发送的消息中的项目信息,与当前设定的trace项目进行对比,如果是,则继续后面的中间件内容的追踪,将publisher到消息服务器中的消息路由、消息队列、路由键、消息内容、消息的生产者、消息的接收者、收发情况等完整路径记录在metadata层中,反之,则不记录。Notification is an existing notification message capability of the cloud platform, and can be recorded according to the type of the message. For example, the message of the wrong operation will be sent to the error record queue, but the related technology will only store the content of the message in the queue. And messages lost due to other reasons will not be recorded or notified. The executor of the trace module designed in this example is middleware, and three modes are set, including three modes: project, message routing, and queue name. If the project mode is set, the message will be sent according to the publisher object of the current cloud platform. The project information in the file is compared with the currently set trace project. If so, continue to track the content of the middleware, and send the publisher to the message routing, message queue, routing key, message content, and message production in the message server. The complete path of the sender, the receiver of the message, and the sending and receiving status is recorded in the metadata layer, otherwise, it is not recorded.

如果设定的是队列模式,publisher对象发送的消息会分发到指定消息的队列,查看当前设定的trace队列和pulisher发送的消息队列是否一致,如果一致,则通过中间件,在metadata层中,提取消息的相关内容,包括消息内容,消息的生产者,消息的接收者,消息的收发情况,消息的所属项目等信息。If the queue mode is set, the message sent by the publisher object will be distributed to the queue of the specified message, and check whether the currently set trace queue and the message queue sent by the publisher are consistent. If they are consistent, then through the middleware, in the metadata layer, Extract the relevant content of the message, including the content of the message, the producer of the message, the receiver of the message, the sending and receiving of the message, and the project to which the message belongs.

如果设定的是队列路由模式,pulisher对象发送的消息,在消息服务器中,都会有对应的消息路由信息,通过这个路由信息和当前设置的trace队列路由是否相同,如果相同,则记录下所有通过这条路由的消息,并且记录消息的发送者、接收者、消息内容、消息的收发情况,反之,则不记录。If the queue routing mode is set, the messages sent by the pulisher object will have corresponding message routing information in the message server. Whether this routing information is the same as the currently set trace queue routing, if it is the same, record all the routing information that passes through The message of this route, and the sender, receiver, message content, and sending and receiving of the message are recorded. Otherwise, it is not recorded.

有了metadata层中对于消息的记录,用户可以查询消息出错的位置、出错的服务、找出根本原因。With the record of the message in the metadata layer, the user can query the location of the message error, the error service, and find out the root cause.

举例如下,在metadata中,根据trace的模式,特定的消息内容被记录在metadata的几个对象中,用户可以根据请求id或者消息的id,查询消息的链路及出错的服务位置。如用户查询指定消息的id,通过metadata中的request对象中的msg_id的内容,找到对应的queue对象,queue对象中记录消息的路由键、消息内容、消息来源id等信息,根据消息来源id,对应到resouce对象中的id,即可以找到消息的服务,从而得知服务所在的节点、端口等信息,便于定位问题。For example, in the metadata, according to the trace mode, the specific message content is recorded in several objects of the metadata, and the user can query the link of the message and the service location of the error according to the request id or the id of the message. For example, if the user queries the id of the specified message, the corresponding queue object is found through the content of msg_id in the request object in the metadata, and the routing key, message content, message source id and other information of the message are recorded in the queue object. According to the message source id, the corresponding To the id in the resource object, you can find the service of the message, so as to know the node, port and other information where the service is located, which is convenient for locating the problem.

在本示例中,Policy中的追踪某一时间所有消息的收发,这是根据trace模块,统计所有消息的收发及消息的链路,主要是用于统计系统的压力上限,便于架构师合理安排部署节点及服务。举例,在Openstack项目中,项目上线之前,需要做系统压力测试,这个功能就体现了用处,可以设计8个小时的时间维度的统计,所有经过消息服务器的消息都被记录下来,并且存储在metadata层的几个对象中,可以依据metadata的request对象中的create_time这个字段,做一个区间筛查,可以找到这个区间下消息的数量,并根据消息id,对应到metadata对象中的queue对象,得到来源id,再对应resource对象,找到对应的服务,从而得知项目的压力时间,压力位置等信息。In this example, Policy tracks the sending and receiving of all messages at a certain time. This is based on the trace module, which counts the sending and receiving of all messages and the link of messages. It is mainly used to count the upper limit of the pressure of the system, which is convenient for architects to make reasonable arrangements for deployment. Nodes and Services. For example, in the Openstack project, before the project goes live, a system stress test needs to be done. This function is useful. You can design 8-hour time-dimension statistics. All messages passing through the message server are recorded and stored in the metadata. Among several objects of the layer, you can perform an interval screening based on the create_time field in the request object of the metadata to find the number of messages in this interval, and according to the message id, correspond to the queue object in the metadata object to get the source id, and then corresponding to the resource object, find the corresponding service, so as to know the pressure time, pressure location and other information of the project.

在本示例中,Policy中的查询消息链路,指的是根据metadata层收集到的消息的记录,按照消息ID或者请求ID的方式,找到queue对象,并进一步根据消息的生产者id,找到resource对象中的服务信息,将这些信息呈现给用户,通过这个功能,可以方便用户定位请求出错的原因。In this example, the query message link in Policy refers to finding the queue object according to the message record collected by the metadata layer, according to the message ID or request ID, and further finding the resource according to the message producer ID The service information in the object is presented to the user. Through this function, it is convenient for the user to locate the cause of the request error.

在本示例中,Policy中的追踪指定项目的路由,根据metadata中的router对象,找到相关的路由信息,再通过trace模块监听这些路由消息,记录下消息中的内容、路由、队列、及相关的服务的信息,服务的内容记录在metadata层的resource对象中,有了这些数据可以实现对于项目的能力的检测、统计,可以为用户或者开发者提供有价值的分析数据,trace检测到的信息,可以按照时间序列进行大数据分析。以下举例说明具体的实现过程,设定追踪Openstack平台中nova项目的所有路由,trace模块会记录所有通过这个项目所有路由的消息链路,有了这些消息的内容,可以统计出nova项目核心服务的消息数量,可以量化为每小时多少条,有了这个数据,可以大致估算出服务的能力大小,体现为每个服务在单位时间内处理的请求条数。In this example, the route of the specified item is tracked in Policy, and the relevant routing information is found according to the router object in the metadata, and then these routing messages are monitored through the trace module, and the content, route, queue, and related information in the message are recorded. The information of the service and the content of the service are recorded in the resource object of the metadata layer. With this data, the ability detection and statistics of the project can be realized, and valuable analysis data can be provided for users or developers, and the information detected by trace, Big data analysis can be done in time series. The following example illustrates the specific implementation process. It is set to trace all the routes of the nova project in the Openstack platform. The trace module will record all the message links passing through all the routes of this project. With the content of these messages, the core services of the nova project can be counted. The number of messages can be quantified as how many messages per hour. With this data, the capacity of the service can be roughly estimated, which is reflected in the number of requests processed by each service per unit time.

最后,本示例提出,Policy中提供集群主备切换,在Openstack项目中,给消息队列集群划分多种资源池,互为主备,并且这些资源池的控制权交由policy负责,Openstack项目中的消息队列参数配置为集群的VIP地址,每当正在使用的集群出了问题,能够自动切换到备集群上,然后出问题的集群能够完成自我的修复,这些修复的能力依赖于一些监控脚本,等到集群恢复正常,又再次加入到被集群中,等待下次的继续使用。具体的实现方法如下:Finally, this example proposes that the policy provides cluster master-slave switching. In the Openstack project, the message queue cluster is divided into multiple resource pools, which are masters and backups of each other, and the control of these resource pools is handed over to the policy. The message queue parameter is configured as the VIP address of the cluster. Whenever there is a problem with the cluster in use, it can automatically switch to the standby cluster, and then the faulty cluster can complete self-repair. The ability of these repairs depends on some monitoring scripts. Wait until The cluster returns to normal, and it joins the cluster again, waiting for the next use. The specific implementation method is as follows:

在Openstack云平台项目中,每一个项目的服务,可以设置消息队列服务器的地址,本示例提出的方案,如图8所示,将消息服务器的地址,增加策略控制,将多个主备集群,用虚拟IP(Virtual Internet Protocol,VIP)地址设计,并且当云平台中的某一类服务出现了连接不上或者消息阻塞在某一个集群的情况下,能够实时切换到另一个集群,判定的方法是服务在启动过程中或者客户端在连接消息队列的过程中,出现的连接不上集群或者客户端在发送消息后超时(默认是等待60s),就认为服务连接的集群出现了问题。Policy策略能够实时检测出问题,并从集群中重新给服务分配一个集群,但是需要注意的是云平台之前与消息服务器的连接,由于切换集群,就需要重连接。但是之前集群中的队列的内容不需要同步过来,有以下几点原因:云平台上的项目存在retry机制,即丢失的消息,可以重复再发送;队列也不需要同步,重建连接的过程,即相当于服务重建的过程,会自动创建队列、路由等相关信息。除此之外,policy策略中需要清除上一个集群中的问题队列。以保证上一个集群,后续能够继续被循环使用。具体的清理方法,需要借助后端消息服务器的API接口。在图8中展示有集群1至集群n,一个项目的主备份中间件和消息队列,可以布置在集群1至集群n的任意两个集群上。In the Openstack cloud platform project, the service of each project can set the address of the message queue server. The solution proposed in this example, as shown in Figure 8, adds policy control to the address of the message server, and combines multiple active and standby clusters. It is designed with a virtual IP (Virtual Internet Protocol, VIP) address, and when a certain type of service in the cloud platform cannot be connected or the message is blocked in a certain cluster, it can switch to another cluster in real time. The method of determination If the service fails to connect to the cluster during the startup process or the client connects to the message queue, or the client times out after sending a message (the default is to wait for 60s), it is considered that there is a problem with the cluster connected to the service. The Policy policy can detect problems in real time and re-assign a cluster to the service from the cluster. However, it should be noted that the connection between the cloud platform and the message server needs to be reconnected due to cluster switching. However, the content of the queues in the previous cluster does not need to be synchronized for the following reasons: the project on the cloud platform has a retry mechanism, that is, lost messages can be sent repeatedly; the queue does not need to be synchronized, and the process of rebuilding the connection is It is equivalent to the process of service reconstruction, which will automatically create queues, routes and other related information. In addition, the policy policy needs to clear the problem queue in the previous cluster. In order to ensure that the previous cluster can continue to be recycled in the future. The specific cleaning method needs to use the API interface of the back-end message server. In Fig. 8, there are clusters 1 to n, the primary backup middleware and message queue of a project, which can be arranged on any two clusters from cluster 1 to cluster n.

本实施例提供一种消息处理设备,包括:This embodiment provides a message processing device, including:

存储器;memory;

处理器,与所述处理器连接,用于通过执行存储在所述存储器上的计算机可执行指令,能够实现前述任意技术方案提供的消息处理方法,例如,如图2、图3或图5所示的消息处理方法。A processor, connected to the processor, configured to implement the message processing method provided by any of the foregoing technical solutions by executing the computer-executable instructions stored in the memory, for example, as shown in FIG. 2 , FIG. 3 or FIG. 5 The message processing method shown.

本发明实施例提供了一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令;所述计算机可执行指令被处理器执行后,能够实现前述任意技术方案提供的消息处理方法,例如,能够执行图2、图3及图5所示的消息处理方法中的一个或多个。An embodiment of the present invention provides a computer storage medium, where computer-executable instructions are stored in the computer storage medium; after the computer-executable instructions are executed by a processor, the message processing method provided by any of the foregoing technical solutions can be implemented, for example, One or more of the message processing methods shown in FIG. 2 , FIG. 3 and FIG. 5 can be performed.

本实施例提供的计算机存储介质可为非瞬间存储介质。The computer storage medium provided in this embodiment may be a non-transitory storage medium.

在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.

上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各实施例中的各功能单元可以全部集成在一个处理模块中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may all be integrated into one processing module, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integration The unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute Including the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk and other various A medium on which program code can be stored.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention. should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (27)

1.一种消息处理方法,其特征在于,包括:1. a message processing method, is characterized in that, comprises: 接收目标消息;receive the target message; 确定所述目标消息的项目信息;determining item information of the target message; 根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。According to the item information and the message policy, the target message is transmitted by using the message queue corresponding to the item information. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, wherein the method further comprises: 获取所述目标消息的属性信息;obtain attribute information of the target message; 根据所述属性信息,确定是否追踪所述目标消息;According to the attribute information, determine whether to track the target message; 若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。If it is determined to track the target message, the message record and/or link track information of the target message is recorded in the metadata. 3.根据权利要求2所述的方法,其特征在于,所述获取所述目标消息的属性信息,包括:3. The method according to claim 2, wherein the acquiring the attribute information of the target message comprises: 根据追踪模式,获取所述目标消息的属性信息。According to the tracking mode, the attribute information of the target message is acquired. 4.根据权利要求3所述的方法,其特征在于,所述根据追踪模式,获取所述目标消息的属性信息,包括以下之一:4. The method according to claim 3, wherein the acquiring attribute information of the target message according to the tracking mode comprises one of the following: 根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode; 根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode; 根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode. 5.根据权利要求2所述的方法,其特征在于,所述根据所述属性信息,确定是否追踪所述目标消息,包括:5. The method according to claim 2, wherein the determining whether to track the target message according to the attribute information comprises: 将所述属性信息与追踪设定的属性信息进行匹配;matching the attribute information with the attribute information set by the tracking; 若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。If the matching is successful, it is determined to track the message record and/or link track information of the target message. 6.根据权利要求2至5任一项所述的方法,其特征在于,所述若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中,包括以下至少之一:6. The method according to any one of claims 2 to 5, wherein, if the target message is determined to be tracked, the message record and/or link track information of the target message is recorded in metadata , including at least one of the following: 在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata; 在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata; 在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata. 7.根据权利要求2至5任一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 2 to 5, wherein the method further comprises: 根据所述属性信息,确定所述目标消息的追踪优先级;determining the tracking priority of the target message according to the attribute information; 根据所述追踪优先级,确定追踪所述目标消息的记录方式。According to the tracking priority, a recording mode for tracking the target message is determined. 8.根据权利要求7所述的方法,其特征在于,8. The method of claim 7, wherein 所述记录方式包括以下至少之一:The recording method includes at least one of the following: 信息info方式;information info method; 错误error方式;error error method; 除错debug方式。Debug debug mode. 9.根据权利要求1所述的方法,其特征在于,所述方法还包括:9. The method of claim 1, wherein the method further comprises: 若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。If the first cluster where the message queue of the target message is located is abnormal, the message queue and/or the middleware for message processing is switched to the second cluster that is mutually backup with the first cluster. 10.根据权利要求9所述的方法,其特征在于,所述方法还包括:10. The method according to claim 9, wherein the method further comprises: 若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。If the first cluster is abnormal, according to the recovery mechanism of the project where the target message is located, the abnormal message of the project where the target message is located is recovered through the second cluster. 11.根据权利要求2至5任一项所述的方法,其特征在于,11. The method according to any one of claims 2 to 5, wherein, 所述元数据包括以下数据对象的至少之一:The metadata includes at least one of the following data objects: 队列对象;queue object; 请求对象;request object; 路由对象;route object; 资源对象。resource object. 12.根据权利要求11所述的方法,其特征在于,所述队列对象包括以下字段的至少之一:12. The method of claim 11, wherein the queue object includes at least one of the following fields: 消息标识、路由键、消息头、消息体、消息的生产者、消息的目的;Message ID, routing key, message header, message body, message producer, message purpose; 所述请求对象包括以下字段的至少之一:The request object includes at least one of the following fields: 标识,所述标识包括以下之一:请求标识、项目标识、队列标识、路由标识、消息标识;An identifier, the identifier includes one of the following: a request identifier, an item identifier, a queue identifier, a routing identifier, and a message identifier; 创建时间;creation time; 所述路由对象包括以下字段的至少之一:The routing object includes at least one of the following fields: 路由标识;routing identifier; 路由名称;route name; 项目名称;project name; 队列名称;queue name; 所述资源对象包括以下字段的至少之一:The resource object includes at least one of the following fields: 中间件的资源标识;The resource identifier of the middleware; 主机资源所在的节点位置;The node location where the host resource is located; 队列的资源信息;resource information of the queue; 服务资源所在的服务信息;Service information where the service resource is located; 端口信息。port information. 13.根据权利要求2至5任一项所述的方法,其特征在于,所述方法还包括:13. The method according to any one of claims 2 to 5, wherein the method further comprises: 基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;Based on the query request, query the metadata to obtain the message record and/or link track information of the message to be tracked; 根据所述消息记录和/或链路轨迹信息,进行信息处理。Information processing is performed according to the message record and/or the link trace information. 14.根据权利要求13所述的方法,其特征在于,14. The method of claim 13, wherein 所述根据所述消息记录和/或链路轨迹信息,进行信息处理,包括以下至少之一:The performing information processing according to the message record and/or the link track information includes at least one of the following: 根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;According to the message record and/or the link track information, carry out statistics of the number of messages of a project, statistics of the number of messages delivered per unit time, and evaluation of the service capability of the message server that processes the messages; 根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。According to the message record and/or the link track information, at least one of locating an erroneous node, locating an erroneous service, and locating an error cause is performed. 15.一种消息处理装置,其特征在于,包括:15. A message processing device, comprising: 第一接收模块,用于接收目标消息;a first receiving module, configured to receive a target message; 第一确定模块,用于确定所述目标消息的项目信息;a first determining module for determining item information of the target message; 传输模块,用于根据所述项目信息及消息策略,利用与所述项目信息对应的消息队列进行所述目标消息的传输。The transmission module is configured to use the message queue corresponding to the item information to transmit the target message according to the item information and the message policy. 16.根据权利要求15所述的装置,其特征在于,所述装置还包括:16. The apparatus of claim 15, wherein the apparatus further comprises: 第一获取模块,用于获取所述目标消息的属性信息;a first acquiring module, used for acquiring attribute information of the target message; 第二确定模块,用于根据所述属性信息,确定是否追踪所述目标消息;a second determining module, configured to determine whether to track the target message according to the attribute information; 记录模块,用于若确定追踪所述目标消息,将所述目标消息的消息记录和/或链路轨迹信息记录到元数据中。A recording module, configured to record the message record and/or link track information of the target message into metadata if it is determined to track the target message. 17.根据权利要求16所述的装置,其特征在于,所述第一获取模块,用于根据追踪模式,获取所述目标消息的属性信息。17 . The apparatus according to claim 16 , wherein the first obtaining module is configured to obtain attribute information of the target message according to a tracking mode. 18 . 18.根据权利要求17所述的装置,其特征在于,所述第一获取模块,具体用于执行以下之一:18. The apparatus according to claim 17, wherein the first obtaining module is specifically configured to execute one of the following: 根据项目模式,获取所述目标消息的项目信息;Obtain the item information of the target message according to the item mode; 根据路由模式,获取所述目标消息的路由信息;Obtain the routing information of the target message according to the routing mode; 根据队列模式,获取所述目标消息的队列信息。Obtain the queue information of the target message according to the queue mode. 19.根据权利要求16所述的装置,其特征在于,所述第二确定模块,用于将所述属性信息与追踪设定的属性信息进行匹配;若匹配成功,确定追踪所述目标消息的消息记录和/或链路轨迹信息。19 . The device according to claim 16 , wherein the second determining module is configured to match the attribute information with the attribute information set by tracking; if the matching is successful, determine whether to track the target message. 20 . Message records and/or link trace information. 20.根据权利要求16至19任一项所述的装置,其特征在于,所述记录模块,具体用于执行以下之一:20. The device according to any one of claims 16 to 19, wherein the recording module is specifically configured to execute one of the following: 在项目模式下,若确定追踪所述目标消息,将包含所述目标消息的路由信息、队列信息、路由键、消息内容、消息的生产者、消息的接收者、消息的收发情况信息的至少其中之一,记录到所述元数据中;In the project mode, if it is determined to track the target message, it will include at least one of the routing information, queue information, routing key, message content, message producer, message receiver, and message sending and receiving information of the target message. One, recorded in the metadata; 在路由模式下,若确定追踪所述目标消息,将包含所述目标消息的发送者、接收者、消息内容及消息收发情况信息的至少其中之一,记录到所述元数据中;In the routing mode, if it is determined to track the target message, at least one of the sender, receiver, message content and message sending and receiving information of the target message is recorded in the metadata; 在队列模式下,若确定追踪所述目标消息,将包含所述消息的消息内容、消息的生产者、消息的接收者、消息的收发情况信息、消息的项目信息的至少其中之一,记录到所述元数据中。In the queue mode, if it is determined to track the target message, it will include at least one of the message content of the message, the producer of the message, the receiver of the message, the information about the sending and receiving of the message, and the item information of the message. in the metadata. 21.根据权利要求16至19任一项所述的装置,其特征在于,所述装置还包括:21. The device according to any one of claims 16 to 19, wherein the device further comprises: 第三确定模块,用于根据所述属性信息,确定所述目标消息的追踪优先级;a third determining module, configured to determine the tracking priority of the target message according to the attribute information; 第四确定模块,用于根据所述追踪优先级,确定追踪所述目标消息的记录方式。The fourth determining module is configured to determine a recording method for tracking the target message according to the tracking priority. 22.根据权利要求15所述的装置,其特征在于,所述装置还包括:22. The apparatus of claim 15, wherein the apparatus further comprises: 切换模块,用于若所述目标消息的消息队列所在第一集群异常,将所述消息队列和/或进行消息处理的中间件切换到与所述第一集群互为备份的第二集群上。A switching module, configured to switch the message queue and/or the middleware for message processing to a second cluster that is mutually backup with the first cluster if the first cluster where the message queue of the target message is located is abnormal. 23.根据权利要求22所述的装置,其特征在于,所述装置还包括:23. The apparatus of claim 22, wherein the apparatus further comprises: 恢复模块,用于若所述第一集群异常,根据所述目标消息所在项目的恢复机制,将所述目标消息所在项目处理异常的消息通过所述第二集群进行恢复。The recovery module is configured to, if the first cluster is abnormal, recover the abnormal message of the project where the target message is located through the second cluster according to the recovery mechanism of the project where the target message is located. 24.根据权利要求16至19任一项所述的装置,其特征在于,所述装置还包括:24. The device according to any one of claims 16 to 19, wherein the device further comprises: 查询模块,用于基于查询请求,查询所述元数据获得待追踪消息的消息记录和/或链路轨迹信息;a query module, configured to query the metadata to obtain the message record and/or link track information of the message to be tracked based on the query request; 处理模块,用于根据所述消息记录和/或链路轨迹信息,进行信息处理。A processing module, configured to perform information processing according to the message record and/or the link track information. 25.根据权利要求24所述的装置,其特征在于,25. The apparatus of claim 24, wherein 所述处理模块,用于执行以下至少之一:The processing module is configured to execute at least one of the following: 根据所述消息记录和/或链路轨迹信息,进行一个项目的消息数量的统计、单位时间内传递的消息条数的统计、处理消息的消息服务器的服务能力的评估;According to the message record and/or the link track information, carry out statistics of the number of messages of a project, statistics of the number of messages delivered per unit time, and evaluation of the service capability of the message server that processes the messages; 根据所述消息记录和/或链路轨迹信息,进行错误节点定位、出错服务的定位、错误原因定位的至少其中之一。According to the message record and/or the link track information, at least one of locating an erroneous node, locating an erroneous service, and locating an error cause is performed. 26.一种消息处理设备,其特征在于,包括:26. A message processing device, comprising: 存储器;memory; 处理器,与所述处理器连接,用于通过执行存储在所述存储器上的计算机可执行指令,能够实现权利要求1至14任一项提供的方法。A processor, connected to the processor, configured to implement the method provided by any one of claims 1 to 14 by executing computer-executable instructions stored on the memory. 27.一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令;所述计算机可执行指令被处理器执行后,能够实现权利要求1至14任一项提供的方法。27. A computer storage medium storing computer-executable instructions; after the computer-executable instructions are executed by a processor, the method provided by any one of claims 1 to 14 can be implemented.
CN201910277493.6A 2019-04-08 2019-04-08 Message processing method and device, message processing equipment and storage medium Active CN111800354B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910277493.6A CN111800354B (en) 2019-04-08 2019-04-08 Message processing method and device, message processing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910277493.6A CN111800354B (en) 2019-04-08 2019-04-08 Message processing method and device, message processing equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111800354A true CN111800354A (en) 2020-10-20
CN111800354B CN111800354B (en) 2022-06-14

Family

ID=72805018

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910277493.6A Active CN111800354B (en) 2019-04-08 2019-04-08 Message processing method and device, message processing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111800354B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615759A (en) * 2020-12-17 2021-04-06 上海哔哩哔哩科技有限公司 Full link voltage measurement assembly, full link voltage measurement method and device
CN112637046A (en) * 2020-12-18 2021-04-09 北京房天下嘉居网络技术有限公司 Message pushing method and routing device
CN112738264A (en) * 2020-12-31 2021-04-30 网络通信与安全紫金山实验室 Message middleware message transmission method and device, computer equipment and storage medium
CN113467969A (en) * 2021-06-22 2021-10-01 上海星融汽车科技有限公司 Method for processing message accumulation
CN114726809A (en) * 2022-06-10 2022-07-08 北京沃丰时代数据科技有限公司 Multi-tenant routing method, device, equipment, storage medium and program product
CN115426209A (en) * 2022-11-07 2022-12-02 湖南三湘银行股份有限公司 High-reliability message queue broadcast control method based on message processing
CN115550305A (en) * 2022-09-28 2022-12-30 深圳市凯迪仕智能科技股份有限公司 Equipment control method and related device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140215443A1 (en) * 2013-01-28 2014-07-31 Rackspace Us, Inc. Methods and Systems of Distributed Tracing
CN106533893A (en) * 2015-09-09 2017-03-22 腾讯科技(深圳)有限公司 Message processing method and system
CN106878473A (en) * 2017-04-20 2017-06-20 腾讯科技(深圳)有限公司 A kind of message treatment method, server cluster and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140215443A1 (en) * 2013-01-28 2014-07-31 Rackspace Us, Inc. Methods and Systems of Distributed Tracing
CN106533893A (en) * 2015-09-09 2017-03-22 腾讯科技(深圳)有限公司 Message processing method and system
CN106878473A (en) * 2017-04-20 2017-06-20 腾讯科技(深圳)有限公司 A kind of message treatment method, server cluster and system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615759A (en) * 2020-12-17 2021-04-06 上海哔哩哔哩科技有限公司 Full link voltage measurement assembly, full link voltage measurement method and device
CN112615759B (en) * 2020-12-17 2023-03-31 上海哔哩哔哩科技有限公司 Full link voltage measurement assembly, full link voltage measurement method and device
CN112637046A (en) * 2020-12-18 2021-04-09 北京房天下嘉居网络技术有限公司 Message pushing method and routing device
CN112738264A (en) * 2020-12-31 2021-04-30 网络通信与安全紫金山实验室 Message middleware message transmission method and device, computer equipment and storage medium
CN113467969A (en) * 2021-06-22 2021-10-01 上海星融汽车科技有限公司 Method for processing message accumulation
CN113467969B (en) * 2021-06-22 2024-01-23 上海星融汽车科技有限公司 Method for processing message accumulation
CN114726809A (en) * 2022-06-10 2022-07-08 北京沃丰时代数据科技有限公司 Multi-tenant routing method, device, equipment, storage medium and program product
CN115550305A (en) * 2022-09-28 2022-12-30 深圳市凯迪仕智能科技股份有限公司 Equipment control method and related device
CN115550305B (en) * 2022-09-28 2024-03-01 深圳市凯迪仕智能科技股份有限公司 Equipment control method and related device
CN115426209A (en) * 2022-11-07 2022-12-02 湖南三湘银行股份有限公司 High-reliability message queue broadcast control method based on message processing
CN115426209B (en) * 2022-11-07 2023-02-10 湖南三湘银行股份有限公司 High-reliability message queue broadcast control method based on message processing

Also Published As

Publication number Publication date
CN111800354B (en) 2022-06-14

Similar Documents

Publication Publication Date Title
CN111800354B (en) Message processing method and device, message processing equipment and storage medium
JP6835444B2 (en) Software-defined data center and service cluster scheduling method and traffic monitoring method for that purpose
CN105024855B (en) Distributed type assemblies manage system and method
CN105959151B (en) A kind of Stream Processing system and method for High Availabitity
KR101908465B1 (en) Fault management method, entity and system
JP5033856B2 (en) Devices and systems for network configuration assumptions
WO2015154246A1 (en) Fault handling method, device and system based on network function virtualization
CN106933659B (en) Method and apparatus for managing processes
CN108234301B (en) Data link switching method and device
CN105165054A (en) Network service troubleshooting method, service management system and system management module
CN112218321B (en) Master-slave link switching method, device, communication equipment and storage medium
US20190155632A1 (en) Self-managed virtual networks and services
CN109960634A (en) A kind of method for monitoring application program, apparatus and system
CN100426751C (en) Method for ensuring accordant configuration information in cluster system
US20250254121A1 (en) Device management method, device, system, and storage medium
WO2019141089A1 (en) Network alarm method, device, system and terminal
CN108512753B (en) Method and device for transmitting messages in cluster file system
CN103036716A (en) Method and system for link switchover
CN114363144A (en) Distributed system-oriented fault information association reporting method and related equipment
CN116668269A (en) Arbitration method, device and system for active-active data centers
CN101350735A (en) A Method of Alarm Synchronization
Mendiratta et al. How reliable is my software-defined network? Models and failure impacts
CN118900234A (en) Storage volume mounting method and device
CN115834517A (en) Fault isolation method, device, switch and storage medium
CN107846292B (en) Method and device for preventing fault processing delay

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