Message processing method and device, computer equipment and storage medium

By adding a global number to the message storage object, the problem of data transmission disorder in traditional technology is solved, and orderliness and reliability after data transmission are achieved.

CN118779121APending Publication Date: 2024-10-15TENCENT CLOUD COMPUTING (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310357813.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-04
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

In traditional data migration technology, when a message transmission device uses multiple queues to store data, the orderliness of data transmission cannot be guaranteed, resulting in a failure to guarantee the orderliness of data after transmission.

Method used

By adding a global number to the message storage object, you ensure that each message is processed in order when transmitted, ensuring that the target message is processed in the receiving device in the same order as the original message in the message flow.

Benefits of technology

It achieves orderliness after data transmission, improves the reliability of data transmission, ensures that messages are processed in the original order in the receiving device, and solves the problem of ensuring data orderliness in traditional technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779121A_ABST
    Figure CN118779121A_ABST
Patent Text Reader

Abstract

The invention relates to a message processing method and device, computer equipment and a storage medium. The method comprises the following steps of: sequentially determining original messages from a message flow of a message storage object to be written in in sequence; determining a current message sending queue from the message sending queues, and writing a target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding a corresponding global number on the basis of the original message, and the global number added to the later determined original message is greater than the global number added to the previous determined original message; respectively writing the target messages in the corresponding message sending queues into the message storage queues; the target message written in each message storage queue is used for being transmitted to the message receiving queue corresponding to the message storage queue. By adopting the method, the orderliness after data transmission can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data migration, and in particular to a message processing method, apparatus, computer equipment and storage medium. Background Art

[0002] With the development of computer technology, data migration services are being used more and more widely. Data Transmission Service (DTS) is a real-time data flow service that supports data interaction between relational databases, non-relational databases, data multi-dimensional analysis and other data sources, integrating data synchronization, migration, subscription, integration and processing. For example, data migration services can be used to migrate data from one data source to another data source, for example, data from a database on a private cloud can be migrated to a database on a public cloud.

[0003] In traditional technology, in order to isolate the speed difference between two data sources for data migration and decouple the two data sources, a message transmission device can be used to achieve data transmission between the two data sources. The message transmission device provides message transmission in a network environment based on queue and message passing technology. The message transmission device can also be called message middleware. In order to improve the efficiency of message transmission, the message transmission device usually uses multiple queues to store the data to be transmitted.

[0004] However, since multiple queues are used to store messages, it is impossible to ensure that each message is transmitted to the data source in an orderly manner during the transmission process, resulting in the inability to ensure the orderliness of data after transmission. Summary of the invention

[0005] Based on this, it is necessary to provide a message processing method, device, computer equipment, computer-readable storage medium and computer program product that can ensure the orderliness of data after transmission in order to solve the above technical problems.

[0006] On the one hand, the present application provides a message processing method. The method includes: determining the original message from the message stream to be written into the message storage object in sequence; the message storage object is provided by a message transmission device, and the message storage object includes multiple message storage queues, each of which has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in a message receiving device; determining the current message sending queue from each of the message sending queues, and writing the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding a corresponding global number to the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; writing the target message in the corresponding message sending queue into each of the message storage queues; wherein the target message written in each of the message storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0007] On the other hand, the present application also provides a message processing device. The device includes: a message determination module, which is used to determine the original message from the message stream to be written into the message storage object in sequence; the message storage object is provided by the message transmission device, and the message storage object includes multiple message storage queues, each of which has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device; a first message writing module, which is used to determine the current message sending queue from each of the message sending queues, and write the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; a message transmission module, which is used to write the target message in the corresponding message sending queue into each of the message storage queues; wherein the target message written in each of the message storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0008] On the other hand, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above message processing method when executing the computer program.

[0009] On the other hand, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps in the above-mentioned message processing method when executed by a processor.

[0010] On the other hand, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above message processing method are implemented.

[0011] In the above-mentioned message processing method, apparatus, computer equipment, storage medium and computer program product, the messages in the message stream need to be written into the message storage object. Since the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, the target message includes the global number corresponding to the original message and the original message, thereby realizing the transmission of the original message and the global number of the original message by transmitting the target message. Since the original messages are determined from the message stream in sequence, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby ensuring the orderliness after data transmission.

[0012] On the other hand, the present application also provides a message processing method. The method includes: receiving a message sending device to send a message write request for a first message storage queue in a message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each of the message sending queues is obtained by adding a corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message flow to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; the target message carried in the message write request is written into the first message storage queue; wherein the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target message stored in each of the consumer storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0013] On the other hand, the present application also provides a message processing device. The device comprises: a request receiving module, which is used to receive a message write request sent by a message sending device to a first message storage queue in a message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each of the message sending queues is obtained by adding a corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message flow to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; a second message writing module, which is used to write the target message carried in the message write request into the first message storage queue; wherein the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target message stored in each of the consumption storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0014] On the other hand, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above message processing method when executing the computer program.

[0015] On the other hand, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps in the above-mentioned message processing method when executed by a processor.

[0016] On the other hand, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above message processing method are implemented.

[0017] The above-mentioned message processing method, device, computer equipment, storage medium and computer program product, since the target message is obtained by adding the corresponding global number on the basis of the original message to be written, the target message includes the global number corresponding to the original message and the original message. Since the original messages are determined in sequence from the message stream to be written to the message storage object, the global number added to the original message determined later is greater than the global number added to the original message determined earlier. Therefore, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby ensuring the orderliness after data transmission.

[0018] On the other hand, the present application also provides a message processing method. The method includes: sending a message reading request for a second message storage queue in a message storage object to a message transmission device; the multiple message storage queues included in the message storage object have corresponding message sending queues in the message sending device respectively; the target message in each of the message storage queues comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding a corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; receiving the target message returned by the message transmission device in response to the message reading request; the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device has a message receiving queue corresponding to each of the message storage queues; writing the returned target message into the message receiving queue corresponding to the second message storage queue, and processing the original message included in the target message according to the global number of the target message in each of the message receiving queues.

[0019] On the other hand, the present application also provides a message processing device. The device includes: a request sending module, which is used to send a message reading request for a second message storage queue in a message storage object to a message transmission device; the multiple message storage queues included in the message storage object have corresponding message sending queues in the message sending device respectively; the target message in each of the message storage queues comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding a corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; a message receiving module, which is used to receive the target message returned by the message transmission device in response to the message reading request; the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device has a message receiving queue corresponding to each of the message storage queues; a message processing module, which is used to write the returned target message into the message receiving queue corresponding to the second message storage queue, and process the original message included in the target message according to the global number of the target message in each of the message receiving queues.

[0020] On the other hand, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above message processing method when executing the computer program.

[0021] On the other hand, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps in the above-mentioned message processing method when executed by a processor.

[0022] On the other hand, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above message processing method are implemented.

[0023] The above-mentioned message processing method, device, computer equipment, storage medium and computer program product, since the target message is obtained by adding the corresponding global number on the basis of the original message to be written, the target message includes the global number corresponding to the original message and the original message. Since the original messages are determined in sequence from the message stream to be written to the message storage object, the global number added to the original message determined later is greater than the global number added to the original message determined earlier. Therefore, the global number in the target message reflects the order of the original message in the message stream. Since the message receiving device processes the original message included in the target message according to the global number of the target message in each message receiving queue, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed according to the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby ensuring the orderliness after data transmission.

[0024] On the other hand, the present application also provides a message processing system. The system includes: a message sending device, which is used to send a message write request for a first message storage queue in a message storage object to a message transmission device; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue. The target message written in each of the message sending queues is obtained by adding a corresponding global number to the original message to be written, and the global number of the target message written to the message sending queue later is greater than the global number of the target message written to the message sending queue earlier; the message transmission device is used The target message carried in the message write request is written into the first message storage queue; a message receiving device is used to send a message read request for the second message storage queue in the message storage object to the message transmission device, and receive the target message returned by the message transmission device in response to the message read request, wherein the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device includes message receiving queues corresponding to each of the message storage queues; the returned target message is written into the message receiving queue corresponding to the second message storage queue, and the original message included in the target message is processed according to the global number of the target message in each of the message receiving queues.

[0025] In the above-mentioned message processing system, the messages in the message stream need to be written into the message storage object. Since the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, the target message includes the global number corresponding to the original message and the original message, thereby realizing the transmission of the original message and the global number of the original message by transmitting the target message. Since the original messages are determined from the message stream in sequence, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby ensuring the orderliness after data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1A It is an application environment diagram of the message processing method in some embodiments;

