CN102955717A - Message management equipment and method in distributed message processing system - Google Patents

Message management equipment and method in distributed message processing system Download PDF

Info

Publication number
CN102955717A
CN102955717A CN2012104363857A CN201210436385A CN102955717A CN 102955717 A CN102955717 A CN 102955717A CN 2012104363857 A CN2012104363857 A CN 2012104363857A CN 201210436385 A CN201210436385 A CN 201210436385A CN 102955717 A CN102955717 A CN 102955717A
Authority
CN
China
Prior art keywords
message
information
processing device
storage
request
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
CN2012104363857A
Other languages
Chinese (zh)
Other versions
CN102955717B (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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201210436385.7A priority Critical patent/CN102955717B/en
Publication of CN102955717A publication Critical patent/CN102955717A/en
Application granted granted Critical
Publication of CN102955717B publication Critical patent/CN102955717B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种在分布式消息处理系统中的消息管理设备和方法。其中消息管理方法包括:接收消息处理设备发送的消息处理请求,所述消息处理请求至少包括所请求处理消息的主题;查询与所述消息处理请求中的主题相对应的存储分区信息,并将所查询到的存储分区信息发送给相应消息处理设备;以及处理来自消息处理设备的消息位置查询请求,查询与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理消息的位置信息、并发送给相应消息处理设备;以及处理来自消息处理设备的消息位置更新请求,基于所述消息位置更新请求中的消息大小,更新与所述消息位置更新请求中的存储分区相对应的存储分区的当前要处理消息的位置信息。

The invention discloses a message management device and method in a distributed message processing system. The message management method includes: receiving a message processing request sent by a message processing device, where the message processing request includes at least the subject of the message to be processed; querying storage partition information corresponding to the subject in the message processing request, and storing the message Send the queried storage partition information to the corresponding message processing device; and process the message location query request from the message processing device, and query the location information of the storage partition corresponding to the storage partition in the message location query request to be processed currently, and send it to the corresponding message processing device; and process the message location update request from the message processing device, based on the message size in the message location update request, update the storage partition corresponding to the storage partition in the message location update request The location information of the current message to be processed.

Description

在分布式消息处理系统中的消息管理设备和方法Message management device and method in distributed message processing system

技术领域technical field

本发明涉及消息处理领域,具体涉及一种在分布式消息处理系统中的消息管理设备和方法。The invention relates to the field of message processing, in particular to a message management device and method in a distributed message processing system.

背景技术Background technique

目前用于消息(如日志)处理的消息系统有很多,比较流行的是分布式消息系统。分布式消息系统的具体形式有很多,如Spread、Kafka等。There are many message systems currently used for message (such as log) processing, and the more popular one is the distributed message system. There are many specific forms of distributed message systems, such as Spread and Kafka.

下面仅以常用的一种分布式消息系统Kafka为例进行说明。The following only uses Kafka, a commonly used distributed message system, as an example for illustration.

Kafka是用于日志处理的分布式消息系统,主要针对日志数据容量大,但对可靠性要求不是很高的业务。这些系统中的日志数据主要包括用户行为,例如,登录、浏览、点击、分享以及喜欢等,还包括系统运行日志,例如,CPU(Central Processing Unit,中央处理器)、内存、磁盘、网络、系统及进程等的运行状态。Kafka is a distributed message system for log processing, mainly for businesses with large log data capacity but low reliability requirements. The log data in these systems mainly includes user behavior, such as login, browsing, click, share, and like, etc., and also includes system operation logs, such as CPU (Central Processing Unit, central processing unit), memory, disk, network, system and the running status of the process, etc.

图1为相关技术中Kafka系统架构示意图。该Kafka系统包括以下四个角色:Producer(消息产生者,简称PD)11、Broker(简称BK)12、Consumer(消息处理者,简称CS)13以及Zookeeper(管理者,简称ZK)14,每个角色都可以是多个。Consumer 13在Kafka系统中负责处理消息;Producer 11在Kafka系统中负责产生消息;Broker12是Kafka系统中用来存放消息的地方,负责接收Producer 11发来的消息,当Consumer 13有请求时,将这些消息返回给Consumer13;ZooKeeper 14是一个开放源码的分布式应用程序协调服务,包含一个简单的原语集,是Hadoop和Hbase的重要组件,分布式应用可以使用它来实现诸如:统一命名服务、配置管理、分布式锁服务、集群管理等功能。Producer 11发送消息到Broker12,消息持久化存储在Broker12上,Consumer 13再从Broker12取得消息进行处理。Zookeeper 14用来存储Producer 11,Consumer 13,与Broker12的一些状态信息。FIG. 1 is a schematic diagram of the Kafka system architecture in the related art. The Kafka system includes the following four roles: Producer (message producer, referred to as PD) 11, Broker (abbreviated as BK) 12, Consumer (message processor, referred to as CS) 13 and Zookeeper (manager, referred to as ZK) 14, each There can be multiple roles. Consumer 13 is responsible for processing messages in the Kafka system; Producer 11 is responsible for generating messages in the Kafka system; Broker 12 is a place for storing messages in the Kafka system, and is responsible for receiving messages from Producer 11. When Consumer 13 has a request, these The message is returned to Consumer13; ZooKeeper 14 is an open source distributed application coordination service, which includes a simple set of primitives and is an important component of Hadoop and Hbase. Distributed applications can use it to implement such as: unified naming service, configuration Management, distributed lock service, cluster management and other functions. Producer 11 sends a message to Broker 12, and the message is persistently stored on Broker 12, and Consumer 13 obtains the message from Broker 12 for processing. Zookeeper 14 is used to store some status information of Producer 11, Consumer 13, and Broker 12.

Kafka系统对消息的处理是采用pull(拉)的方式,每次由Consumer 13从Broker 12上获取要处理的消息。成功处理的消息的位置Offset由Consumer13来保存。The Kafka system processes messages in a pull (pull) manner, and Consumer 13 obtains messages to be processed from Broker 12 each time. The position Offset of successfully processed messages is saved by Consumer13.

在上述消息处理方式中,Consumer 13需要自己对成功处理的消息的位置Offset进行管理、保存,Offset一般保存在Consumer 13所属的消息处理设备的内存或者本地磁盘上,当消息处理设备意外终止或者机器磁盘坏掉后,之前保存的Offset就丢失了。当重新启动消息处理设备后,将从最近一次保存的Offset、或者从头开始消费,Consumer 13无法紧接上次成功处理的消息的位置继续对消息进行处理。In the above message processing method, Consumer 13 needs to manage and save the position Offset of successfully processed messages by itself. Offset is generally stored in the memory or local disk of the message processing device to which Consumer 13 belongs. When the message processing device terminates unexpectedly or the machine After the disk is broken, the previously saved Offset is lost. When the message processing device is restarted, it will consume from the last saved Offset or from the beginning, and Consumer 13 cannot continue to process the message immediately after the last successfully processed message.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的在分布式消息处理系统中的消息管理设备和方法。In view of the above problems, the present invention is proposed to provide a message management device and method in a distributed message processing system that overcomes the above problems or at least partially solves the above problems.

依据本发明的一个方面,提供了一种在分布式消息处理系统中的消息管理设备,该分布式消息处理系统还包括一个或多个消息存储设备和一个或多个消息处理设备,其中每条消息具有相应的主题,消息存储设备为相应主题建立一个或者多个存储分区,并且根据消息的主题将消息存储在相应主题的存储分区之一中,消息管理设备包括:消息分布状态存储器,被配置为至少存储每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息;传输接口,被配置为接收消息处理设备发送的消息处理请求,消息处理请求至少包括所请求处理消息的主题;分区状态查询器,被配置为在消息分布状态存储器中查询与消息处理请求中的主题相对应的存储分区信息,并经由传输接口将所查询到的存储分区信息发送给相应消息处理设备;以及消息位置管理器,被配置为处理通过传输接口接收的、来自消息处理设备的消息位置查询请求,从消息分布状态存储器中获取与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理消息的位置信息、并经由传输接口发送给相应消息处理设备;以及被配置为处理通过传输接口接收的、来自消息处理设备的消息位置更新请求,基于消息位置更新请求中的消息大小,更新消息分布状态存储器中、与消息位置更新请求中的存储分区相对应的存储分区的当前要处理消息的位置信息。According to one aspect of the present invention, a message management device in a distributed message processing system is provided, and the distributed message processing system further includes one or more message storage devices and one or more message processing devices, each of which The message has a corresponding topic, and the message storage device establishes one or more storage partitions for the corresponding topic, and stores the message in one of the storage partitions of the corresponding topic according to the topic of the message. The message management device includes: a message distribution state storage, configured In order to store at least information about storage partitions in each message storage device and location information about messages currently to be processed by the message processing device in each storage partition; the transmission interface is configured to receive a message processing request sent by the message processing device, The message processing request at least includes the topic of the requested processing message; the partition status queryer is configured to query the storage partition information corresponding to the topic in the message processing request in the message distribution state storage, and send the query information via the transmission interface The storage partition information is sent to the corresponding message processing device; and the message location manager is configured to process the message location query request received from the message processing device through the transmission interface, and obtain the information contained in the message location query request from the message distribution state storage. The location information of the storage partition corresponding to the storage partition currently to be processed is sent to the corresponding message processing device via the transmission interface; and is configured to process the message location update request received through the transmission interface from the message processing device, based on The message size in the message location update request updates the location information of the message currently to be processed in the storage partition corresponding to the storage partition in the message location update request in the message distribution state memory.

可选的,消息分布状态存储器中还存储有消息处理设备每次所要处理的消息的大小;分区状态查询器还被配置为在消息分布状态存储器中查询相应消息处理设备所要处理的消息的大小,并通过传输接口发送给相应消息处理设备。Optionally, the message distribution state memory also stores the size of the message to be processed by the message processing device each time; the partition state queryer is also configured to query the message distribution state memory for the size of the message to be processed by the corresponding message processing device, And send it to the corresponding message processing device through the transmission interface.

根据本发明的另一个方面,还提供了一种消息管理方法,该方法适于在分布式消息处理系统中的消息管理设备上执行,该分布式消息处理系统还包括一个或多个消息存储设备和一个或多个消息处理设备,其中每条消息具有相应的主题,消息存储设备为相应主题建立一个或者多个存储分区,并且根据消息的主题将消息存储在相应主题的存储分区之一中,消息管理方法包括:接收消息处理设备发送的消息处理请求,消息处理请求至少包括所请求处理消息的主题;查询与消息处理请求中的主题相对应的存储分区信息,并将所查询到的存储分区信息发送给相应消息处理设备,其中,消息管理设备中至少存储每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息;以及处理来自消息处理设备的消息位置查询请求,查询与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理消息的位置信息、并发送给相应消息处理设备;以及处理来自消息处理设备的消息位置更新请求,基于消息位置更新请求中的消息大小,更新与消息位置更新请求中的存储分区相对应的存储分区的当前要处理消息的位置信息。According to another aspect of the present invention, there is also provided a message management method, which is suitable for execution on a message management device in a distributed message processing system, and the distributed message processing system further includes one or more message storage devices and one or more message processing devices, wherein each message has a corresponding topic, the message storage device establishes one or more storage partitions for the corresponding topic, and stores the message in one of the storage partitions of the corresponding topic according to the topic of the message, The message management method includes: receiving a message processing request sent by a message processing device, where the message processing request includes at least the subject of the message to be processed; querying storage partition information corresponding to the topic in the message processing request, and storing the queried storage partition The information is sent to the corresponding message processing device, wherein, the message management device at least stores the information about the storage partition in each message storage device, and the location information of the message currently to be processed by the message processing device in each storage partition; and processes information from The message location query request of the message processing device, querying the location information of the current message to be processed in the storage partition corresponding to the storage partition in the message location query request, and sending it to the corresponding message processing device; and processing the message from the message processing device The location update request, based on the message size in the message location update request, updates the current location information of the message to be processed in the storage partition corresponding to the storage partition in the message location update request.

可选的,上述消息管理方法还包括:查询相应消息处理设备所要处理的消息的大小、并发送给相应消息处理设备,其中消息管理设备中还存储有消息处理设备每次所要处理的消息的大小。Optionally, the above message management method further includes: querying the size of the message to be processed by the corresponding message processing device and sending it to the corresponding message processing device, wherein the message management device also stores the size of the message to be processed by the message processing device each time .

本发明的技术方案在消息管理设备上存储有每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息,当消息处理设备获取要处理的消息时,只需从消息管理设备查询消息处理设备处理的主题下的消息在消息存储设备上的存储分区信息,以及消息处理设备在相应的存储分区的当前要处理的消息的位置信息,即可发送请求消息从消息存储设备获取消息进行处理,这样,即使消息处理设备发生故障,在消息处理设备恢复正常后,仍然可以紧接上次成功处理消息的位置获取消息进行处理,避免了消息的重复处理或遗漏。In the technical solution of the present invention, the message management device stores information about the storage partitions in each message storage device and the location information of the messages currently to be processed by the message processing device in each storage partition. When receiving a message, you only need to query the storage partition information on the message storage device for the message under the topic processed by the message processing device from the message management device, and the location information of the message currently to be processed by the message processing device in the corresponding storage partition, that is, A request message can be sent to obtain a message from the message storage device for processing. In this way, even if the message processing device fails, after the message processing device returns to normal, it can still obtain the message for processing at the position where the message was successfully processed last time, avoiding message corruption. Duplicate processing or omission.

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

附图说明Description of drawings

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

图1示出了一种Kafka系统架构示意图;Fig. 1 shows a schematic diagram of a Kafka system architecture;

图2示出了根据本发明一个实施例的分布式消息处理系统的示意图;Fig. 2 shows a schematic diagram of a distributed message processing system according to an embodiment of the present invention;

图3示出了根据本发明一个实施例的消息存储设备内部存储结构的示意图;Fig. 3 shows a schematic diagram of an internal storage structure of a message storage device according to an embodiment of the present invention;

图4示出了根据本发明一个实施例的消息管理方法的流程图;以及Fig. 4 shows the flowchart of the message management method according to one embodiment of the present invention; And

图5示出了根据本发明一个实施例的消息处理方法的流程图。Fig. 5 shows a flowchart of a message processing method according to an embodiment of the present invention.

具体实施方式Detailed ways

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

图2示出了根据本发明一个实施例的分布式消息处理系统的示意图。如图所示,该分布式消息处理系统包括消息产生设备100、消息存储设备200、消息处理设备300和消息管理设备400。消息产生设备100、消息存储设备200和消息处理设备300分别可以为一个或多个,图2中仅示例性给出了两个消息产生设备100、两个消息存储设备200,以及一个消息处理设备300和一个消息管理设备400,本领域技术人员可以理解,本发明实施例对消息产生设备100、消息存储设备200、消息处理设备300和消息管理设备400的数目并没有限制。Fig. 2 shows a schematic diagram of a distributed message processing system according to an embodiment of the present invention. As shown in the figure, the distributed message processing system includes a message generating device 100 , a message storage device 200 , a message processing device 300 and a message management device 400 . There may be one or more message generating devices 100, message storage devices 200, and message processing devices 300 respectively, and only two message generating devices 100, two message storage devices 200, and one message processing device are shown in FIG. 300 and one message management device 400, those skilled in the art can understand that the embodiment of the present invention does not limit the number of message generation device 100, message storage device 200, message processing device 300 and message management device 400.

消息产生设备100可以是网络设备、服务器、计算机或其它可以产生消息的任何设备,这里的消息可以是任何种类信息的数据,如日志数据。每条消息具有相应的主题,如该主题可以是某种具体的用户行为,如登录行为、浏览行为、点击行为、分享行为或者喜欢行为等,又如该主题可以是某种具体的系统运行日志,如CPU、内存、磁盘、网络、系统及进程的运行状态等。例如,在一个实施例中,消息产生设备100为网络服务器,在用户浏览该网络服务器的某网络页面时,该网络服务器随之产生一条主题为浏览该网络页面的消息。The message generating device 100 may be a network device, a server, a computer or any other device capable of generating messages, where the messages may be any kind of information data, such as log data. Each message has a corresponding topic. For example, the topic can be a specific user behavior, such as login behavior, browsing behavior, click behavior, sharing behavior, or liking behavior, and the topic can be a specific system operation log. , such as CPU, memory, disk, network, system and process running status, etc. For example, in one embodiment, the message generating device 100 is a web server. When a user browses a web page of the web server, the web server generates a message with the subject of browsing the web page.

在消息产生设备100产生消息后,将产生的消息发送给消息存储设备200。消息产生设备100向消息存储设备200发送消息时,可以随机发送,也可以根据用户指定的回调函数进行发送。消息产生设备100将产生的消息发送给消息存储设备200的一个示例代码如下:After the message generation device 100 generates a message, it sends the generated message to the message storage device 200 . When the message generation device 100 sends a message to the message storage device 200, it may send a message randomly, or may send a message according to a callback function specified by the user. An example code for the message generating device 100 to send the generated message to the message storage device 200 is as follows:

$zkCluster=′localhost:2181′;$zkCluster = 'localhost:2181';

$msg=array′message content′);$msg=array 'message content');