[0027] Figure 1B It is an application environment diagram of the message processing method in some embodiments;

[0028] Figure 2 A schematic diagram of a flow chart of a message processing method in some embodiments;

[0029] Figure 3 A schematic diagram after adding global numbering for some embodiments;

[0030] Figure 4 The state of the message sending queue in some embodiments;

[0031] Figure 5 A schematic diagram of a message sending device writing a target message to a message storage device in some embodiments;

[0032] Figure 6 A schematic diagram of a message receiving device processing a target message in some embodiments;

[0033] Figure 7 The state of the message storage queue after restart in some embodiments;

[0034] Figure 8 In some embodiments, the state of each message storage queue after a new target message is rewritten;

[0035] Fig. 9 In some embodiments, the state of each message storage queue after a new target message is rewritten;

[0036] Fig.10 A schematic diagram of a flow chart of a message processing method in some embodiments;

[0037] Fig.11 A schematic diagram of a flow chart of a message processing method in some embodiments;

[0038] Fig.12 A state diagram of a message receiving queue after a new target message is written in some embodiments;

[0039] Fig.13 A state diagram of a message receiving queue in some embodiments in which a target message is lost;

[0040] Fig.14 A schematic diagram of a flow chart of a message processing method in some embodiments;

[0041] Fig.15 is a structural block diagram of a message processing device in some embodiments;

[0042] Fig.16 is a structural block diagram of a message processing device in some embodiments;

[0043] Fig.17 is a structural block diagram of a message processing device in some embodiments;

[0044] Fig.18 is an internal structure diagram of a computer device in some embodiments;

[0045] Fig.19 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0047] The message processing method provided in the embodiment of the present application can be applied to Figure 1A In the application environment shown. The application environment includes a message sending device 102, a message transmission device 104, a message receiving device 106, a first data source device 108 and a second data source device 110. Among them, the message sending device 102, the message transmission device 104, the message receiving device 106, the first data source device 108 and the second data source device 110 communicate through a network. The data storage system can store data that the message transmission device 104 needs to process. The data storage system can be integrated on the message transmission device 104, or it can be placed on the cloud or other servers. The first data source device 108 and the second data source device 110 are both devices where the data source is located, and the data source is used to store data, for example, it can be a database. The data source on the first data source device 108 can be called a source library or a source database. The data source on the second data source device 110 can be called a target library or a target database.

[0048] The message sending device 102, the message transmission device 104 and the message receiving device 106 are used to transmit the data in the first data source device 108 to the second data source device 110. The message sending device 102 can read data from the first data source device 108 to obtain a message, and write the message to the message transmission device 104. The message receiving device 106 can read the message from the first data source device 108 from the message transmission device 104, and write the read message to the second data source device 110. The message can be understood as the data form used by the data read from the data source during the transmission process. The data read from the data source can be a picture or text, and the message can be the binary data of the picture or text. The message transmission device 104 provides a message storage object, and the message storage object includes multiple message storage queues. The message sending device 102 includes a message sending queue corresponding to each message storage queue. The message receiving device 106 includes a message receiving queue corresponding to each message storage queue. Message storage queues, message sending queues, and message receiving queues are all queues. A queue is a structure for storing data, including a head and a tail. Data is written from the tail of the queue and removed from the head of the queue, with a first-in, first-out feature.

[0049] In order to ensure data consistency, that is, to ensure that the relative order before and after data transmission is unchanged, it can be achieved through the orderliness of the message. Specifically, the message sending device 102 can send a message write request for the first message storage queue in the message storage object to the message transmission device 104, the message write request carries the target message, the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue, and the target message written in each message sending queue is obtained by adding the corresponding global number on the basis of the original message to be written, and the global number of the target message written to the message sending queue later is greater than the global number of the target message written to the message sending queue earlier. The original message is a message formed by the data obtained from the first data source device 108. The message can be the data itself, or the format of the data can be converted into binary to obtain the message. The message transmission device 104 can write the target message carried in the message write request to the first message storage queue. The message receiving device 106 can send a message read request for the second message storage queue in the message storage object to the message transmission device 104, and receive the target message returned by the message transmission device 104 in response to the message read request. The returned target message is the target message obtained by the message transmission device 104 from the second message storage queue. The message receiving device 106 may write the returned target message into the message receiving queue corresponding to the second message storage queue, and process the original message included in the target message according to the global number of the target message in each message receiving queue. Processing the original message included in the target message includes, but is not limited to, writing the original message into the second data source device 110.

[0050] Among them, the message sending device 102, the message transmission device 104, the message receiving device 106, the first data source device 108 and the second data source device 110 can be, but are not limited to, various desktop computers, laptop computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Alternatively, the message sending device 102, the message transmission device 104, the message receiving device 106, the first data source device 108 and the second data source device 110 can be independent physical servers, or server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server may be connected directly or indirectly via wired or wireless communication, which is not limited in this application.

[0051] Among them, cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a basic capability provider for cloud computing, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices. According to the logical function division, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service (Software as a Service) layer, or SaaS can be directly deployed on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS. Database (Database), in short, can be regarded as an electronic filing cabinet - a place to store electronic files, where users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application.

[0052] The message processing method provided in the present application can be applied to cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. For example, it can be applied to the data migration of a cloud database, for example, it can be applied to migrate data in a cloud database to an ordinary database, or it can be applied to migrate data from an ordinary database to a cloud database, and of course, it can also migrate data from one cloud database to another database. For example, in the message processing method provided in the present application, at least one of the first data source device 108 or the second data source device 110 can be a cloud database.

[0053] In some embodiments, the message sending device 102 is a device where the production end is located, the message transmission device 104 is a device where the message middleware is located, and the message receiving device 106 is a device where the consumer end is located. The message processing method provided in this application can be applied to Figure 1B In the scenario shown, the producer is responsible for producing sequential messages and storing the messages in the message middleware for persistence. The consumer then consumes the messages from the message middleware and restores them to sequential messages, and then performs subsequent business logic. The message middleware includes but is not limited to Kafka, which is a distributed publish-subscribe messaging system. The message storage object can be a topic provided by the message middleware. Consumers can subscribe to topics to get messages from the topic. Each message storage queue in the message storage object can be called a partition in the topic. A topic can have multiple partitions, and multiple means at least two.

[0054] In some embodiments, Figure 2 As shown, a message processing method is provided, which can be executed by a terminal or a server, or can be executed by a terminal and a server together. Figure 1A The message sending device in is taken as an example to illustrate, including the following steps:

[0055] Step 202, determine the original message in order from the message stream to be written into the message storage object; the message storage object is provided by the message transmission device, and the message storage object includes multiple message storage queues, each message storage queue has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device.

[0056] Among them, the message stream is a sequence of messages arranged, and the message sending queue is stored in the message sending device. The original message is a message obtained in sequence from the message stream to be written to the message storage object. Obtaining messages in sequence means obtaining one message from the message stream in order from front to back each time. The message stream can be stored in a queue, and the front messages in the message stream are closer to the head of the queue. For example, the message stream is (a1, a2, a3, …, an), where a1 to an are n messages, then a1 is obtained first to obtain the original message, and then a2 is obtained to obtain the original message. The message sending queue can be stored in the memory of the message sending device. The message receiving queue can be stored in the memory of the message receiving device. Multiple message storage queues refer to at least two message storage queues, for example, 3 message storage queues.

[0057] Specifically, the message stream is obtained by the message sending device from a data source, for example, it can be obtained from a data source in a first data source device. The message sending device can continuously obtain new messages from the data source and add them to the end of the existing message stream, and can remove messages in the message storage queue that have been written into the message storage object in the message stream from the message stream, thereby updating the message stream in real time.

[0058] Step 204, determine the current message sending queue from each message sending queue, and write the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0059] Among them, the target message includes a global number, and different target messages have different global numbers. Since the original messages are obtained in sequence, a global number can be added to the original message each time the original message is obtained, and the global number added to the original message obtained later is greater than the global number added to the original message obtained earlier. For example, in the message stream (a1, a2, a3, ..., an), the global number added to a2 is greater than the global number added to a1. The global numbers added to the original messages obtained twice in a row can be continuous, and the global number can be a continuously increasing integer. For example, the initial global number is 1, and it increases continuously by 1, so that the global numbers added to each original message are 1, 2, 3... in sequence. For example, in the message stream (a1, a2, a3, ..., an), the global numbers added to a1, a2, a3, ..., an are 1, 2, 3...n respectively.

[0060] The current message sending queue is any message sending queue in each message sending queue. The current message sending queue can be determined from each message sending queue according to the traversal order. The traversal order refers to the order of traversing each message sending queue. Taking three message sending queues as an example, namely D1, D2 and D3, the traversal order can be D1→D2→D3. The traversal can be performed in a loop, that is, after traversing once, it is traversed again. For example, after traversing to D3 in the order of D1→D2→D3, it is traversed again in the order of D1→D2→D3. The traversal is continuously looped. During the traversal process, the message sending queue traversed each time is determined as the current message sending queue, and the target message is written into the current message sending queue, thereby completing a traversal. A different target message is written into each message sending queue.

[0061] Specifically, the target message may also include a local number. After obtaining the original message, the message sending device may add the corresponding global number on the basis of the original message to obtain the global message corresponding to the original message, so that the global message corresponding to the original message includes the original message and the global number. After determining the current message sending queue, the message sending device may add the corresponding local number on the basis of the global message corresponding to the original message to obtain the target message corresponding to the original message, so that the target message includes the original message, the local number corresponding to the original message, and the global number corresponding to the original message. Among them, in the current message sending queue, the local number of the target message written first is less than the local number of the target message written later, and the local numbers of the target messages written twice adjacently are continuous. That is to say, for each message sending queue, the target message written first to the message sending queue has a local number that includes, which is less than the local number of the target message written later to the message sending queue, and the local numbers of the target messages written twice adjacently to the message sending queue are continuous. The local number is an integer. In each message sending queue, from the head to the tail, the local numbers of the stored target messages are successively increasing and continuous. For example, from the head to the tail in the message sending queue, the local numbers of the stored target messages are successively 1, 2, 3, 4...

[0062] In some embodiments, a message sending device provides a production end corresponding to each message sending queue. For each message sending queue, the message sending device can write the target message into the message sending queue through the production end corresponding to the message sending queue. In the message sending device, each message sending queue can be uniquely identified by the identifier of the message storage object and the identifier of the message storage queue corresponding to the message sending queue. Taking the message storage object as topic A, the message storage queue as the partition of topic A, and the message storage object including 3 message storage queues, that is, the topic including 3 partitions as an example, the 3 partitions are partition 0, partition 1 and partition 2, respectively, then the message sending queue corresponding to partition 0 can be uniquely identified by the identifier of partition 0 and the identifier of topic A, the message sending queue corresponding to partition 1 can be uniquely identified by the identifier of partition 1 and the identifier of topic A, and the message sending queue corresponding to partition 2 can be uniquely identified by the identifier of partition 2 and the identifier of topic A. Since the partition and the message sending queue are in a one-to-one correspondence. Therefore, the production end corresponding to the message sending queue can also be called the production end corresponding to the partition, that is, the message storage queue.

[0063] Step 206, write the target message in the corresponding message sending queue into each message storage queue respectively; wherein, the target message written in each message storage queue is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0064] Each message storage queue in the message storage object has a corresponding message sending queue in the message sending device, and the message storage queue and the message sending queue have a one-to-one correspondence.

[0065] Specifically, for each message sending queue, the message sending device can write the target message in the message sending queue into the corresponding message storage queue. For example, the message sending device obtains the target message from the head of the message sending queue to obtain the head message of the message sending queue. After writing the head message of the message sending queue to the corresponding message storage queue, the head message in the message sending queue is removed, and the step of obtaining the target message from the head of the message sending queue to obtain the head message of the message sending queue is returned to execute, thereby writing the target message to the message storage queue in sequence.

[0066] In some embodiments, each message storage queue of the message storage object has a corresponding message receiving queue in the message receiving device, and the message storage queue corresponds to the message receiving queue one by one. Similarly, in the message receiving device, each message receiving queue can be uniquely identified by using the identifier of the message storage object and the identifier of the message storage queue corresponding to the message receiving queue.

[0067] In some embodiments, a message receiving device provides a consumer end corresponding to each message receiving queue. For each message receiving queue, the message receiving device can read the target message from the message storage queue corresponding to the message receiving queue through the consumer end corresponding to the message receiving queue, and write the read target message into the message receiving queue, thereby transmitting the target message from the message sending device to the message receiving device. The consumer end corresponding to the message receiving queue can also be referred to as the consumer end corresponding to the partition corresponding to the message receiving queue, that is, the message storage queue. In the process of writing the target message read from the message storage queue into the corresponding message receiving queue, the target message is read from the message storage queue in sequence from the head of the queue to the tail of the queue. The message receiving device can record the reading position in the message storage queue. After writing the target message at the reading position into the message receiving queue, the reading position is moved to the position of the next target message along the direction from the head of the queue to the tail of the queue, and the moved position is determined as the new reading position. The step of writing the target message at the reading position into the message receiving queue is repeated, thereby orderly writing the target message in the message storage queue into the corresponding message receiving queue, so that the sorting method of the target message in the message receiving queue is consistent with the arrangement method of the target message in the message storage queue.

[0068] In some embodiments, the message receiving device may write the target messages in each message receiving queue into the message merging queue in the order of the global numbers from small to large, and process the original messages included in the target messages in the message merging queue in sequence. The message merging queue is also a queue, and the target message is written from the end of the message merging queue. Specifically, the message receiving device may traverse each message receiving queue in the traversal order for each message receiving queue, determine the traversed message receiving queue as the current message receiving queue, read a target message from the message receiving queue, and write the target message into the message merging queue. Since the message storage queue corresponds one-to-one to the message sending queue, and the message storage queue corresponds one-to-one to the message receiving queue, the message sending queue and the message receiving queue also correspond one-to-one. The traversal order for each message sending queue can be consistent with the traversal order for each message receiving queue. For example, taking 3 message sending queues and 3 message receiving queues as an example, the 3 message sending queues are D1, D2 and D3, and the 3 message receiving queues are R1, R2 and R3, D1 corresponds to R1, D2 corresponds to R2, and D3 corresponds to R3. If the traversal order for the 3 message sending queues is D1→D2→D3, the traversal order for the 3 message receiving queues is R1→R2→R3. The message receiving device can traverse each message receiving queue in a loop, that is, traverse again after traversing once, and traverse continuously in a loop. During the traversal process, a target message is read from the head of the message receiving queue each time traversed, and when the global number of the read target message is greater than the global number of the target message at the end of the message merging queue, the read target message is written into the message merging queue. Thus, a traversal is completed, and for each message receiving queue, a target message in the message receiving queue is written into the message merging queue.

[0069] The message storage object is a topic provided by the message middleware, the message storage queue in the message storage object is a partition, and the topic includes 3 partitions, namely partition 0, partition 1 and partition 2. The message processing method provided by the present application is illustrated by way of example. Figure 3 As shown, Figure 3 (a) shows a schematic diagram of the message flow. Figure 3 (b) in FIG. 1 shows a schematic diagram of adding a global number to each message in a message flow, where GS is the abbreviation of Global Sequence, and the number following GS represents the number, for example, GS1 represents a global number of 1. Figure 3 (b) is a message sending device, which determines the original message in the message flow in Figure (a) in sequence, and adds the corresponding global number to the original message to obtain the global message corresponding to the original message. Figure 3 The "message" in (b) is the original message. It can be seen that Figure 3 Each "message" in (b) corresponds to a global number, and the whole of the "message" and the corresponding global number is the global message corresponding to the original message.

[0070] The message sending device can determine the global message to be written according to the global number in ascending order, and implement a circular traversal of the message sending queues corresponding to each partition according to the circular writing rule, and determine the local number according to the traversed message sending queue, and write the determined local number and the target message corresponding to the original message composed of the global message to be written, and write the obtained target message into the traversed message sending queue. For example, if the traversal order is the message sending queue of partition 0 → the message sending queue of partition 1 → the message sending queue of partition 2, and the global number increases from 1, then Figure 3 In (b), the global message with global number GS1 is written to the message sending queue corresponding to partition 0 after adding the corresponding local sequence number. The global message with global number GS2 is written to the message sending queue corresponding to partition 1 after adding the corresponding local sequence number, and so on. Figure 4 As shown, a schematic diagram showing the target messages stored in the message sending queues corresponding to partition 0, partition 1, and partition 2 respectively is shown. Figure 4 In the table, "partition 0 production end" refers to the production end corresponding to partition 0, "partition 1 production end" refers to the production end corresponding to partition 1, and "partition 2 production end" refers to the production end corresponding to partition 2. Figure 4 In the diagram, PS is the abbreviation of Partition Sequence, and the number following PS represents the local number. The arrow of "Partition 0 Producer" points to the message sending queue corresponding to Partition 0. The arrow of "Partition 1 Producer" points to the message sending queue corresponding to Partition 1. The arrow of "Partition 2 Producer" points to the message sending queue corresponding to Partition 2.