$topic=′test′;$topic = 'test';

$Producer=new Kafka_Producer($zkCluster);$Producer = new Kafka_Producer($zkCluster);

$Producer->send(array($msg),$topic′);$Producer->send(array($msg), $topic');

本领域技术人员可以理解,以上传递消息的代码仅仅是一个示例,任何可以实现将消息产生设备100产生的消息发送到消息存储设备200的代码实现都在本发明的保护范围内。Those skilled in the art can understand that the above message transfer code is just an example, and any code implementation that can realize sending the message generated by the message generating device 100 to the message storage device 200 is within the protection scope of the present invention.

消息存储设备200接收到消息产生设备100发送的消息后,将接收到的消息进行存储。消息存储设备200有多种具体的存储方式,例如,消息存储设备200按照消息的主题进行存储。具体而言,可以为每个消息主题建立一个或多个存储分区,将接收到的每条消息存储在相应主题的存储分区之一中。After receiving the message sent by the message generating device 100, the message storage device 200 stores the received message. The message storage device 200 has multiple specific storage methods. For example, the message storage device 200 stores messages according to the subject of the message. Specifically, one or more storage partitions may be established for each message topic, and each received message is stored in one of the storage partitions of the corresponding topic.

为了更好的介绍消息存储设备200的内部存储结构,请同时参看图3,其为根据本发明一个实施例的消息存储设备200内部存储结构的示意图。在图3中,示出了第一消息存储设备2001、第二消息存储设备2002和第三消息存储设备2003,以及每个消息存储设备内部的消息存储路径。此外,还示出了与这些消息存储设备进行信息交互的第一消息产生设备1001和第二消息产生设备1002,以及第一消息处理设备3001和第二消息处理设备3002。In order to better introduce the internal storage structure of the message storage device 200, please also refer to FIG. 3, which is a schematic diagram of the internal storage structure of the message storage device 200 according to an embodiment of the present invention. In Fig. 3, the first message storage device 2001, the second message storage device 2002 and the third message storage device 2003, and the message storage path inside each message storage device are shown. In addition, the first message generating device 1001 and the second message generating device 1002 that perform information interaction with these message storage devices, and the first message processing device 3001 and the second message processing device 3002 are also shown.

第一消息产生设备1001和第二消息产生设备1002产生的主题为Topicl以及Topic2的消息,会被发送到可以用来存储Topicl的消息和Topic2的消息的第一消息存储设备2001、第二消息存储设备2002和第三消息存储设备2003。The topics generated by the first message generating device 1001 and the second message generating device 1002 are Topic1 and Topic2 messages, which will be sent to the first message storage device 2001 and the second message storage device which can be used to store the messages of Topic1 and Topic2. device 2002 and a third message storage device 2003.

因为分布式消息处理系统基于消息的主题(Topic)来进行消息管理,所以相应的,在消息存储设备中也是基于Topic来进行存储的。每个Topic的消息可以存储在一个或多个存储分区(Partition)中,当存储在多个存储分区时,这些多个存储分区可以位于一个消息存储设备上,也可以位于多个消息存储设备上。在图3中,主题为Topicl的消息存储在第一消息存储设备2001中Topicl下的存储分区partl和存储分区part2、第二消息存储设备2002中Topicl下的存储分区partl和存储分区part2,以及第三消息存储设备2003中Topicl下的存储分区partl。主题为Topic2的消息存储在第一消息存储设备2001中Topic2下的存储分区partl、第二消息存储设备2002中Topic2下的存储分区partl,以及第三消息存储设备2003中Topic2下的存储分区partl。其中每个存储分区具有多条消息,每条消息相对于存储分区头部具有不同的位置。例如,根据本发明的一个实施例,每条消息都具有消息id,消息id由其逻辑位置决定,即从消息id可直接定位到消息的存储位置,避免id到存储位置的额外映射。Because the distributed message processing system performs message management based on the topic (Topic) of the message, correspondingly, the message storage device also stores the message based on the Topic. The messages of each Topic can be stored in one or more storage partitions (Partition). When stored in multiple storage partitions, these multiple storage partitions can be located on one message storage device or on multiple message storage devices. . In Fig. 3, the subject is Topic1 message and is stored in storage partition part1 and storage partition part2 under Topic1 in the first message storage device 2001, storage partition part1 and storage partition part2 under Topic1 in the second message storage device 2002, and the first message storage device 2002. Three storage partitions part1 under Topic1 in the message storage device 2003. Messages with topic Top2 are stored in the storage partition part1 under Topic2 in the first message storage device 2001 , the storage partition part1 under Topic2 in the second message storage device 2002 , and the storage partition part1 under Topic2 in the third message storage device 2003 . Each bucket has multiple messages, and each message has a different position relative to the header of the bucket. For example, according to an embodiment of the present invention, each message has a message id, and the message id is determined by its logical location, that is, the storage location of the message can be directly located from the message id, avoiding additional mapping from the id to the storage location.

上面通过图3详细介绍了图2中消息存储设备200的一种内部存储结构,下面再回到图2所示的实施例。消息存储设备200在存储其接收的消息后,可以将每次有关存储分区更新的信息发送给消息管理设备400,由消息管理设备400保存。An internal storage structure of the message storage device 200 in FIG. 2 has been introduced in detail through FIG. 3 above, and the following will return to the embodiment shown in FIG. 2 . After the message storage device 200 stores the received messages, it can send the information about each update of the storage partition to the message management device 400 for storage by the message management device 400 .

以上介绍了一个实施例中的消息产生设备100和消息存储设备200,下面结合对某个主题下的消息的具体处理过程,继续介绍消息处理设备300和消息管理设备400。由于消息处理设备300中的各部件和消息管理设备400中的各部件信息交互较多,因此下面先概括介绍消息处理设备300中所包括的各部件,以及消息管理设备400包括的各部件,然后在具体信息交互过程中对涉及到的各部件再进行更详细的介绍。The message generation device 100 and the message storage device 200 in an embodiment have been introduced above, and the message processing device 300 and the message management device 400 will continue to be introduced below in conjunction with the specific processing of messages under a certain topic. Since each component in the message processing device 300 and each component in the message management device 400 interact with each other more information, the following first briefly introduces each component included in the message processing device 300 and each component included in the message management device 400, and then In the process of specific information interaction, the various components involved will be introduced in more detail.

消息处理设备300包括传输接口304、存储信息获取器302、消息位置管理器306和消息获取器308,消息管理设备400包括传输接口404、消息分布状态存储器402、分区状态查询器406和消息位置管理器408。The message processing device 300 includes a transmission interface 304, a storage information acquirer 302, a message location manager 306, and a message acquirer 308, and the message management device 400 includes a transmission interface 404, a message distribution state storage 402, a partition status queryer 406, and a message location management device 408.

当消息处理设备300需要处理某个Topic的消息时,首先通过消息处理设备300的存储信息获取器302生成消息处理请求,该消息处理请求至少包括消息处理设备300所请求处理消息的主题,然后通过消息处理设备300的传输接口304将消息处理请求传送给消息管理设备400的传输接口404。When the message processing device 300 needs to process the message of a certain Topic, it first generates a message processing request through the storage information acquirer 302 of the message processing device 300, and the message processing request includes at least the subject of the message processing device 300 requested to process the message, and then passes The transmission interface 304 of the message processing device 300 transmits the message processing request to the transmission interface 404 of the message management device 400 .

消息管理设备400的传输接口404接收到来自消息处理设备300的消息处理请求后,将该消息处理请求发送给分区状态查询器406,然后分区状态查询器406在消息分布状态存储器402中查询与该消息处理请求中的主题相对应的一个或多个存储分区信息。After the transmission interface 404 of the message management device 400 receives the message processing request from the message processing device 300, it sends the message processing request to the partition state queryer 406, and then the partition state queryer 406 queries the message distribution state memory 402 related to the message processing request. One or more bucket information corresponding to the topic in the message processing request.

具体而言,由于消息分布状态存储器402中存储有消息管理设备400接收的、来自每个消息存储设备200的有关存储分区的信息,因此分布状态查询器406可以根据消息处理请求中指定的消息的主题,从消息分布状态存储器402中查询该主题下的消息存储在哪些或哪个消息存储设备200的哪些或哪个存储分区上。例如,假定分布状态查询器406查询到共有5个存储分区存储消息处理请求中指定主题下的消息,每个存储分区用broker_id-partition_id标识,分别是:b1-p1,b1-p2,b2-p1,b2-p2,b3-p1,则将查询到的包含该5个存储分区标识的存储分区信息,通过传输接口404发送给相应的消息处理设备300的传输接口304。Specifically, since the message distribution state memory 402 stores information about storage partitions received by the message management device 400 and from each message storage device 200, the distribution state queryer 406 can process the message according to the information specified in the message processing request. For a topic, query from the message distribution state storage 402 which or which storage partitions of the message storage device 200 the messages under the topic are stored on. For example, it is assumed that the distributed status queryer 406 inquires a total of 5 storage partitions to store messages under the topic specified in the message processing request, and each storage partition is identified by broker_id-partition_id, which are: b1-p1, b1-p2, b2-p1 , b2-p2, b3-p1, the queried storage partition information including the five storage partition identifiers is sent to the corresponding transmission interface 304 of the message processing device 300 through the transmission interface 404 .

消息处理设备300的传输接口304接收到来自消息管理设备400、与消息处理请求中的主题相对应的一个或多个存储分区信息后,转发给消息位置管理器306进行处理。After the transmission interface 304 of the message processing device 300 receives one or more storage partition information corresponding to the topic in the message processing request from the message management device 400, it forwards it to the message location manager 306 for processing.

具体而言,消息位置管理器306从一个或多个存储分区信息中依次选择一个存储分区信息,然后从消息管理设备400中获取所选择的存储分区信息对应的当前要处理消息的位置信息。例如,消息位置管理器306包括选择模块和消息位置查询模块,首先选择模块从一个或多个存储分区信息中依次选择一个存储分区信息,在选择存储分区信息时,可以是从一个或多个存储分区信息中依次随机选择一个存储分区信息,也可以是按照消息存储设备200的编号及在相应的消息存储设备200上的存储分区的编号依次选择一个存储分区信息。然后消息位置查询模块根据选择模块选择的存储分区信息生成相应的消息位置查询请求,消息位置查询请求中包括选择模块所选择的存储分区信息,进而通过传输接口304将消息位置查询模块所生成的消息位置查询请求发送给消息管理设备400的传输接口404,以便从消息管理设备400中获取该存储分区信息对应的当前要处理的消息的位置信息。Specifically, the message location manager 306 sequentially selects one storage partition information from one or more storage partition information, and then acquires from the message management device 400 the location information of the currently processed message corresponding to the selected storage partition information. For example, the message location manager 306 includes a selection module and a message location query module. First, the selection module sequentially selects a storage partition information from one or more storage partition information. When selecting storage partition information, it may be from one or more storage partition information. In the partition information, a storage partition information is randomly selected sequentially, or a storage partition information can be sequentially selected according to the number of the message storage device 200 and the number of the storage partition on the corresponding message storage device 200 . Then the message location query module generates a corresponding message location query request according to the storage partition information selected by the selection module, the message location query request includes the storage partition information selected by the selection module, and then sends the message generated by the message location query module The location query request is sent to the transmission interface 404 of the message management device 400 so as to acquire the location information of the message currently to be processed corresponding to the storage partition information from the message management device 400 .

消息管理设备400的传输接口404接收到来自消息处理设备300的消息位置查询请求后,将该消息位置查询请求转发给消息位置管理器408。因为在消息分布状态存储器402中还存储有每个存储分区中有关消息处理设备当前要处理的消息的位置信息,所以消息位置管理器408接收到消息位置查询请求后,从消息分布状态存储器402中查询与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理的消息的位置信息,查询完毕后将查询结果通过传输接口404发送给相应消息处理设备300的传输接口304。如果消息分布状态存储器402中不存与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理的消息的位置信息,可以由消息位置管理器408将相应存储分区当前要处理的消息的位置信息的初始值设为0,并发送给相应的消息处理设备300。另外,也可以由消息位置管理器408将不存在相应存储分区当前要处理的消息的位置信息直接发送给消息处理设备300,由消息处理设备300将相应存储分区当前要处理的消息的位置信息的初始值设为0。After receiving the message location query request from the message processing device 300 , the transmission interface 404 of the message management device 400 forwards the message location query request to the message location manager 408 . Because the position information of the message to be processed by the relevant message processing device in each storage partition is also stored in the message distribution state memory 402, so after the message position manager 408 receives the message position query request, the message from the message distribution state memory 402 Query the location information of the message currently to be processed in the storage partition corresponding to the storage partition in the message location query request, and send the query result to the transmission interface 304 of the corresponding message processing device 300 through the transmission interface 404 after the query is completed. If there is no location information of the message to be processed in the storage partition corresponding to the storage partition in the message location query request in the message distribution status memory 402, the message location manager 408 can send the message to be processed currently in the corresponding storage partition The initial value of the location information of is set to 0, and is sent to the corresponding message processing device 300. In addition, the message location manager 408 may also directly send the location information of the message to be processed by the corresponding storage partition to the message processing device 300 directly, and the message processing device 300 will send the location information of the message to be processed by the corresponding storage partition to The initial value is set to 0.

应当注意的是,在上一个实施例中,消息处理设备300的存储信息获取器302先向消息管理设备400发送消息处理请求,获得消息管理设备400返回的结果后,消息位置管理器306再向消息管理设备400发送消息位置查询请求。在又一个实施例中,消息处理设备300的存储信息获取器302和消息位置管理器306也可以将消息处理请求和消息位置查询请求同时发送给消息管理设备400。例如,假定消息管理设备400同时接收到来自消息处理设备300的消息处理请求和消息位置查询请求,进而分布状态查询器406根据消息处理请求查询到共有5个存储分区存储消息处理请求中指定主题下的消息,然后消息位置管理器408根据分布状态查询器406的查询结果以及消息位置查询请求,进一步查询这5个存储分区当前分别要处理的消息的位置信息,最后将这5个存储分区当前分别要处理的消息的位置信息一并发送给相应的消息处理设备300。It should be noted that, in the previous embodiment, the stored information acquirer 302 of the message processing device 300 first sends a message processing request to the message management device 400, and after obtaining the result returned by the message management device 400, the message location manager 306 then sends a message processing request to the message management device 400. The message management device 400 sends a message location query request. In yet another embodiment, the stored information acquirer 302 and the message location manager 306 of the message processing device 300 may also send the message processing request and the message location query request to the message management device 400 at the same time. For example, assume that the message management device 400 receives a message processing request and a message location query request from the message processing device 300 at the same time, and then the distribution status queryer 406 queries a total of 5 storage partitions according to the message processing request to store information under the specified topic in the message processing request. message, then the message location manager 408 further inquires the location information of the messages currently to be processed by the five storage partitions according to the query result of the distribution status queryer 406 and the message location query request, and finally lists the current location information of the five storage partitions respectively The location information of the message to be processed is sent to the corresponding message processing device 300 together.

消息处理设备300的传输接口304在接收到消息管理设备400返回的、与消息位置查询请求中的存储分区相对应的存储分区的当前要处理的消息的位置信息后,将该位置信息经消息位置管理器306转发给消息获取器308;或者也可由传输接口304将接收到的位置信息直接发送给消息获取器308。After the transmission interface 304 of the message processing device 300 receives the location information of the message currently to be processed in the storage partition corresponding to the storage partition in the message location query request returned by the message management device 400, the location information is passed through the message location The manager 306 forwards it to the message acquirer 308; or the transmission interface 304 may directly send the received location information to the message acquirer 308.

消息处理设备300在从消息管理设备400查询到所处理主题的消息的存储分区信息及在相应存储分区的当前要处理的消息位置信息后,消息获取器308即可生成消息获取请求,并通过传输接口304将该消息获取请求发送给消息管理器306所选择的存储分区所在的消息存储设备200。消息获取请求中需要指明Topic,Partition,Offset,Fetchsize四个参数,Topic是指要处理什么主题的消息,Partition是指要处理该Topic下哪个存储分区的消息,Offset是指从该存储分区的哪个位置开始取消息,Fetchsize是指从该存储分区的Offset处取多少长度的消息。在这四个参数中,Topic,Partition和Offset参数已经在上面和消息管理设备400的交互过程中获得,Fetchsize参数可以由消息获取器308根据消息处理设备300本身的状况来决定。After the message processing device 300 inquires from the message management device 400 the storage partition information of the message of the processed topic and the current location information of the message to be processed in the corresponding storage partition, the message obtainer 308 can generate a message obtaining request, and transmit The interface 304 sends the message acquisition request to the message storage device 200 where the storage partition selected by the message manager 306 is located. The four parameters of Topic, Partition, Offset, and Fetchsize need to be specified in the message acquisition request. Topic refers to the message of the topic to be processed, Partition refers to the storage partition under the topic to be processed, and Offset refers to the message from the storage partition. The location starts to fetch messages, and Fetchsize refers to the length of messages fetched from the Offset of the storage partition. Among these four parameters, the Topic, Partition and Offset parameters have been obtained in the interaction process with the message management device 400 above, and the Fetchsize parameter can be determined by the message acquirer 308 according to the status of the message processing device 300 itself.

消息处理设备300的消息获取器308将生成的消息获取请求发送给相应的消息存储设备200的一个示例代码如下:An example code for the message acquirer 308 of the message processing device 300 to send the generated message acquisition request to the corresponding message storage device 200 is as follows:

$zkCluster=′localhost:2181′;$zkCluster = 'localhost:2181';

$topic=′test′;$topic = 'test';

$Consumer=new Kafka_Consumer($zkCluster,$topic);$Consumer = new Kafka_Consumer($zkCluster, $topic);

$msg=$Consumer->fetchMsg();$msg=$Consumer->fetchMsg();

本领域技术人员可以理解,以上传递消息获取请求的代码仅仅是一个示例,任何可以实现将消息处理设备300产生的消息获取请求发送到消息存储设备200的代码实现都在本发明的保护范围内。Those skilled in the art can understand that the above code for transmitting the message acquisition request is just an example, and any code implementation that can send the message acquisition request generated by the message processing device 300 to the message storage device 200 is within the protection scope of the present invention.

需要说明的是,消息处理设备300所要处理的消息大小Fetchsize一般是一个固定值,如1M(兆)。Fetchsize可以保存在消息处理设备300本地,在这种情况下,消息获取器308在生成消息获取请求时,只需在消息处理设备300的本地磁盘中查询Fetchsize即可。本领域技术人员可以理解,Fetchsize也可保存在消息管理设备400的消息分布状态存储器402中,这种情况下,可以在分区状态查询器403从分布状态存储器402查询信息来处理消息获取请求时,将Fetchsize与有关存储分区的信息一起获取并发送给消息处理设备300的消息位置管理器306。当然,也可由消息处理设备300的存储信息获取器302或消息位置管理器306生成Fetchsize获取请求,再将Fetchsize获取请求发生到消息管理设备400,进而从消息管理设备400中的消息分布状态存储器402查询获取所要处理的消息大小Fetchsize。It should be noted that the message size Fetchsize to be processed by the message processing device 300 is generally a fixed value, such as 1M (megabytes). The Fetchsize may be stored locally on the message processing device 300 . In this case, when the message obtainer 308 generates a message obtaining request, it only needs to query the Fetchsize in the local disk of the message processing device 300 . Those skilled in the art can understand that the Fetchsize can also be stored in the message distribution state memory 402 of the message management device 400. In this case, when the partition state queryer 403 inquires information from the distribution state memory 402 to process the message acquisition request, The Fetchsize is acquired and sent to the message location manager 306 of the message processing device 300 together with the information about the storage partition. Of course, the Fetchsize acquisition request can also be generated by the stored information acquirer 302 or the message location manager 306 of the message processing device 300, and then the Fetchsize acquisition request is sent to the message management device 400, and then from the message distribution state memory 402 in the message management device 400 Query to obtain the message size Fetchsize to be processed.

消息存储设备200在接收到消息处理设备300的消息获取器308生成的消息获取请求后,查询与该消息获取请求中的Topic和Partition对应的存储分区,并从该存储分区从Offset指定的位置开始截取长度为Fetchsize的消息,然后将查询的消息返回给消息处理设备300。在又一个实施例中,消息处理设备300还包括消息处理器,消息处理器对消息存储设备200返回的消息按消息格式进行解析,假如解析得到三条消息及其长度分别是:msg1,len1;msg2,1en2;msg3,len3,那么消息处理器依次处理这三条消息。After the message storage device 200 receives the message acquisition request generated by the message acquirer 308 of the message processing device 300, it queries the storage partition corresponding to the Topic and Partition in the message acquisition request, and starts from the storage partition from the position specified by Offset Intercept the message whose length is Fetchsize, and then return the queried message to the message processing device 300 . In yet another embodiment, the message processing device 300 further includes a message processor, and the message processor parses the message returned by the message storage device 200 according to the message format. If the three messages and their lengths are obtained after parsing: msg1, len1; msg2 , 1en2; msg3, len3, then the message processor processes these three messages in turn.

在又一个实施例中,消息处理设备300还包括消息位置更新器。在消息处理器成功处理消息后,消息位置更新器生成消息位置更新请求,并经由传输接口304将所生成的消息位置更新请求发送给消息管理设备400,消息位置更新请求包括消息处理器最近一次或多次成功处理的消息大小及该消息所在的存储分区信息。In yet another embodiment, the message processing device 300 further includes a message location updater. After the message processor successfully processes the message, the message location updater generates a message location update request, and sends the generated message location update request to the message management device 400 via the transmission interface 304. The message location update request includes the message processor's latest or The size of the message successfully processed multiple times and the storage partition information where the message is located.

消息管理设备400的传输接口404在接收到来自消息处理设备300的消息位置更新请求后,转发给消息位置管理器408。消息位置管理器408基于消息位置更新请求中的消息大小,更新消息分布状态存储器402中、与消息位置更新请求中的存储分区相对应的存储分区的当前要处理消息的位置信息。在具体实现当前要处理的消息的位置信息offset的更新时,可以有多种方式。例如,消息位置更新器可以在消息处理器每成功处理完一条消息,就生成包含所处理消息大小的消息位置更新请求,如当消息处理器成功处理完消息msg1时,消息位置更新器生成包含msg1的大小len1的消息位置更新请求,消息管理设备400的消息位置管理器408将新的位置信息offset+len1存入到消息分布状态存储器402中的节点/consumer/offset/b1-p1中。当消息处理器成功处理完第二条消息msg2时,消息位置更新器生成包含msg2的大小len2的消息位置更新请求,消息管理设备400的消息位置管理器408再在新的offset上再加上len2,并更新消息分布状态存储器402中的节点/consumer/offset/b1-p1的内容。After receiving the message location update request from the message processing device 300, the transmission interface 404 of the message management device 400 forwards it to the message location manager 408. Based on the message size in the message location update request, the message location manager 408 updates the location information of the currently processed message in the storage partition corresponding to the storage partition in the message location update request in the message distribution state storage 402 . There are many ways to implement the update of the location information offset of the message currently to be processed. For example, the message location updater can generate a message location update request containing the size of the processed message every time the message processor successfully processes a message, for example, when the message processor successfully processes the message msg1, the message location updater generates a request containing msg1 The message position update request of the size len1, the message position manager 408 of the message management device 400 stores the new position information offset+len1 into the node /consumer/offset/b1-p1 in the message distribution state memory 402. When the message processor has successfully processed the second message msg2, the message location updater generates a message location update request containing the size len2 of msg2, and the message location manager 408 of the message management device 400 adds len2 to the new offset , and update the content of the node /consumer/offset/b1-p1 in the message distribution state storage 402.

如果对于对安全性要求不高的主题,可以在消息处理器成功处理完多条消息后,再由消息位置更新器生成消息位置更新请求更新消息管理设备400的消息分布状态存储器402中相应存储分区的offset。例如,在上面的例子中,也可在消息处理器成功处理完三条消息msg1、msg2、msg3后,消息位置更新器再生成包含三条消息大小len1+len2+len3的消息位置更新请求并发送给消息管理设备400,消息管理设备400的消息位置管理器408将新的位置信息offset+len1+len2+len3存入到消息分布状态存储器402中节点/consumer/offset/b1-p1中,对offset进行更新,这样可以增加一些效率。For topics that do not require high security, the message location updater can generate a message location update request to update the corresponding storage partition in the message distribution state memory 402 of the message management device 400 after the message processor has successfully processed multiple messages the offset. For example, in the above example, after the message processor has successfully processed the three messages msg1, msg2, and msg3, the message location updater can generate a message location update request containing three messages of size len1+len2+len3 and send it to the message The management device 400, the message position manager 408 of the message management device 400 stores the new position information offset+len1+len2+len3 into the node /consumer/offset/b1-p1 in the message distribution state memory 402, and updates the offset , which can increase some efficiency.

通过以上本发明的多个实施例可以看出,本发明实施例通过将每个存储分区中有关消息处理设备当前要处理的消息的位置信息offset保存在消息管理设备中,避免了消息处理设备每次处理消息时需要在本地来计算offset,可以降低消息处理设备的使用成本,提高其资源的利用效率。From the above multiple embodiments of the present invention, it can be seen that the embodiment of the present invention saves the position information offset of the message currently to be processed by the message processing device in each storage partition in the message management device, avoiding the message processing device every When processing a message for the first time, the offset needs to be calculated locally, which can reduce the cost of using message processing equipment and improve the utilization efficiency of its resources.

进一步,因为在消息管理设备400上存储有每个消息存储设备200中有关存储分区的信息、以及每个存储分区中有关消息处理设备300当前要处理的消息的位置信息,因此当消息处理设备300获取要处理的消息时,只需从消息管理设备400查询消息处理设备300处理的主题下的消息在消息存储设备200上的存储分区信息,以及消息处理设备300在相应的存储分区的当前要处理的消息的位置信息,即可发送消息获取请求从消息存储设备200获取相应的消息进行处理,这样,即使消息处理设备300发生故障,在消息处理设备300恢复正常后,仍然可以紧接上次成功处理消息的位置获取消息进行处理,避免了消息的重复处理或遗漏。Further, because the message management device 400 stores information about storage partitions in each message storage device 200 and location information about messages currently to be processed by the message processing device 300 in each storage partition, when the message processing device 300 When acquiring a message to be processed, it is only necessary to inquire from the message management device 400 about the storage partition information on the message storage device 200 of the message under the topic processed by the message processing device 300, and the information currently to be processed by the message processing device 300 in the corresponding storage partition. The location information of the message, that is, send a message acquisition request to obtain the corresponding message from the message storage device 200 for processing. In this way, even if the message processing device 300 fails, after the message processing device 300 returns to normal, it can still succeed the last time. The location where the message is processed obtains the message for processing, avoiding repeated processing or omission of the message.

与前述本发明一个实施例分布式消息处理系统相对应,图4示出了根据本发明一个实施例的适于在分布式消息处理系统中的消息管理设备上执行的消息管理方法的流程图。该分布式消息处理系统包括一个或多个如图2实施例所描述的消息产生设备100、一个或多个如图2实施例所描述的消息存储设备200、一个或多个如图2实施例所描述的消息处理设备300以及如图2实施例所描述的消息管理设备400。该消息管理方法适于在图2实施例所描述的消息管理设备400上执行。Corresponding to the aforementioned distributed message processing system according to an embodiment of the present invention, FIG. 4 shows a flow chart of a message management method adapted to be executed on a message management device in a distributed message processing system according to an embodiment of the present invention. The distributed message processing system includes one or more message generating devices 100 as described in the embodiment of Figure 2, one or more message storage devices 200 as described in the embodiment of Figure 2, one or more The described message processing device 300 and the message management device 400 as described in the embodiment of FIG. 2 . The message management method is suitable for execution on the message management device 400 described in the embodiment of FIG. 2 .

该消息管理方法始于步骤S410,在步骤S410中,接收消息处理设备发送的消息处理请求,该消息处理请求至少包括所请求处理消息的主题。本步骤可以通过前述消息管理设备400中的传输接口404来执行,相关的技术实现可以参考前述消息管理设备400中的传输接口404在各实施例中的相关描述,此处不再赘述。The message management method starts at step S410. In step S410, a message processing request sent by a message processing device is received, and the message processing request includes at least the subject of the message to be processed. This step can be performed through the transmission interface 404 in the aforementioned message management device 400 , and related technical implementation can refer to the relevant descriptions of the transmission interface 404 in the aforementioned message management device 400 in various embodiments, which will not be repeated here.

在步骤S410接收到消息处理请求后,步骤S420在消息管理设备中查询与消息处理请求中的主题相对应的存储分区信息,并将所查询到的存储分区信息发送给相应的消息处理设备。具体而言,由于消息管理设备中通常存储有每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息,因此,在本步骤中,可以根据消息处理请求中指定的消息的主题,从消息管理设备中查询该主题下的消息存储在哪个或哪些消息存储设备的哪个或些存储分区上。例如,假定查询到共有5个存储分区存储该主题的消息,每个存储分区用broker_id-partition_id标识,分别是:b1-p1,b1-p2,b2-p1,b2-p2,b3-p1,则将查询到的包含这5个存储分区标识的存储分区信息发送给相应的消息处理设备。当消息管理设备中还存储有消息处理设备所要处理的消息的大小时,还可在查询有关存储分区信息的同时,查询相应消息处理设备所要处理的消息的大小,一并发送给相应的消息处理设备。本步骤可以通过前述消息管理设备400中的分区状态查询器406来执行,相关的技术实现可以参考前述分区状态查询器406在各实施例中的相关描述,此处不再赘述。After the message processing request is received in step S410, step S420 queries the message management device for storage partition information corresponding to the topic in the message processing request, and sends the queried storage partition information to the corresponding message processing device. Specifically, since information about storage partitions in each message storage device and location information about messages to be processed by the message processing device in each storage partition are usually stored in the message management device, in this step, According to the subject of the message specified in the message processing request, it may be queried from the message management device which storage partition(s) of the message storage device(s) the message under the subject is stored in. For example, assume that there are 5 storage partitions to store messages of this topic, and each storage partition is identified by broker_id-partition_id, which are: b1-p1, b1-p2, b2-p1, b2-p2, b3-p1, then Send the queried storage partition information including the identifiers of the five storage partitions to the corresponding message processing device. When the message management device also stores the size of the message to be processed by the message processing device, it can also inquire about the size of the message to be processed by the corresponding message processing device while querying the relevant storage partition information, and send it to the corresponding message processing device. equipment. This step can be performed by the partition state queryer 406 in the aforementioned message management device 400. For related technical implementations, reference can be made to the relevant descriptions of the aforementioned partition status queryer 406 in various embodiments, which will not be repeated here.

通过步骤S420,消息处理设备已经获得了其要处理的主题下的消息的存储分区信息,因此后续消息处理设备就会根据选择的存储分区信息生成消息位置查询请求,并发送给消息管理设备。于是,在步骤S430中处理来自消息处理设备的消息位置查询请求。例如,在消息管理设备中查询与该消息位置查询请求中的存储分区相对应的存储分区的当前要处理消息的位置信息,然后将查询到的位置信息发送给相应消息处理设备。Through step S420, the message processing device has obtained the storage partition information of the messages under the topic to be processed, so the subsequent message processing device will generate a message location query request according to the selected storage partition information, and send it to the message management device. Then, in step S430, the message location query request from the message processing device is processed. For example, the message management device queries the location information of the message currently to be processed in the storage partition corresponding to the storage partition in the message location query request, and then sends the queried location information to the corresponding message processing device.

在具体实现本步骤时可以有多种方式,例如,假定消息处理设备获取的存储分区共有5个,分别是:b1-p1,b1-p2,b2-p1,b2-p2,b3-p1,依次轮流从这5个存储分区中选择一个存储分区生成消息位置查询请求,如果当前要查询b1-p1存储分区当前要处理的消息的位置信息,则生成包含b1-p1存储分区的消息位置查询请求给消息管理设备,在步骤S430中从消息管理设备中相应的节点/consumer/offset/b1-p1查询到b1-p1存储分区当前要处理的消息的位置信息offset,并发送给相应的消息处理设备。如果消息管理设备中不存在该节点,则将b1-p1存储分区当前要处理的消息的位置信息的初始值设为0,并发送给相应的消息处理设备。另外,也可以将不存在该节点的信息直接发送给消息处理设备,由消息处理设备将b1-p1存储分区当前要处理的消息位置信息的初始值设为0。本步骤可以通过前述消息管理设备400中的消息位置管理器408来执行,相关的技术实现可以参考前述消息位置管理器408在各实施例中的相关描述,此处不再赘述。There are many ways to implement this step. For example, suppose there are five storage partitions obtained by the message processing device, namely: b1-p1, b1-p2, b2-p1, b2-p2, b3-p1, in order Select a storage partition from these 5 storage partitions in turn to generate a message location query request. If you want to query the location information of the message currently processed by the b1-p1 storage partition, generate a message location query request containing the b1-p1 storage partition to In step S430, the message management device inquires from the corresponding node /consumer/offset/b1-p1 in the message management device the location information offset of the message currently to be processed in the b1-p1 storage partition, and sends it to the corresponding message processing device. If the node does not exist in the message management device, set the initial value of the position information of the message to be processed in the b1-p1 storage partition to 0, and send it to the corresponding message processing device. In addition, the information that the node does not exist may also be directly sent to the message processing device, and the message processing device sets the initial value of the message position information to be processed in the b1-p1 storage partition to 0. This step can be performed by the message location manager 408 in the aforementioned message management device 400. For related technical implementations, reference can be made to the related descriptions of the aforementioned message location manager 408 in various embodiments, which will not be repeated here.

通过步骤S430,消息处理设备已经获得了所选择的存储分区的当前要处理的消息的位置信息,因此可以据此从消息存储设备的相应存储分区获取相应的消息,并对消息进行处理。由于消息处理设备对消息的处理会导致后续处理消息的位置信息的变化,因此消息处理设备会向消息管理设备发送消息位置更新请求。具体而言,在步骤S440中,处理来自消息处理设备的消息位置更新请求,基于消息位置更新请求中的消息大小,更新消息管理设备中、与消息位置更新请求中的存储分区相对应的存储分区的当前要处理消息的位置信息。在更新消息管理设备中相应存储分区的当前要处理的消息位置信息offset时,消息处理设备可以在每成功处理完一条消息,就发送消息位置更新请求更新消息管理设备中相应存储分区的offset。例如当消息处理设备成功处理完消息msg1时,消息管理设备根据消息处理设备发送的包含len1的消息位置更新请求,将新的位置信息offset+len1存入到消息管理设备的相应节点/consumer/offset/b1-p1中;当消息处理设备成功处理完第二条消息msg2时,消息管理设备根据消息处理设备发送的包含len2的消息位置更新请求,在新的offset上再加上len2,并更新相应消息管理设备中的内容。Through step S430, the message processing device has obtained the location information of the message currently to be processed in the selected storage partition, so it can obtain the corresponding message from the corresponding storage partition of the message storage device accordingly, and process the message. Since the processing of the message by the message processing device will result in a change of the location information of the subsequent processed message, the message processing device will send a message location update request to the message management device. Specifically, in step S440, the message location update request from the message processing device is processed, and based on the message size in the message location update request, the storage partition corresponding to the storage partition in the message location update request in the message management device is updated The position information of the current message to be processed. When updating the current message position information offset to be processed in the corresponding storage partition in the message management device, the message processing device may send a message position update request to update the offset of the corresponding storage partition in the message management device every time a message is successfully processed. For example, when the message processing device successfully processes the message msg1, the message management device stores the new location information offset+len1 into the corresponding node /consumer/offset of the message management device according to the message location update request containing len1 sent by the message processing device /b1-p1; when the message processing device successfully processes the second message msg2, the message management device adds len2 to the new offset according to the message position update request containing len2 sent by the message processing device, and updates the corresponding Content in the message management device.

如果对于对安全性要求不高的主题,可以在消息处理设备成功处理完多条消息后再更新相应消息管理设备中的offset,例如,在上面的例子中,也可以在消息处理设备成功处理完三条消息后,消息管理设备根据消息处理设备发送的包含len1+len2+len3的消息位置更新请求,将新的位置信息offset+len1+len2+len3存入到消息管理设备的相应节点/consumer/offset/b1-p1中,这样可以增加一些效率。For topics that do not require high security, you can update the offset in the corresponding message management device after the message processing device successfully processes multiple messages. For example, in the above example, you can also update the offset after the message processing device successfully processes After three messages, the message management device stores the new location information offset+len1+len2+len3 into the corresponding node /consumer/offset of the message management device according to the message location update request containing len1+len2+len3 sent by the message processing device /b1-p1, this can increase some efficiency.

步骤S430可以通过前述消息管理设备400中的消息位置管理器408来执行,相关的技术实现可以参考前述消息位置管理器408在各实施例中的相关描述,此处不再赘述。Step S430 can be executed by the message location manager 408 in the aforementioned message management device 400. For related technical implementation, reference can be made to the related descriptions of the aforementioned message location manager 408 in various embodiments, which will not be repeated here.

上述实施例中,由于在消息管理设备上存储有每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息,当消息处理设备获取要处理的消息时,只需从消息管理设备查询消息处理设备处理的主题下的消息在消息存储设备上的存储分区信息,以及消息处理设备在相应的存储分区的当前要处理的消息的位置信息,即可发送消息获取请求从消息存储设备获取相应的消息进行处理,这样,即使消息处理设备发生故障,在消息处理设备恢复正常后,仍然可以紧接上次成功处理消息的位置获取消息进行处理,避免了消息的重复处理或遗漏。In the above embodiment, since the information about the storage partition in each message storage device and the location information about the message currently to be processed by the message processing device in each storage partition are stored on the message management device, when the message processing device acquires the When processing a message, it is only necessary to inquire from the message management device the storage partition information of the message under the topic processed by the message processing device on the message storage device, and the location information of the message currently to be processed by the message processing device in the corresponding storage partition, You can send a message acquisition request to obtain the corresponding message from the message storage device for processing. In this way, even if the message processing device fails, after the message processing device returns to normal, you can still obtain the message for processing at the position where the message was successfully processed last time. Repeated processing or omission of messages is avoided.

与前述本发明一个实施例分布式消息处理系统相对应,图5示出了根据本发明一个实施例的适于在分布式消息处理系统中的消息处理设备上执行的消息处理方法的流程图。该分布式消息处理系统包括一个或多个如图2实施例所描述的消息产生设备100、一个或多个如图2实施例所描述的消息存储设备200、一个或多个如图2实施例所描述的消息处理设备300以及如图2实施例所描述的消息管理设备400。该消息处理方法适于在图2实施例所描述的消息处理设备300上执行。Corresponding to the aforementioned distributed message processing system according to one embodiment of the present invention, FIG. 5 shows a flow chart of a message processing method adapted to be executed on a message processing device in a distributed message processing system according to one embodiment of the present invention. The distributed message processing system includes one or more message generating devices 100 as described in the embodiment of Figure 2, one or more message storage devices 200 as described in the embodiment of Figure 2, one or more The described message processing device 300 and the message management device 400 as described in the embodiment of FIG. 2 . The message processing method is suitable for execution on the message processing device 300 described in the embodiment of FIG. 2 .

该消息处理方法始于步骤S510,在步骤S510中,生成消息处理请求,消息处理请求至少包括所请求处理消息的主题。具体而言,消息处理设备根据要处理的消息主题生成消息处理请求。本步骤可以通过前述消息处理设备300中的存储信息获取器302来执行,相关的技术实现可以参考前述存储信息获取器202在各实施例中的相关描述,此处不再赘述。The message processing method starts at step S510. In step S510, a message processing request is generated, and the message processing request includes at least the subject of the message to be processed. Specifically, the message processing device generates a message processing request according to the subject of the message to be processed. This step can be performed by the stored information acquirer 302 in the aforementioned message processing device 300, and related technical implementations can refer to the related descriptions of the aforementioned stored information acquirer 202 in various embodiments, which will not be repeated here.

进而,在步骤S520中,将步骤S510中生成的消息处理请求发送给消息管理设备,并接收消息管理设备发送的与消息处理请求中的主题相对应的一个或者多个存储分区信息。在将消息处理请求发送给消息管理设备后,消息管理设备根据消息处理请求中指定的主题,查询出与该主题相对应的一个或者多个存储分区信息,并发送给相应的消息处理设备。本步骤可以通过前述消息处理设备300中的传输接口304来执行,相关的技术实现可以参考前述消息处理设备300中的传输接口304在各实施例中的相关描述,此处不再赘述。Furthermore, in step S520, the message processing request generated in step S510 is sent to the message management device, and one or more storage partition information corresponding to the subject in the message processing request sent by the message management device is received. After sending the message processing request to the message management device, the message management device queries information of one or more storage partitions corresponding to the topic according to the topic specified in the message processing request, and sends it to the corresponding message processing device. This step can be performed through the transmission interface 304 in the aforementioned message processing device 300 , and related technical implementation can refer to the relevant descriptions of the aforementioned transmission interface 304 in the message processing device 300 in various embodiments, which will not be repeated here.

此后,在步骤S530中,先从步骤S520获取的一个或者多个存储分区信息中选择一个存储分区信息,然后获取所选择的存储分区信息对应的当前要处理消息的位置信息。具体而言,可以通过如下方式实现:从步骤S520获取的一个或者多个存储分区信息中依次选择一个存储分区信息(该步骤可以通过前述的选择模块来执行)。例如,可以是先从一个或者多个存储分区信息中依次随机选择一个存储分区信息,也可以是按照消息存储设备的编号及在相应的消息存储设备上的存储分区的编号依次选择一个存储分区信息;然后根据所选择的存储分区信息生成消息位置查询请求并发送给消息管理设备,消息位置查询请求包括所选择的存储分区信息,以从消息管理设备中获取与所选择的存储分区信息对应的当前要处理消息的位置信息(该步骤可用通过前面的消息位置查询模块来执行)。步骤S530可以通过前述消息处理设备300中的消息位置管理器306来执行,相关的技术实现可以参考前述消息处理设备300中的消息位置管理器306在各实施例中的相关描述,此处不再赘述。Thereafter, in step S530, one storage partition information is selected from the one or more storage partition information obtained in step S520, and then the position information of the currently to-be-processed message corresponding to the selected storage partition information is obtained. Specifically, it may be implemented in the following manner: sequentially select one storage partition information from one or more storage partition information obtained in step S520 (this step may be performed by the aforementioned selection module). For example, one storage partition information may be randomly selected sequentially from one or more storage partition information, or one storage partition information may be sequentially selected according to the number of the message storage device and the number of the storage partition on the corresponding message storage device ; Then generate a message location query request according to the selected storage partition information and send it to the message management device. The message location query request includes the selected storage partition information, so as to obtain the current information corresponding to the selected storage partition information from the message management device. The location information of the message to be processed (this step can be executed through the previous message location query module). Step S530 can be executed by the message location manager 306 in the aforementioned message processing device 300, and related technical implementations can refer to the related descriptions of the aforementioned message location manager 306 in the message processing device 300 in various embodiments, which are not repeated here. repeat.

然后,在步骤S540中,根据步骤S520和S530获得的存储分区信息和相应的存储分区中当前要处理的消息的位置信息生成消息获取请求,该消息获取请求包括所请求处理消息的主题、所选择的存储分区、该存储分区的当前要处理消息的位置信息和所要处理的消息大小。本步骤可以通过前述消息处理设备300中的消息获取器308来执行,相关的技术实现可以参考前述消息处理设备300中的消息获取器器308在各实施例中的相关描述,此处不再赘述。Then, in step S540, a message acquisition request is generated according to the storage partition information obtained in steps S520 and S530 and the location information of the message currently to be processed in the corresponding storage partition, and the message acquisition request includes the subject of the message to be processed, the selected The storage partition of the storage partition, the location information of the current message to be processed in the storage partition, and the size of the message to be processed. This step can be performed by the message acquirer 308 in the aforementioned message processing device 300, and related technical implementations can refer to the related descriptions of the message acquirer 308 in the aforementioned message processing device 300 in various embodiments, which will not be repeated here. .

最后,在步骤S550中,将步骤S540生成的消息获取请求发送给对应的存储分区所在的消息存储设备,以及接收该存储分区所在的消息存储设备返回的对应于该消息获取请求的消息。本步骤可以通过前述消息处理设备300中的传输接口304来执行,相关的技术实现可以参考前述消息处理设备300中的传输接口304在各实施例中的相关描述,此处不再赘述。Finally, in step S550, the message acquisition request generated in step S540 is sent to the message storage device where the corresponding storage partition is located, and the message corresponding to the message acquisition request returned by the message storage device where the storage partition is located is received. This step can be performed through the transmission interface 304 in the aforementioned message processing device 300 , and related technical implementation can refer to the relevant descriptions of the aforementioned transmission interface 304 in the message processing device 300 in various embodiments, which will not be repeated here.

此外,需要指出的是,在执行步骤S520时,也可以将消息处理请求和消息位置查询请求同时发送给消息管理设备。例如,假定消息管理设备根据消息处理请求查询到共有5个存储分区存储某主题下的消息,消息管理设备还可以根据查询到的结果,进一步查询这5个存储分区当前分别要处理的消息位置信息,并将这5个存储分区当前分别要处理的消息位置信息同时应步骤S520的请求返回给消息处理设备。这样,步骤S530同样可以依次轮流从这5个存储分区选择一个存储分区及相应的存储分区中当前要处理的消息的位置信息。In addition, it should be pointed out that, when step S520 is executed, the message processing request and the message location query request may also be sent to the message management device at the same time. For example, assuming that the message management device inquires according to the message processing request that there are 5 storage partitions to store messages under a certain topic, the message management device can further query the location information of the messages currently processed by the 5 storage partitions according to the query results , and return the message location information currently to be processed by the five storage partitions to the message processing device at the same time in response to the request of step S520. In this way, step S530 may also sequentially select one storage partition from the five storage partitions and the position information of the message currently to be processed in the corresponding storage partition.

上述消息处理方法还可以包括以下步骤:对接收到的对应于消息获取请求的消息进行处理。例如,对消息存储设备根据消息获取请求返回的相应的消息按消息格式进行解析,假如解析得到三条消息及其长度分别是:msg1,len1;msg2,len2;msg3,len3,对这三条消息依次进行处理。本步骤可以通过前述消息处理设备300中的消息处理器来执行,相关的技术实现可以参考前述消息处理设备300中的消息处理器在各实施例中的相关描述,此处不再赘述。The above message processing method may further include the following step: processing the received message corresponding to the message acquisition request. For example, the corresponding message returned by the message storage device according to the message acquisition request is parsed according to the message format. If three messages and their lengths are obtained after parsing: msg1, len1; msg2, len2; deal with. This step can be performed by the message processor in the aforementioned message processing device 300 , and related technical implementations can refer to the relevant descriptions of the message processor in the aforementioned message processing device 300 in various embodiments, which will not be repeated here.

上述消息处理方法还包括以下步骤:生成消息位置更新请求并发送给消息管理设备,消息位置更新请求包括最近一次或多次成功处理的消息大小及该消息所在的存储分区信息。在本步骤中,可以有多种实现方式,例如,可以在每成功处理完一条消息,就发送包含所处理消息大小的消息位置更新请求给消息管理设备,消息管理设备更新相应存储分区的当前要处理的消息位置信息offset。例如当成功处理完消息msg1时,生成包含msg1的大小len1的消息位置更新请求,并发送给消息管理设备,消息管理设备将新的位置信息offset+len1存入到相应节点/consumer/offset/b1-p1中;当成功处理完第二条消息msg2时,生成包含msg2的大小len2的消息位置更新请求,并发送给消息管理设备,消息管理设备再在新的offset上再加上len2,并更新相应节点/consumer/offset/b 1-p1的内容。The above message processing method further includes the following steps: generating a message location update request and sending it to the message management device, the message location update request includes the size of the latest one or more successfully processed messages and the storage partition information where the message is located. In this step, there can be multiple implementations. For example, after each message is successfully processed, a message location update request including the size of the processed message can be sent to the message management device, and the message management device updates the current request of the corresponding storage partition. The position information offset of the processed message. For example, when the message msg1 is successfully processed, a message location update request containing the size len1 of msg1 is generated and sent to the message management device, and the message management device stores the new location information offset+len1 into the corresponding node /consumer/offset/b1 -p1; when the second message msg2 is successfully processed, a message position update request containing msg2 with a size of len2 is generated and sent to the message management device, and the message management device adds len2 to the new offset and updates The content of the corresponding node /consumer/offset/b1-p1.

在另一种实现方式中,如果对于对安全性要求不高的主题,可以在成功处理完多条消息后,再生成消息位置更新请求更新消息管理设备中相应存储分区的offset,例如,在上面的例子中,也可在成功处理完三条消息msg1、msg2、msg3后,再生成包含三条消息大小len1+len2+len3的消息位置更新请求并发送给消息管理设备,消息管理设备将新的位置信息offset+len1+len2+len3存入到相应节点/consumer/offset/b1-p1中,对offset进行更新,这样可以增加一些效率。本步骤可通过前述消息处理设备300中的消息位置更新器来执行,相关的技术实现可以参考前述消息处理设备300中的消息位置更新器在各实施例中的相关描述,此处不再赘述。In another implementation, for a topic that does not require high security, after successfully processing multiple messages, a message location update request can be generated to update the offset of the corresponding storage partition in the message management device, for example, in the above In the example of , after the three messages msg1, msg2, and msg3 are successfully processed, a message location update request containing three messages of size len1+len2+len3 can be generated and sent to the message management device, and the message management device will update the new location information offset+len1+len2+len3 is stored in the corresponding node /consumer/offset/b1-p1, and the offset is updated, which can increase some efficiency. This step can be performed by the message location updater in the aforementioned message processing device 300. For related technical implementation, please refer to the relevant descriptions of the message location updater in the aforementioned message processing device 300 in various embodiments, which will not be repeated here.

上述实施例中,由于消息管理设备上存储有每个消息存储设备中有关存储分区的信息、以及每个存储分区中有关消息处理设备当前要处理的消息的位置信息,因此当消息处理设备获取要处理的消息时,只需从消息管理设备查询消息处理设备处理的主题下的消息在消息存储设备上的存储分区信息,以及消息处理设备在相应的存储分区的当前要处理的消息的位置信息,即可发送消息获取请求从消息存储设备获取消息进行处理,这样,即使消息处理设备发生故障,在消息处理设备恢复正常后,仍然可以紧接上次成功处理消息的位置获取消息进行处理,避免了消息的重复处理或遗漏。In the above embodiment, since the message management device stores the information about the storage partitions in each message storage device and the location information about the messages currently to be processed by the message processing device in each storage partition, when the message processing device obtains the When processing a message, it is only necessary to inquire from the message management device the storage partition information of the message under the topic processed by the message processing device on the message storage device, and the location information of the message currently to be processed by the message processing device in the corresponding storage partition, You can send a message acquisition request to acquire messages from the message storage device for processing. In this way, even if the message processing device fails, after the message processing device returns to normal, you can still obtain the message for processing at the position where the message was successfully processed last time, avoiding Duplicate processing or omission of messages.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本说明书公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, in order to streamline the present disclosure and to facilitate understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together into a single embodiment , figure, or description of it. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the device according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

本申请可以应用于计算机系统/服务器,其可与众多其它通用或专用计算系统环境或配置一起操作。适于与计算机系统/服务器一起使用的众所周知的计算系统、环境和/或配置的例子包括但不限于:个人计算机系统、服务器计算机系统、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的系统、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机系统、大型计算机系统和包括上述任何系统的分布式云计算技术环境,等等。计算机系统/服务器可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机系统/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上。The application may be applied to computer systems/servers that are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments and/or configurations suitable for use with computer systems/servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, Microprocessor-based systems, set-top boxes, programmable consumer electronics, networked personal computers, minicomputer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the foregoing, among others. Computer systems/servers may be described in the general context of computer system-executable instructions, such as program modules, being executed by the computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc., that perform particular tasks or implement particular abstract data types. The computer system/server can be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including storage devices.

Claims (4)

1. message management equipment in the distributed message disposal system, this distributed message disposal system also comprises one or more information storaging apparatus and one or more message processing device, wherein every message has corresponding theme, described information storaging apparatus is that one or more partition holding set up in corresponding theme, and according to the theme of message with message stores in one of partition holding of corresponding theme, described message management equipment comprises:
The message distribution status register is configured to store at least in each information storaging apparatus the positional information of the current message to be processed of relevant information treatment facility in the information of relevant partition holding and each partition holding;
Transmission interface is configured to the Message Processing request that the receipt message treatment facility sends, and described Message Processing request comprises the theme of the processing messages of asking at least;
The subregion state requestor, be configured to the inquiry partition holding information corresponding with the theme in the described Message Processing request in described message distribution status register, and via described transmission interface the partition holding information that inquires sent to the corresponding message treatment facility; And
The message location manager, be configured to process receive by described transmission interface, from the message position query requests of message processing device, from described message distribution status register, obtain the current of the partition holding corresponding with the partition holding in this message position query requests and want the positional information of processing messages and send to the corresponding message treatment facility via described transmission interface; And be configured to process receive by described transmission interface, from the message position updating request of message processing device, based on the message size in the described message position updating request, upgrade in the described message distribution status register, the current positional information of wanting processing messages of the partition holding corresponding with the partition holding in the described message position updating request.
2. message management equipment as claimed in claim 1 also stores the size of the each message to be dealt with of message processing device in the wherein said message distribution status register;
Described subregion state requestor also is configured to the size of inquiry corresponding message treatment facility message to be dealt with in described message distribution status register, and sends to the corresponding message treatment facility by described transmission interface.
3. information management method, the message management equipment that the method is suitable in the distributed message disposal system is carried out, this distributed message disposal system also comprises one or more information storaging apparatus and one or more message processing device, wherein every message has corresponding theme, described information storaging apparatus is that one or more partition holding set up in corresponding theme, and according to the theme of message with message stores in one of partition holding of corresponding theme, described information management method comprises:
The Message Processing request that the receipt message treatment facility sends, described Message Processing request comprises the theme of the processing messages of asking at least;
Inquire about the partition holding information corresponding with the theme in the described Message Processing request, and the partition holding information that inquires sent to the corresponding message treatment facility, wherein, store at least in each information storaging apparatus the positional information of the current message to be processed of relevant information treatment facility in the information of relevant partition holding and each partition holding in the described message management equipment; And
Processing is inquired about partition holding current corresponding with the partition holding in this message position query requests and is wanted the positional information of processing messages and send to the corresponding message treatment facility from the message position query requests of message processing device; And processing is from the message position updating request of message processing device, based on the message size in the described message position updating request, upgrade the current positional information of wanting processing messages of the partition holding corresponding with the partition holding in the described message position updating request.
4. information management method as claimed in claim 3 also comprises:
The size of inquiry corresponding message treatment facility message to be dealt with also sends to the corresponding message treatment facility, also stores the size of the each message to be dealt with of message processing device in the wherein said message management equipment.
CN201210436385.7A 2012-11-05 2012-11-05 Message management equipment and method in distributed message processing system Expired - Fee Related CN102955717B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210436385.7A CN102955717B (en) 2012-11-05 2012-11-05 Message management equipment and method in distributed message processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210436385.7A CN102955717B (en) 2012-11-05 2012-11-05 Message management equipment and method in distributed message processing system

Publications (2)

Publication Number Publication Date
CN102955717A true CN102955717A (en) 2013-03-06
CN102955717B CN102955717B (en) 2015-05-20

Family

ID=47764546

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210436385.7A Expired - Fee Related CN102955717B (en) 2012-11-05 2012-11-05 Message management equipment and method in distributed message processing system

Country Status (1)

Country Link
CN (1) CN102955717B (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361065A (en) * 2014-11-04 2015-02-18 福建亿榕信息技术有限公司 Orderly sequence number generating method of Zookeeper-based distributed system
CN104754036A (en) * 2015-03-06 2015-07-01 合一信息技术(北京)有限公司 Message processing system and processing method based on kafka
CN105204776A (en) * 2015-08-18 2015-12-30 北京京东尚科信息技术有限公司 Data processing method and device
CN106170013A (en) * 2016-06-29 2016-11-30 上海浦东发展银行股份有限公司信用卡中心 A kind of Kafka message uniqueness method based on Redis
CN106371366A (en) * 2016-09-22 2017-02-01 南京中新赛克科技有限责任公司 ARM architecture-based big data acquisition and analysis platform
CN106375462A (en) * 2016-09-13 2017-02-01 北京百度网讯科技有限公司 Method and device for realizing message persistence in distributed message system
CN107438061A (en) * 2016-05-27 2017-12-05 北京京东尚科信息技术有限公司 A kind of method and apparatus of kafka clients authentication
CN107562810A (en) * 2017-08-10 2018-01-09 北京时代云英科技有限公司 Video big data is classified storage method
CN109190025A (en) * 2018-08-21 2019-01-11 北京京东尚科信息技术有限公司 information monitoring method, device, system and computer readable storage medium
CN110162410A (en) * 2018-02-12 2019-08-23 北京京东尚科信息技术有限公司 A kind of message treatment method and device
WO2020042612A1 (en) * 2018-08-31 2020-03-05 华为技术有限公司 Method and device for storing and reading a message, server, and storage medium
CN111741041A (en) * 2019-07-10 2020-10-02 北京京东尚科信息技术有限公司 Message processing method and device, electronic equipment and computer readable medium
CN111786750A (en) * 2020-06-30 2020-10-16 深圳前海微众银行股份有限公司 Message query method and message receiving terminal
CN112380155A (en) * 2019-09-25 2021-02-19 北京城建设计发展集团股份有限公司 Cloud-based rail transit integrated data bus communication method and system
WO2021082073A1 (en) * 2019-10-30 2021-05-06 平安科技(深圳)有限公司 Method and system for dynamic selection of storage partitions, computer device, and storage medium
CN114461407A (en) * 2022-04-13 2022-05-10 杭州涂鸦信息技术有限公司 Data processing method, data processing device, distribution server, data processing system, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060101148A1 (en) * 2004-11-05 2006-05-11 Christian Herrmann Method, system, and program product for monitoring message flow in a message queuing system
CN1988512A (en) * 2005-12-23 2007-06-27 国际商业机器公司 Device, method and system for supporting multimedia news sending and receiving based on application
CN102469033A (en) * 2010-11-01 2012-05-23 阿里巴巴集团控股有限公司 Message subscription system and message sending method
CN102668516A (en) * 2011-12-02 2012-09-12 华为技术有限公司 Method and apparatus for realizing message passing amid cloud information service

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060101148A1 (en) * 2004-11-05 2006-05-11 Christian Herrmann Method, system, and program product for monitoring message flow in a message queuing system
CN1988512A (en) * 2005-12-23 2007-06-27 国际商业机器公司 Device, method and system for supporting multimedia news sending and receiving based on application
CN102469033A (en) * 2010-11-01 2012-05-23 阿里巴巴集团控股有限公司 Message subscription system and message sending method
CN102668516A (en) * 2011-12-02 2012-09-12 华为技术有限公司 Method and apparatus for realizing message passing amid cloud information service

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361065B (en) * 2014-11-04 2018-07-06 福建亿榕信息技术有限公司 The ordered sequence generation method of distributed system based on Zookeeper
CN104361065A (en) * 2014-11-04 2015-02-18 福建亿榕信息技术有限公司 Orderly sequence number generating method of Zookeeper-based distributed system
CN104754036A (en) * 2015-03-06 2015-07-01 合一信息技术(北京)有限公司 Message processing system and processing method based on kafka
CN105204776A (en) * 2015-08-18 2015-12-30 北京京东尚科信息技术有限公司 Data processing method and device
CN105204776B (en) * 2015-08-18 2019-06-04 北京京东尚科信息技术有限公司 Data processing method and device
CN107438061B (en) * 2016-05-27 2020-03-03 北京京东尚科信息技术有限公司 Method and device for authenticating kafka client
CN107438061A (en) * 2016-05-27 2017-12-05 北京京东尚科信息技术有限公司 A kind of method and apparatus of kafka clients authentication
CN106170013A (en) * 2016-06-29 2016-11-30 上海浦东发展银行股份有限公司信用卡中心 A kind of Kafka message uniqueness method based on Redis
CN106375462A (en) * 2016-09-13 2017-02-01 北京百度网讯科技有限公司 Method and device for realizing message persistence in distributed message system
CN106371366A (en) * 2016-09-22 2017-02-01 南京中新赛克科技有限责任公司 ARM architecture-based big data acquisition and analysis platform
CN107562810A (en) * 2017-08-10 2018-01-09 北京时代云英科技有限公司 Video big data is classified storage method
CN110162410A (en) * 2018-02-12 2019-08-23 北京京东尚科信息技术有限公司 A kind of message treatment method and device
CN109190025B (en) * 2018-08-21 2021-09-14 北京京东尚科信息技术有限公司 Information monitoring method, device, system and computer readable storage medium
CN109190025A (en) * 2018-08-21 2019-01-11 北京京东尚科信息技术有限公司 information monitoring method, device, system and computer readable storage medium
WO2020042612A1 (en) * 2018-08-31 2020-03-05 华为技术有限公司 Method and device for storing and reading a message, server, and storage medium
CN111741041A (en) * 2019-07-10 2020-10-02 北京京东尚科信息技术有限公司 Message processing method and device, electronic equipment and computer readable medium
CN111741041B (en) * 2019-07-10 2023-05-12 北京京东尚科信息技术有限公司 Message processing method and device, electronic equipment and computer readable medium
CN112380155A (en) * 2019-09-25 2021-02-19 北京城建设计发展集团股份有限公司 Cloud-based rail transit integrated data bus communication method and system
WO2021082073A1 (en) * 2019-10-30 2021-05-06 平安科技(深圳)有限公司 Method and system for dynamic selection of storage partitions, computer device, and storage medium
CN111786750A (en) * 2020-06-30 2020-10-16 深圳前海微众银行股份有限公司 Message query method and message receiving terminal
CN114461407A (en) * 2022-04-13 2022-05-10 杭州涂鸦信息技术有限公司 Data processing method, data processing device, distribution server, data processing system, and storage medium
CN114461407B (en) * 2022-04-13 2022-08-26 杭州涂鸦信息技术有限公司 Data processing method, data processing device, distribution server, data processing system, and storage medium

Also Published As

Publication number Publication date
CN102955717B (en) 2015-05-20

Similar Documents

Publication Publication Date Title
CN102955717B (en) Message management equipment and method in distributed message processing system
CN102981911B (en) Distributed message handling system and device and method thereof
US9043383B2 (en) Stream processing using a client-server architecture
CN103002010B (en) A kind of data-updating method based on incremental data, device and system
WO2019153488A1 (en) Service configuration management method, apparatus, storage medium and server
CN103034540B (en) Distributed information system and equipment thereof and coordination approach
US8296774B2 (en) Service-based endpoint discovery for client-side load balancing
CN109981716A (en) A kind of micro services call method and device
JP2009530736A (en) Estimation of initial dynamic rendering control data
CN103034541B (en) A kind of distributed information system and equipment therein and method
CN110753129A (en) Message transmission method, system, apparatus, device, and computer-readable storage medium
CN112751847A (en) Interface call request processing method and device, electronic equipment and storage medium
CN103324713A (en) Data processing method and device in multistage server and data processing system
CN110764688A (en) Method and device for processing data
US20070118841A1 (en) Monitoring message queues and starting processing applications
CN104580428B (en) A kind of data routing method, data administrator and distributed memory system
CN105373563B (en) Database switching method and device
CN112689248A (en) Message processing method and system
CN104636135B (en) A kind of node visit method and system, Client Agent and client
JP6034368B2 (en) Authentication information processing
CN118677710A (en) Ad hoc network group for message restriction for computing device peer matching
US20100332604A1 (en) Message selector-chaining
US20110246553A1 (en) Validation of internal data in batch applications
WO2019242279A1 (en) Message processing method and device
US11757959B2 (en) Dynamic data stream processing for Apache Kafka using GraphQL

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150520

Termination date: 20211105