[0071] When the message sending device writes the target message into each message sending queue, it can also write the target message in each message sending queue into the corresponding message storage queue in the message storage device. Figure 5 As shown, it shows a schematic diagram of each target message stored in partition 0-partition 2 in the message middleware after the target message in the message sending queue corresponding to partition 0-partition 2 is written to partition 0-partition 2 provided by the message middleware. Figure 5 It can be seen that the global serial numbers of the target messages in each message storage queue are different and increase. In the same message storage queue, the local serial numbers of each target message are continuous and increase.

[0072] The message receiving device can write the target message in partition 0-partition 2 in the message middleware to the message receiving queues corresponding to partition 0-partition 2, and can read one target message from each message receiving queue at a time in the order of global numbers from small to large, write it to the message merging queue, and process the target messages in sequence starting from the head of the message merging queue, for example, extract the original message from the target message, and write the original message to the data source of the second data source device. Figure 6 As shown, a schematic diagram of each target message stored in the message receiving queue corresponding to each partition 0-partition 2 is shown, and a schematic diagram of writing the target message into the message merging queue by means of "multi-way merging" is shown. "Multi-way merging" is used to determine the target message to be written into the message merging queue from partition 0-partition 2.

[0073] In the above message processing method, the messages in the message stream need to be written into the message storage object. Since the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, the target message includes the global number corresponding to the original message and the original message, thereby realizing the transmission of the original message and the global number of the original message by transmitting the target message. Since the original messages are determined from the message stream in sequence, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0074] In some embodiments, before writing the target message corresponding to the original message into the current message sending queue, it also includes: adding the corresponding global number on the basis of the original message to obtain the global message corresponding to the original message; writing the target message corresponding to the original message into the current message sending queue includes: adding the corresponding local number on the basis of the global message corresponding to the original message to obtain the target message corresponding to the original message; writing the target message corresponding to the original message into the current message sending queue; in the current message sending queue, the local number of the target message written first is smaller than the local number of the target message written later, and the local numbers of the two adjacent target messages written are continuous.

[0075] The current message sending queue is any message sending queue among the message sending queues. The current message sending queue may be determined from the message sending queues according to a traversal order, where the traversal order refers to an order of traversing the message sending queues.

[0076] Specifically, after obtaining the original message, the message sending device can add the corresponding global number to the original message to obtain the global message corresponding to the original message, so that the global message corresponding to the original message includes the original message and the global number. After determining the current message sending queue, the message sending device can add the corresponding local number to the global message corresponding to the original message to obtain the target message corresponding to the original message, so that the target message includes the original message, the local number corresponding to the original message, and the global number corresponding to the original message.

[0077] In this embodiment, since the target message includes the original message, the local number corresponding to the original message, and the global number corresponding to the original message, global and local order of the messages can be achieved through the local number and the global number, thereby improving the reliability of data transmission and ensuring the order after data transmission.

[0078] In some embodiments, the message stream comes from a data source; the method also includes: in the process of writing a target message to a message storage queue in a message storage object, recording the position of an original message corresponding to at least part of the written target message in the data source; in response to restarting the message sending task, obtaining the target position from the recorded position; starting to obtain messages from the target position in the data source, obtaining a message stream to be written to the message storage object after the restart, and returning to execute the steps of determining the original message in sequence from the message stream to be written to the message storage object.

[0079] The data source refers to the data source in the first data source device.

[0080] Specifically, in the process of writing the target message to the message storage queue in the message storage object, the message storage device can periodically write the location of the original message included in the target message in the message storage object at the current moment in the data source, for example, every 10 seconds, record the location of the original message included in the target message written to the message storage object at the current moment in the data source. In the case of a restart of the message sending task, the message sending device can select a location from each recorded location as the target location, start to obtain messages from the target location in the data source, obtain the message stream to be written to the message storage object after the restart, and return to execute the steps of determining the original message from the message stream to be written to the message storage object in sequence. For example, the terminal can use the location recorded at the moment closest to the current moment as the target location. Of course, other locations among the recorded locations can also be used as the target location, and there is no limitation here.

[0081] Among them, the message sending task refers to the task of writing messages to the message storage object in the message storage device in the message sending device. Each message sending queue in the message sending device corresponds to a production end, and the production end in the message sending device can write the target message in the corresponding message sending queue to the corresponding message storage queue. Each production end independently and concurrently writes asynchronously, and the writing progress may not be consistent. After the message sending task is restarted, the message sending device can view the status of each message storage queue in the message storage object in the message storage device before the sending task is restarted. Since each production end independently and concurrently writes asynchronously, the writing progress may not be consistent. After the message sending task is restarted, the number of target messages stored in each message storage queue in the message storage object may be different. Figure 7 As shown in the figure, three different states of each message storage queue in the message storage object are shown after the message sending task is restarted. Figure 7 As can be seen in (b), the target message with global number GS7 in partition 0 is not written to partition 0. Figure 7 It can be seen from (c) that the target message with global number GS7 in partition 0 is not written into partition 0, and the target message with global number GS8 in partition 1 is not written into partition 1 either.

[0082] Restarting the message sending task will cause the loss of the message stream stored in the message sending device. When the message sending task is restarted, the message sending device obtains the target position from the recorded position, and starts to obtain messages from the target position in the data source to obtain the message stream to be written into the message storage object after the restart, that is, the message stream of the acquired information. Since the message stream is obtained from the target position, and the message at the target position has been written into the message storage queue of the message storage object before the restart of the sending task, therefore, by obtaining the message stream from the target position, a part of the messages can be repeatedly written into the message storage object, so that the messages that have not been written into the message storage queue when the message sending task is restarted are successfully written, thereby ensuring that data is not lost and the orderliness of data transmission is guaranteed.

[0083] In this embodiment, in response to restarting the message sending task, the target location is obtained from the recorded location, and messages are obtained starting from the target location in the data source to obtain a message stream to be written to the message storage object after the restart, thereby ensuring that data is not lost and that data transmission is orderly.

[0084] In some embodiments, the current message sending queue is determined from each message sending queue in a loop traversal manner; the method also includes: in response to restarting the message sending task, determining the tail message of each message storage queue; determining the message storage queue to which the tail message with the largest global number among the tail messages belongs, obtaining a reference storage queue, and determining the message sending queue corresponding to the reference storage queue as the reference sending queue; determining the next message sending queue of the reference sending queue from each message sending queue in a traversal order, and using the next message sending queue as the current message sending queue; returning to the step of writing the target message corresponding to the original message into the current message sending queue.

[0085] The tail message of the message storage queue is a target message obtained from the tail of the message storage queue.

[0086] Specifically, in the case of restarting the message sending task, the message sending device can search for the tail message in each message storage object, determine the tail message with the largest global number from the tail messages found, and determine the message storage queue where the tail message with the largest global number is located as the reference storage queue. After determining the reference storage queue, the message sending device can determine the message sending queue corresponding to the reference storage queue, use the message sending queue as the reference sending queue, and perform a loop traversal of each message sending queue starting from the next message sending queue of the reference sending queue in the order of traversing each message sending queue. In addition, the message sending device determines the largest global number from the global numbers of each tail message found by the message sending device as the base global number after restart, and determines the original message from the message stream to be written into the message storage object in order, and increments the global number corresponding to the original message according to the base global number after restart. For example, if the base global number is GS9, the global number of the first target message generated after restart is GS10. Therefore, after the message sending task is restarted, the global numbers of the target messages written before and after the restart are monotonically increasing as a whole, but can be discontinuous, thereby achieving global orderliness of the data.

[0087] In this embodiment, when the message sending task is restarted, the current message sending queue after the restart is determined according to the global number of the target message stored in the message storage queue, so that the process of traversing each message sending queue and writing the target message into each message sending queue can be returned to ensure that the messages are written in an orderly manner, thereby improving the orderliness of data transmission.

[0088] In some embodiments, adding a corresponding global number on the basis of the original message to obtain a global message corresponding to the original message includes: determining a base global number corresponding to the message storage object; the base global number refers to the global number of the target message last written into each message sending queue; incrementing the base global number to obtain an incremented global number; adding the incremented global number to the original message to obtain a global message corresponding to the original message.

[0089] The base global number is used to determine the global number corresponding to the next original message. In the process of writing the target message, the global number of the target message of the message sending queue that was last written up to the current time can be used as the base global number.

[0090] Specifically, when determining the original message to be written, the message sending device can increment the base global number to obtain an incremented global number, where increment means incrementing by 1, and add the incremented global number to the original message to obtain the global message corresponding to the original message.

[0091] In this embodiment, the global number corresponding to the original message is determined by incrementing the benchmark global number, so that the global number added to the original message determined later is greater than the global number added to the original message determined earlier, so that the global number increases monotonically and orderly data transmission is achieved.

[0092] In some embodiments, the method further includes: in response to restarting the message sending task, determining the tail message of each message storage queue; determining the largest global number among the global numbers of the tail messages as the base global number corresponding to the message storage object after restart.

[0093] Take an example to illustrate the situation after the message sending task is restarted, and the message sending device stores the new target message in each message storage queue in the message storage object, such as Figure 8 and Fig. 9 As shown, the bold display in partition 0-partition 2 is the target message newly written after the restart. Fig. 9 The first target message newly written in is the target message with global number GS9 and local number PS3. Since the message flow after restart is the message flow obtained from the target position, the original message included in the target message with global number GS9 and local number PS3 has been written to the message storage queue of the message storage object. For example, the message at the target position is Fig. 9 The original message included in the target message with global number GS4 and local number PS2 in the target message, so that the newly written target message will cause the original message that has been written to be written again, thereby repeatedly writing a section of the message, so that the message that was not successfully written into the message storage object due to the restart is successfully written, for example Figure 7 The target message with the global number GS7 was not successfully written into partition 0 of (b). After restarting, the original message included in the target message with the global number GS7 was regenerated into a target message with a larger global number by repeatedly writing a part of the message. By writing the target message with the larger global number, the original message was written into the message storage queue.

[0094] In this embodiment, the largest global number among the global numbers of the tail messages of each queue is determined as the base global number corresponding to the message storage object after restart, so that the global number can be monotonically increased to achieve orderly data transmission.

[0095] In some embodiments, Fig.10 As shown, a message processing method is provided, which can be executed by a terminal or a server, or can be executed by a terminal and a server together. Figure 1A The message transmission device in is taken as an example to illustrate, including the following steps:

[0096] Step 1002, the receiving message sending device sends a message write request for the first message storage queue in the message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each message sending queue is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0097] Step 1004, write the target message carried in the message write request into the first message storage queue; wherein, the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target message stored in each consumer storage queue is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0098] For the relevant explanation of this embodiment, please refer to the relevant explanation of steps 202 to 206, which will not be repeated here.

[0099] In the above message processing method, since the target message is obtained by adding the corresponding global number on the basis of the original message to be written, the target message includes the global number corresponding to the original message and the original message. Since the original messages are determined in sequence from the message stream to be written to the message storage object, the global number added to the original message determined later is greater than the global number added to the original message determined earlier. Therefore, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0100] In some embodiments, the step of writing a target message corresponding to the original message into each message sending queue includes: determining the original message to be written from the message stream to be written to the message storage object in sequence; adding the corresponding global number on the basis of the original message to generate a global message corresponding to the original message; the global number of the global message generated later is greater than the global number of the global message generated earlier; determining the current message sending queue from each message sending queue, adding the corresponding local number on the basis of the global message to obtain the target message corresponding to the original message; writing the target message corresponding to the original message into the current message sending queue; in the current message sending queue, the local number of the target message written earlier is less than the local number of the target message written later, and the local numbers of the target messages written twice adjacently are continuous.

[0101] For the relevant explanation of this embodiment, please refer to the above-mentioned relevant explanation, which will not be repeated here.

[0102] In this embodiment, since the target message includes the global number and the local number, the orderly transmission of the message is guaranteed, the reliability of data transmission is improved, and the orderliness of the data after transmission is guaranteed.

[0103] In some embodiments, Fig.11 As shown, a message processing method is provided, which can be executed by a terminal or a server, or can be executed by a terminal and a server together. Figure 1A The message receiving device in is taken as an example to illustrate, including the following steps:

[0104] Step 1102, sending a message read request for the second message storage queue in the message storage object to the message transmission device; the multiple message storage queues included in the message storage object have corresponding message sending queues in the message sending device respectively; the target message in each message storage queue comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding the corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0105] Step 1104, receiving the target message returned by the message transmission device in response to the message reading request; the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device has message receiving queues corresponding to each message storage queue.

[0106] Step 1106: write the returned target message into the message receiving queue corresponding to the second message storage queue, and process the original message included in the target message according to the global number of the target message in each message receiving queue.

[0107] Specifically, the message receiving device can adopt a loop traversal method to determine the current message receiving queue from each message receiving queue, determine the global number of the target message that is last written into the message merging queue as of the current time, obtain the reference global number, obtain the head message of the current message receiving queue, and write the head message of the current message receiving queue into the message merging queue when the global number of the head message of the current message receiving queue is greater than the reference global number. When the global number of the head message of the current receiving queue is less than the reference global number, remove the head message of the current receiving queue from the current receiving queue, and return to the step of obtaining the head message of the current receiving queue.

[0108] In the above message processing method, since the target message is obtained by adding the corresponding global number on the basis of the original message to be written, the target message includes the global number corresponding to the original message and the original message. Since the original messages are determined in sequence from the message stream to be written to the message storage object, the global number added to the original message determined later is greater than the global number added to the original message determined earlier. Therefore, the global number in the target message reflects the order of the original message in the message stream. Since the message receiving device processes the original message included in the target message according to the global number of the target message in each message receiving queue, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed according to the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0109] In some embodiments, according to the global number of the target message in each message receiving queue, the original message included in the target message is processed, including: writing the target message in each message receiving queue into the message merge queue in order of the global number from small to large; according to the arrangement order of the target message in the message merge queue, the original message included in the target message is processed in sequence.

[0110] Specifically, the message merging queue is also a queue, and the target message is written from the end of the message merging queue. The message receiving device can traverse each message receiving queue according to the traversal order for each message receiving queue, determine the traversed message receiving queue as the current message receiving queue, read a target message from the message receiving queue, and write the target message into the message merging queue.

[0111] In some embodiments, the message receiving device can read the target message from the head of the message merging queue to obtain the head message of the message merging queue, write the original message included in the head message of the message merging queue to the second data source device, and when it is determined that the write is successful, remove the head message from the message merging queue, and return to execute the step of reading the target message from the head of the message merging queue, thereby writing each original message to the second data source device in order of global number from small to large, so that after the data in the first data source device is transmitted to the second data source device, the data remains consistent, the reliability of data transmission is improved, and the orderliness after data transmission is ensured.

[0112] In this embodiment, the original messages included in the target messages are processed in sequence according to the arrangement order of the target messages in the message merging queue, thereby improving the reliability of data transmission and ensuring the orderliness of data after transmission.

[0113] In some embodiments, writing the target messages in each message receiving queue into the message merging queue in order of global numbers from small to large includes: determining the current message receiving queue from each message receiving queue in a loop traversal manner; determining the global number of the target message last written into the message merging queue as of the current time to obtain a reference global number; obtaining the head message of the current message receiving queue, and when the global number of the head message of the current message receiving queue is greater than the reference global number, writing the head message of the current message receiving queue into the message merging queue.

[0114] Specifically, the reference global number refers to the global number of the target message at the end of the message merging queue at the current moment. The message receiving device obtains the head message of the current message receiving queue, and writes the head message of the current message receiving queue into the message merging queue if the global number of the head message of the current message receiving queue is greater than the reference global number.

[0115] For example, Fig.12As shown, the status of the message receiving queue after writing a new target message is displayed, among which the target message re-written after restart is displayed in bold. The message receiving device traverses each message receiving queue in the order of the message receiving queue corresponding to partition 0 → the message receiving queue corresponding to partition 1 → the message receiving queue corresponding to partition 2. First, when traversing to the message receiving queue corresponding to partition 0, the target message with the global number GS4 at the head of the message receiving queue corresponding to partition 0 is written into the message merging queue, and the target message with the global number GS4 is removed from the message receiving queue corresponding to partition 0. Then, when traversing to the message receiving queue corresponding to partition 1, the target message with the global number GS5 at the head of the message receiving queue corresponding to partition 1 is written into the message merging queue, and the target message with the global number GS5 is removed from the message receiving queue corresponding to partition 1. , and then traverse to the message receiving queue corresponding to partition 2, then write the target message with the global number GS6 at the head of the message receiving queue corresponding to partition 2 into the message merging queue, and remove the target message with the global number GS6 from the message receiving queue corresponding to partition 2. Thus, each message receiving queue is traversed once, and then each message receiving queue is traversed again in the order of the message receiving queue corresponding to partition 0 → the message receiving queue corresponding to partition 1 → the message receiving queue corresponding to partition 2. At this time, the target message at the head of the message receiving queue corresponding to partition 0 becomes the target message of GS10, and the target message at the head of the message receiving queue corresponding to partition 1 becomes the target message with the global number GS8. The target message at the head of the message receiving queue corresponding to partition 2 becomes the target message of GS9. When traversing to the message receiving queue corresponding to partition 0, since the global number GS10 is greater than the global number GS6, the target message of global number GS10 is written into the message merge queue. Then traversing to the message receiving queue corresponding to partition 1, since the global number GS8 is less than the global number GS10, the message of global number GS8 is removed from the message receiving queue of partition 1. As a result, the target message at the head of the message receiving queue corresponding to partition 1 becomes the target message of global number GS11. Since the global number GS11 is greater than the global number GS10, the target message of global number GS11 is written into the message merge queue. The message merge queue is then traversed to the message receiving queue corresponding to partition 2. Since the global number of the target message at the head of the message receiving queue corresponding to partition 2 is GS9, which is smaller than the global number GS11, the message with the global number GS9 is removed from the message receiving queue of partition 2. As a result, the target message at the head of the message receiving queue corresponding to partition 2 becomes the target message with the global number GS12. Since the global number GS12 is larger than the global number GS11, the target message with the global number GS12 is written into the message merge queue. As a result, the global numbers of the target messages written into the message merge queue are GS4, GS5, GS6, GS10, GS11 and GS12 respectively.When traversing each message receiving queue, there must be a target message in each message receiving queue that is written into the message merging queue. Since the message will be written repeatedly when the message sending task is restarted, the consumer end in the message receiving device needs to achieve idempotence of repeated messages.

[0116] In this embodiment, due to the restart of the message sending task, the global number may become discontinuous, and the global number of the head message of the current message receiving queue may be smaller than the reference global number. Therefore, when the global number of the head message of the current message receiving queue is greater than the reference global number, the head message of the current message receiving queue is written into the message merging queue, which can ensure that the global number of the target message written into the message merging queue later is greater than the global number of the target message written into the message merging queue first, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0117] In some embodiments, the method further includes: when the global number of the head message of the current receiving queue is smaller than the reference global number, removing the head message of the current receiving queue from the current receiving queue, and returning to the step of obtaining the head message of the current receiving queue.

[0118] In this embodiment, due to the restart of the message sending task, the global number may become discontinuous, and the global number of the head message of the current message receiving queue may be smaller than the reference global number. Therefore, when the global number of the head message of the current receiving queue is smaller than the reference global number, the head message of the current receiving queue is removed from the current receiving queue, and the step of obtaining the head message of the current receiving queue is returned. This can ensure that the global number of the target message written into the message merge queue later is greater than the global number of the target message written into the message merge queue earlier, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0119] In some embodiments, after receiving the target message returned by the message transmission device, it also includes: determining the local number of the returned target message to obtain a first local number; determining the local number of the target message that was last written to the message receiving queue corresponding to the second message storage queue as of the current time, to obtain a second local number; and stopping reading the target message from each message storage queue when the first local number and the second local number are not continuous.

[0120] Specifically, the target message last written into the message receiving queue corresponding to the second message storage queue is the target message at the end of the message receiving queue corresponding to the second message storage queue as of the current time. If the first local number is not continuous with the second local number, it indicates that a message is lost, so that the message receiving device can report an error and stop reading the target message from the message storage device to prevent the error from spreading.

[0121] For example, Fig.13 As shown, the status of the message receiving queue corresponding to partition 0 is displayed. It can be seen that the target message of local number PS3 is lost. Usually, the message sending device writing messages to the message storage device will not cause the message to be lost, and the message receiving device reading data from the message storage device will not cause the message to be lost. Therefore, the lost message may be caused by a problem with the message storage device itself, which causes the message to be lost. In this case, human intervention is required to solve the problem.

[0122] In this embodiment, when the first partial number and the second partial number are not continuous, the reading of messages from the message storage device is stopped, so that in the case of data loss, the error propagation is prevented in time.

[0123] In some embodiments, a message processing system is provided, the system comprising:

[0124] A message sending device, used for sending a message write request for a first message storage queue in a message storage object to a message transmission device; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue, the target message written in each message sending queue is obtained by adding a corresponding global number to the original message to be written, and the global number of the target message written later to the message sending queue is greater than the global number of the target message written earlier to the message sending queue.

[0125] The message transmission device is used to write the target message carried in the message writing request into the first message storage queue.

[0126] A message receiving device is used to send a message reading request for a second message storage queue in a message storage object to a message transmission device, and receive a target message returned by the message transmission device in response to the message reading request, wherein the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device includes message receiving queues corresponding to each message storage queue; the returned target message is written to the message receiving queue corresponding to the second message storage queue, and the original message included in the target message is processed according to the global number of the target message in each message receiving queue.

[0127] It should be noted that the message sending device, message transmission device and message receiving device in the message processing system can also implement the various steps performed in the above-mentioned message processing methods, which will not be repeated here.

[0128] In the above-mentioned message processing system, the messages in the message stream need to be written into the message storage object. Since the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, the target message includes the global number corresponding to the original message and the original message, thereby realizing the transmission of the original message and the global number of the original message by transmitting the target message. Since the original messages are determined from the message stream in sequence, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier, the global number in the target message reflects the order of the original message in the message stream. Since the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0129] In some embodiments, Fig.14 As shown, a message processing method is provided, which can be executed by a terminal or jointly executed by a terminal and a server. The method is described by taking the method jointly executed by a message sending device, a message transmission device, and a message receiving device as an example, and includes the following steps:

[0130] Step 1402: The message sending device sequentially determines the original message from the message stream to be written into the message storage object.

[0131] The message storage object is provided by the message transmission device, and includes a plurality of message storage queues, each of which has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device.

[0132] Among them, in the case where the message sending task is restarted, the message sending device, in response to the restart of the message sending task, obtains the target location from the recorded location, starts to obtain messages from the target location in the data source, obtains the message stream to be written to the message storage object after the restart, and executes step 1402 using the message stream to be written to the message storage object after the restart.

[0133] In the process of writing the target message to the message storage queue in the message storage object, the message sending device can record the location of the original message corresponding to at least part of the written target message in the data source; the message sending device can store the location in a third-party system.

[0134] Step 1404, the message sending device determines the base global number corresponding to the message storage object, increments the base global number to obtain an incremented global number, determines the incremented global number as the global number corresponding to the original message, adds the corresponding global number to the original message, and obtains the global message corresponding to the original message.

[0135] Among them, in the case where the message sending task is restarted, the message sending device, in response to the restart of the message sending task, determines the tail message of each message storage queue, determines the largest global number among the global numbers of the tail messages as the base global number corresponding to the message storage object after the restart, increments the base global number corresponding to the message storage object after the restart to obtain the incremented global number, determines the incremented global number as the global number corresponding to the original message, adds the corresponding global number to the original message, and obtains the global message corresponding to the original message.

[0136] Step 1406: The message sending device determines the current message sending queue from each message sending queue.

[0137] Among them, in the case where the message sending task is restarted, the message sending device, in response to the restart of the message sending task, determines the tail message of each message storage queue, determines the message storage queue to which the tail message with the largest global number among the tail messages belongs, obtains the reference storage queue, determines the message sending queue corresponding to the reference storage queue as the reference sending queue, determines the next message sending queue of the reference sending queue from each message sending queue in accordance with the traversal order, and uses the next message sending queue as the current message sending queue.

[0138] Step 1408, the message sending device adds the corresponding local number based on the global message corresponding to the original message, obtains the target message corresponding to the original message, and writes the target message corresponding to the original message into the current message sending queue, and returns to step 1402.

[0139] The local number of the target message written first is smaller than the local number of the target message written later, and the local numbers of the target messages written two adjacent times are continuous.

[0140] Step 1410: The message sending device sends a message write request for the first message storage queue in the message storage object to the message transmission device, where the message write request carries a target message.

[0141] Step 1412: The message transmission device writes the target message carried in the message writing request into the first message storage queue.

[0142] Step 1414: The message receiving device sends a message reading request for the second message storage queue in the message storage object to the message transmitting device.

[0143] Step 1416: The message transmission device obtains the target message from the second message storage queue and returns the target message.

[0144] Step 1418, the message receiving device receives the target message returned by the message transmission device in response to the message reading request, determines the local number of the returned target message to obtain the first local number, determines the local number of the target message that was last written into the message receiving queue corresponding to the second message storage queue as of the current time, and obtains the second local number.

[0145] Step 1420, the message receiving device determines whether the first local number and the second local number are continuous, if so, execute step 1422, if not, execute step 1424.

[0146] Step 1422: The message receiving device writes the returned target message into the message receiving queue corresponding to the second message storage queue.

[0147] Step 1424: The message receiving device stops reading the target message from each message storage queue.

[0148] Step 1426, the message receiving device determines the current message receiving queue from each message receiving queue in a loop traversal manner.

[0149] Step 1428, the message receiving device determines the global number of the target message last written into the message merging queue as of the current time to obtain a reference global number.

[0150] Step 1430: The message receiving device obtains the head message of the current message receiving queue.

[0151] Step 1432, determine whether the global number of the head message of the current message receiving queue is greater than the reference global number, if so, execute step 1436, if not, execute step 1434.

[0152] Step 1434 , the message receiving device removes the head message of the current receiving queue from the current receiving queue and returns to step 1430 .

[0153] Step 1436, the message receiving device writes the head message of the current message receiving queue into the message merging queue, and processes the original messages included in the target messages in sequence according to the arrangement order of the target messages in the message merging queue.

[0154] In this embodiment, the messages in the message stream need to be written into the message storage object. Since the target message corresponding to the original message is obtained by adding the corresponding global number to the original message, the target message includes the global number corresponding to the original message and the original message, thereby realizing the transmission of the original message and the global number of the original message by transmitting the target message. Since the original messages are determined from the message stream in sequence, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier, the global number in the target message reflects the order of the original message in the message stream. Since the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message, the original message in the target message can be processed by the message receiving device according to the arrangement order of the original message in the message stream, so that the messages in the message stream can still be processed in the order of the messages in the message stream after being transmitted from the message sending device to the message receiving device, thereby improving the reliability of data transmission and ensuring the orderliness after data transmission.

[0155] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0156] Based on the same inventive concept, the embodiment of the present application also provides a message processing device for implementing the message processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more message processing device embodiments provided below can refer to the limitations on the message processing method above, and will not be repeated here.

[0157] In some embodiments, Fig.15As shown, a message processing device is provided, including: a message determination module 1502, a first message writing module 1504 and a message transmission module 1506, wherein:

[0158] The message determination module 1502 is used to determine the original message in sequence from the message stream to be written into the message storage object; the message storage object is provided by the message transmission device, and the message storage object includes multiple message storage queues, each message storage queue has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device.

[0159] The first message writing module 1504 is used to determine the current message sending queue from various message sending queues, and write the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0160] The message transmission module 1506 is used to write the target message in the corresponding message sending queue into each message storage queue respectively; wherein, the target message written in each message storage queue is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0161] In some embodiments, before writing the target message corresponding to the original message into the current message sending queue, the device is also used to: add the corresponding global number on the basis of the original message to obtain the global message corresponding to the original message; the first message writing module 1504 is also used to add the corresponding local number on the basis of the global message corresponding to the original message to obtain the target message corresponding to the original message; write the target message corresponding to the original message into the current message sending queue; in the current message sending queue, the local number of the target message written first is smaller than the local number of the target message written later, and the local numbers of the two adjacent target messages written are continuous.

[0162] In some embodiments, the message stream comes from a data source; the device is also used to: in the process of writing a target message to a message storage queue in a message storage object, record the position of the original message corresponding to at least part of the written target message in the data source; in response to restarting the message sending task, obtain the target position from the recorded position; start obtaining messages from the target position in the data source to obtain the message stream to be written to the message storage object after the restart, and return to execute the steps of determining the original message from the message stream to be written to the message storage object in sequence.

[0163] In some embodiments, the current message sending queue is determined from each message sending queue by means of a loop traversal; the device is also used to: determine the tail message of each message storage queue in response to restarting the message sending task; determine the message storage queue to which the tail message with the largest global number among the tail messages belongs, obtain the reference storage queue, and determine the message sending queue corresponding to the reference storage queue as the reference sending queue; determine the next message sending queue of the reference sending queue from each message sending queue in the traversal order, and use the next message sending queue as the current message sending queue; return to the step of writing the target message corresponding to the original message into the current message sending queue.

[0164] In some embodiments, the device is also used to: determine a baseline global number corresponding to a message storage object; the baseline global number refers to the global number of the target message last written into each message sending queue; increment the baseline global number to obtain an incremented global number; add the incremented global number to the original message to obtain a global message corresponding to the original message.

[0165] In some embodiments, the device is also used to: determine the tail message of each message storage queue in response to restarting the message sending task; determine the largest global number among the global numbers of the tail messages as the base global number corresponding to the message storage object after restart.

[0166] In some embodiments, Fig.16 As shown, a message processing device is provided, including: a request receiving module 1602 and a second message writing module 1604, wherein:

[0167] The request receiving module 1602 is used to receive a message write request sent by a message sending device to a first message storage queue in a message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each message sending queue is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0168] The second message writing module 1604 is used to write the target message carried in the message writing request into the first message storage queue; wherein, the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target message stored in each consumer storage queue is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message.

[0169] In some embodiments, a target message writing module that writes a target message corresponding to an original message into each message sending queue is used to sequentially determine the original message to be written from the message stream to be written into a message storage object; add a corresponding global number on the basis of the original message to generate a global message corresponding to the original message; the global number of the global message generated later is greater than the global number of the global message generated earlier; determine the current message sending queue from each message sending queue, add a corresponding local number on the basis of the global message, and obtain the target message corresponding to the original message; write the target message corresponding to the original message into the current message sending queue; in the current message sending queue, the local number of the target message written earlier is less than the local number of the target message written later, and the local numbers of the target messages written twice adjacently are continuous.

[0170] In some embodiments, Fig.17 As shown, a message processing device is provided, including: a request sending module 1702, a message receiving module 1704 and a message processing module 1706, wherein:

[0171] The request sending module 1702 is used to send a message reading request for the second message storage queue in the message storage object to the message transmission device; the multiple message storage queues included in the message storage object have corresponding message sending queues in the message sending device respectively; the target message in each message storage queue comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding the corresponding global number on the basis of the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier.

[0172] The message receiving module 1704 is used to receive the target message returned by the message transmission device in response to the message reading request; the returned target message is the target message obtained by the message transmission device from the second message storage queue; the message receiving device has message receiving queues corresponding to each message storage queue.

[0173] The message processing module 1706 is used to write the returned target message into the message receiving queue corresponding to the second message storage queue, and process the original message included in the target message according to the global number of the target message in each message receiving queue.

[0174] In some embodiments, the message processing module 1706 is also used to include: writing the target messages in each message receiving queue into the message merging queue in the order of global numbers from small to large; and processing the original messages included in the target messages in the message merging queue in sequence according to the arrangement order of the target messages in the message merging queue.

[0175] In some embodiments, the message processing module 1706 is also used to determine the current message receiving queue from each message receiving queue by adopting a loop traversal method; determine the global number of the target message last written to the message merging queue as of the current time to obtain a reference global number; obtain the head message of the current message receiving queue, and when the global number of the head message of the current message receiving queue is greater than the reference global number, write the head message of the current message receiving queue into the message merging queue.

[0176] In some embodiments, the device is also used to: when the global number of the head message of the current receiving queue is smaller than the reference global number, remove the head message of the current receiving queue from the current receiving queue and return to the step of obtaining the head message of the current receiving queue.

[0177] In some embodiments, after receiving the target message returned by the message transmission device, the device is also used to: determine the local number of the returned target message to obtain a first local number; determine the local number of the target message that was last written to the message receiving queue corresponding to the second message storage queue as of the current time, to obtain a second local number; and stop reading the target message from each message storage queue when the first local number and the second local number are not continuous.

[0178] Each module in the above message processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0179] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Fig.18As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data involved in the message processing method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message processing method is implemented.

[0180] In some embodiments, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.19 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a message processing method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0181] Those skilled in the art will understand that Fig.18 and Fig.19The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0182] In some embodiments, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned message processing method when executing the computer program.

[0183] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned message processing method are implemented.

[0184] In some embodiments, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned message processing method when executed by a processor.

[0185] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0186] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0187] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0188] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A message processing method, characterized in that: The method comprises: Determine the original message from the message stream to be written into the message storage object in sequence; the message storage object is provided by the message transmission device, the message storage object includes a plurality of message storage queues, each of the message storage queues has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device; Determine the current message sending queue from each of the message sending queues, and write the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding the corresponding global number to the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; Writing the target message in the corresponding message sending queue into each of the message storage queues respectively; Among them, the target message written in each of the message storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in each of the target messages in the message receiving queue is used to be processed in sequence by the message receiving device according to the global number of the target message.

2. The method according to claim 1, characterized in that Before writing the target message corresponding to the original message into the current message sending queue, the method further includes: Adding a corresponding global number to the original message to obtain a global message corresponding to the original message; The step of writing the target message corresponding to the original message into the current message sending queue comprises: Adding the corresponding local number to the global message corresponding to the original message to obtain the target message corresponding to the original message; The target message corresponding to the original message is written into the current message sending queue; in the current message sending queue, the local number of the target message written first is smaller than the local number of the target message written later, and the local numbers of the target messages written twice adjacently are continuous.

3. The method according to claim 2, characterized in that The message stream comes from a data source; the method further comprises: In the process of writing the target message to the message storage queue in the message storage object, recording the position of the original message corresponding to at least part of the written target message in the data source; In response to restarting the message sending task, obtaining a target location from the recorded location; Messages are acquired from the target location in the data source to obtain a message stream to be written into the message storage object after restart, and the step of sequentially determining the original message from the message stream to be written into the message storage object is returned to be executed.

4. The method according to claim 3, characterized in that The current message sending queue is determined from each of the message sending queues in a cyclic traversal manner; the method further includes: In response to restarting the message sending task, determining the tail message of each of the message storage queues; Determine the message storage queue to which the tail message with the largest global number among the tail messages belongs, obtain a reference storage queue, and determine the message sending queue corresponding to the reference storage queue as the reference sending queue; Determine the next message sending queue of the reference sending queue from each of the message sending queues in a traversal order, and use the next message sending queue as the current message sending queue; Return to the step of writing the target message corresponding to the original message into the current message sending queue.

5. The method according to claim 2, characterized in that: Adding the corresponding global number on the basis of the original message to obtain the global message corresponding to the original message includes: Determine a base global number corresponding to the message storage object; the base global number refers to the global number of the target message last written into each of the message sending queues; Incrementing the base global number to obtain an incremented global number; The incremented global number is added to the original message to obtain a global message corresponding to the original message.

6. The method according to claim 5, characterized in that The method further comprises: In response to restarting the message sending task, determining the tail message of each of the message storage queues; The largest global number among the global numbers of the tail messages is determined as the base global number corresponding to the message storage object after restart.

7. A message processing method, characterized in that: The method comprises: A receiving message sending device sends a message write request for a first message storage queue in a message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each of the message sending queues is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; Writing the target message carried in the message writing request into the first message storage queue; Among them, the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target messages stored in each of the consumption storage queues are used to be transmitted to the message receiving queue corresponding to the message storage queue; the original messages included in the target messages in each of the message receiving queues are used to be processed in sequence by the message receiving device according to the global numbers of the target messages.

8. The method according to claim 7, characterized in that The step of writing a target message corresponding to the original message into each of the message sending queues comprises: Determine the original message to be written from the message stream to be written into the message storage object in order; Adding a corresponding global number on the basis of the original message to generate a global message corresponding to the original message; the global number of the global message generated later is greater than the global number of the global message generated earlier; Determine the current message sending queue from each of the message sending queues, add the corresponding local number on the basis of the global message, and obtain the target message corresponding to the original message; The target message corresponding to the original message is written into the current message sending queue; in the current message sending queue, the local number of the target message written first is smaller than the local number of the target message written later, and the local numbers of the target messages written twice adjacently are continuous.

9. A message processing method, characterized in that: The method comprises: A message reading request for a second message storage queue in a message storage object is sent to a message transmission device; the multiple message storage queues included in the message storage object have corresponding message sending queues in the message sending device respectively; the target message in each message storage queue comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; The target message returned by the receiving message transmission device in response to the message reading request is the target message obtained by the message transmission device from the second message storage queue; the message receiving device has message receiving queues corresponding to each message storage queue; The returned target message is written into the message receiving queue corresponding to the second message storage queue, and the original message included in the target message is processed according to the global number of the target message in each message receiving queue.

10. The method according to claim 9, characterized in that The processing of the original message included in the target message according to the global number of the target message in each message receiving queue includes: Writing the target messages in each of the message receiving queues into the message merging queue in the order of global numbers from small to large; According to the arrangement order of the target messages in the message merging queue, the original messages included in the target messages are processed in sequence.

11. The method according to claim 10, characterized in that Writing the target messages in each of the message receiving queues into the message merging queue in the order of the global numbers from small to large includes: Determine the current message receiving queue from each of the message receiving queues by means of a loop traversal method; Determine the global number of the target message that was last written into the message merge queue up to the current time to obtain a reference global number; The head message of the current message receiving queue is obtained, and when the global number of the head message of the current message receiving queue is greater than the reference global number, the head message of the current message receiving queue is written into the message merging queue.

12. The method according to claim 11, characterized in that The method further comprises: In the case that the global number of the head message of the current receiving queue is smaller than the reference global number, the head message of the current receiving queue is removed from the current receiving queue, and the process returns to the step of obtaining the head message of the current receiving queue.

13. The method according to claim 9, characterized in that After receiving the target message returned by the message transmission device, the method further includes: Determine the local number of the returned target message to obtain a first local number; Determine the local number of the target message that was last written into the message receiving queue corresponding to the second message storage queue up to the current time, and obtain a second local number; When the first local number and the second local number are not continuous, stop reading the target message from each of the message storage queues.

14. A message processing system, characterized in that: The system comprises: A message sending device, used for sending a message write request for a first message storage queue in a message storage object to a message transmission device; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue, the target message written in each of the message sending queues is obtained by adding a corresponding global number to the original message to be written, and the global number of the target message written later into the message sending queue is greater than the global number of the target message written earlier into the message sending queue; A message transmission device, configured to write the target message carried in the message writing request into the first message storage queue; A message receiving device, used for sending a message reading request for a second message storage queue in the message storage object to a message transmission device, receiving a target message returned by the message transmission device in response to the message reading request, wherein the returned target message is a target message obtained by the message transmission device from the second message storage queue; the message receiving device includes message receiving queues corresponding to each of the message storage queues; the returned target message is written into the message receiving queue corresponding to the second message storage queue, and the original message included in the target message is processed according to the global number of the target message in each of the message receiving queues.

15. A message processing device, characterized in that: The device comprises: A message determination module, used to sequentially determine the original message from the message stream to be written into the message storage object; the message storage object is provided by the message transmission device, the message storage object includes a plurality of message storage queues, each of the message storage queues has a corresponding message sending queue and a corresponding message receiving queue; the message receiving queue is stored in the message receiving device; A first message writing module is used to determine the current message sending queue from each of the message sending queues, and write the target message corresponding to the original message into the current message sending queue; the target message corresponding to the original message is obtained by adding the corresponding global number on the basis of the original message, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; A message transmission module, used to write the target message in the corresponding message sending queue into each of the message storage queues respectively; wherein, the target message written in each of the message storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

16. A message processing device, characterized in that: The device comprises: A request receiving module, used for receiving a message write request sent by a message sending device to a first message storage queue in a message storage object; the message write request carries a target message; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device, and the target message carried by the message write request comes from the message sending queue corresponding to the first message storage queue; the target message stored in each of the message sending queues is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; A second message writing module is used to write the target message carried in the message writing request into the first message storage queue; wherein, the multiple message storage queues included in the message storage object respectively have corresponding message receiving queues in the message receiving device, and the target message stored in each of the consumer storage queues is used to be transmitted to the message receiving queue corresponding to the message storage queue; the original message included in the target message in each of the message receiving queues is used to be processed in sequence by the message receiving device according to the global number of the target message.

17. A message processing device, characterized in that: The device comprises: A request sending module, used for sending a message reading request for a second message storage queue in a message storage object to a message transmission device; the multiple message storage queues included in the message storage object respectively have corresponding message sending queues in the message sending device; the target message in each of the message storage queues comes from the corresponding message sending queue; the target message stored in the message sending queue is obtained by adding a corresponding global number to the original message to be written; the original message is determined in sequence from the message stream to be written to the message storage object, and the global number added to the original message determined later is greater than the global number added to the original message determined earlier; a message receiving module, configured to receive a target message returned by the message transmission device in response to the message reading request; the returned target message is a target message obtained by the message transmission device from the second message storage queue; the message receiving device has message receiving queues corresponding to each of the message storage queues; The message processing module is used to write the returned target message into the message receiving queue corresponding to the second message storage queue, and process the original message included in the target message according to the global number of the target message in each message receiving queue.

18. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.

20. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.