WO2013078689A1 - Method and device for realizing message transfer in cloud message service - Google Patents
Method and device for realizing message transfer in cloud message service Download PDFInfo
- Publication number
- WO2013078689A1 WO2013078689A1 PCT/CN2011/083400 CN2011083400W WO2013078689A1 WO 2013078689 A1 WO2013078689 A1 WO 2013078689A1 CN 2011083400 W CN2011083400 W CN 2011083400W WO 2013078689 A1 WO2013078689 A1 WO 2013078689A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- message
- sequence number
- key
- data
- queue
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/21—Monitoring or handling of messages
- H04L51/226—Delivery according to priorities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/42—Mailbox-related aspects, e.g. synchronisation of mailboxes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Definitions
- Embodiments of the present invention relate to the field of IT technology and, more particularly, to a method and apparatus for implementing message delivery in a cloud messaging service. Background technique
- MOM Mobile sage-oriented Middleware
- MOM provides an effective communication method between distributed programs by providing a message queue model, which provides a distributed system. A loosely coupled way.
- a distributed system based on message middleware, communication between distributed programs, through the message middleware system to route and distribute messages, there is no need to establish a direct connection between distributed programs, but through distributed programs and messages A system to establish a connection to achieve communication between distributed programs.
- a distributed module is a specific physical entity running a distributed program.
- the distributed application is executed by a distributed program running on multiple modules.
- the distributed module is connected to a message middleware system running the message middleware to implement distributed Messaging between programs.
- Cloud messaging services use message middleware for this distributed
- the system provides services for communication.
- the cloud messaging service should first implement high availability and scalability of the message middleware, ensure uninterrupted service capability for a large number of users, and dynamically adjust resources according to load changes. Secondly, provide message delivery while ensuring the former. Order guarantee.
- a common way to achieve high availability and scalability in cloud messaging services is to use a distributed Key-Va lue (key-value pair) storage system to store data, but this approach does not provide a sequence guarantee: Implementing cloud messaging services
- Each message in the cloud message service device has multiple copies stored on multiple servers.
- the cloud message service device When the distributed program receives the message from the cloud message service device, the cloud message service device generally selects a part of the server based on a weighted random selection algorithm.
- the current message middleware system can not achieve the high availability and scalability requirements of the cloud message service, and can provide a good sequence guarantee, thus causing the limitation of the cloud message service in application. . Summary of the invention
- the embodiment of the invention provides a method and a device for implementing message delivery in a cloud information service, which can provide a good sequence guarantee while ensuring the high availability and scalability requirements of the cloud message service.
- a method for implementing message delivery in a cloud message service including: receiving a message sent by a first distributed program, storing message data carried by the message in a distributed Key-Va lue storage system, and incrementing the Sending a message sequence number of the message queue corresponding to the message; receiving a request for reading the message data by the second distributed program, reading the message data in the distributed Key-Va lue storage system, and transmitting the read message data to the second a distributed program, and when the message data is the message data corresponding to the received message sequence number of the message queue, incrementing the received message sequence of the message queue, on the other hand, provides a cloud message service device, including: an interface unit, Receiving a message sent by the first distributed program; receiving a request for the second distributed program to read the message data, and transmitting the message data read by the storage unit to the second distributed program; the message queue management unit, Notifying the storage unit to store the message data carried by the message received by the interface unit, and incrementing the cancellation Send
- the cloud message service device by setting a sending message sequence number and a receiving message sequence number for each message queue, when the first distributed program sends the message data, receives the data and generates a sequence number including the sending message queue sending message.
- the key value Key using the message data as the value Va lue, storing the message data in the distributed Key-Va lue storage system, and incrementally modifying the sent message sequence number of the message queue; when the second distributed program requests to receive the message data, Cloud messaging service
- the device reads the message data in the distributed Key-Va lue storage system according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number of the message queue.
- FIG. 1 is a system architecture diagram of implementing a cloud message service in a distributed system according to an embodiment of the present invention.
- 2 is a schematic structural diagram of metadata of a message queue in an embodiment of the present invention.
- Figure 3 is a diagram showing the storage format of message data in a Key-Va lue storage system in an embodiment of the present invention.
- FIG. 4 is a diagram of a method of implementing messaging in a cloud messaging service in accordance with one embodiment of the present invention.
- Figure 5 is a diagram of a method for providing sequence assurance by distributed program selection messaging in a cloud messaging service in accordance with another embodiment of the present invention.
- FIG. 6 is a block diagram of a cloud messaging service device in accordance with one embodiment of the present invention. detailed description
- the order guarantee means that the distributed program should receive the messages in the same order as the sent messages, and the order of sending the messages cannot be out of order.
- the order in which the distributed program sends 4 messages is: Message A - Message B - Message C - Message D
- the order in which the distributed program receives these 4 messages should also be: Message A - Message B - Message C - Message D, but not in other order, most distributed programs Requirements can provide order guarantees.
- FIG. 1 is a system architecture diagram of implementing a cloud message service in a distributed system according to an embodiment of the present invention.
- the embodiments of the present invention described below are applicable to the cloud messaging service system architecture shown in FIG.
- the distributed program sends message data to the cloud message service device or from the cloud message service.
- the message data is obtained in the service device, thereby realizing message delivery between distributed programs.
- Distributed programs run on distributed modules. Message passing between distributed programs is actually delivered through message passing between distributed modules. Message passing between distributed programs running on the same distributed module is also passed.
- Cloud messaging service device The cloud message service device is mainly divided into three parts: a message queue management unit that performs maintenance management on the message queue, a message delivery, a storage unit that implements message-related data storage, and an interface unit that interfaces with the distributed program.
- a message sequence number and a received message sequence number are set for each message queue as metadata of the message queue.
- each message queue may also set one or more other metadata such as whether to save order, unread successful message sequence number, message queue length, and so on.
- Both the send message sequence number and the receive message sequence number are sequences that start from the initial state. The initial state of the two should be the same, such as increasing from 0, or increasing from 1.
- Each time a distributed program sends a message to the message queue the sequence number of the sent message of the message queue is incremented by one.
- the sequence number of the received message of the message queue is incremented by one. .
- the sending message sequence number exceeds the maximum value of the message sequence number, the sending message sequence number is reversed, that is, it starts counting again from the initial state, for example, 0. Similarly, the received message sequence number exceeds the message.
- the serial number will also be forwarded when the serial number is the maximum.
- the received message sequence number of a message queue is smaller than the sent message sequence number, or the received message sequence number is greater than the sent message sequence number but the sent message queue number is more inverted than the received message sequence number, it indicates that the message queue still exists. A message that is not received by the distributed program, the distributed program can receive the message from the message queue.
- the message queue When the received message sequence number is equal to the sent message sequence number, indicating that the message in the message queue has been received, the message queue will not be received from the message queue.
- the information is composed of the message sequence number
- the specific composition rule includes at least the message queue identifier and the message sequence number, such as Key.
- the composition may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and may add other information as a prefix or suffix of the Key, such as a message length, as needed.
- the message data carried in the received distributed program message is used as Va lue.
- the message sent by the distributed program received by the cloud message service device generally carries the message queue name, message data, and sometimes also includes a timestamp, a digital signature, and the like.
- the cloud message service device modifies the sequence number of the message sent by the message queue, and generates a key according to the rule by using the sequence number of the message as the message sequence number, according to the generated key in the distributed Key-Va lue storage system. Store the message data.
- the cloud message service device When the distributed program needs to receive the message, the cloud message service device generates the key according to the rule by using the received message sequence number of the message queue as the message sequence number, and reads the message data according to the generated Key to the distributed Key-Va lue storage system, thereby The order guarantee of message delivery is realized.
- the program delivers messages through message middleware, often with distribution assurance requirements.
- distribution assurance There are three general models for distribution assurance: up to one distribution, at least one distribution, and strict one-time distribution.
- a maximum of one distribution means For each message, the distributed program that requests the message middleware to receive the message will only receive it at most once, but may not receive it.
- At least one distribution means For each message, the distributed program that requests the message middleware to receive the message must be received, but there may be repeated reception.
- Strict one-time distribution means For each message, the distributed program that requests the message middleware to receive the message must be received and will only be received once. In general, most applications expect a guarantee of strict one-time distribution.
- the usual way to achieve high availability and scalability in cloud messaging services is to use distributed Key-Va lue storage systems for storage of message data, but this method does not provide distribution guarantees: Every message data in the cloud messaging service device has Multiple copies are stored on multiple servers.
- the cloud message service device When the distributed program receives the message data from the cloud message service device, the cloud message service device generally selects a part of the server to obtain the message data based on the weighted random selection algorithm, and the distributed program continues to The cloud message service device requests to receive the message data, then it will eventually traverse all the servers, and all the message data will be returned to the program. If a distributed program requests to receive the message data, a server that stores the received message data copy fails.
- the status of the message data on the faulty server does not become received or deleted.
- the message data is repeatedly received, that is, Duplicate message appears, only Can guarantee at least one distribution.
- many applications have requirements for distribution assurance, and cloud messaging services that do not provide strict one-time distribution guarantee have application limitations.
- the current messaging middleware system cannot meet the high availability and scalability of cloud messaging services. Seeking, can provide a good order guarantee, and further provide the ability to distribute guarantees, thus causing the limitations of cloud messaging services.
- Each message queue is set with at least a message queue identifier, a message sequence number, and a message sequence number.
- the metadata of the message queue can be stored in a relational database, and the metadata operation is guaranteed by the characteristics of the relational database.
- Transactional that is, when multiple programs or multiple server nodes in the cloud message service need to update the metadata of one message queue at the same time, all operations will be treated as a single operation, either successfully completed or not executed at all, no There will be a part of successful failures, and there will be no repeated metadata operations.
- the message data will be read according to the sequence of sending messages and receiving message sequence numbers of the message queue that does not operate repeatedly. Duplicate messages appear, resulting in a strict distribution guarantee capability.
- the cloud message service device when the first distributed program sends the message data, receives the message data according to the message sequence number of the message queue in the distributed Key-Va lue storage system. Storing the message data, and incrementally modifying the sent message sequence number; when the second distributed program requests to receive the message data, the cloud message service device reads the message data according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number, The order guarantee of the message delivery of the cloud message service is realized. Therefore, the high availability and scalability requirements of the cloud message service are met, and the order guarantee of the message is realized.
- the strict distribution guarantee capability can be realized by storing the metadata of the message queue including the message queue identifier, the sending message sequence number, and the received message sequence number in the relational database. This satisfies the high availability and scalability requirements of the cloud messaging service, while ensuring the order guarantee and distribution guarantee of the message.
- FIG. 4 is a diagram of a method for implementing message delivery in a cloud message service according to an embodiment of the present invention.
- the message sent by the first distributed program may be received by using the following method: the message carries a message queue identifier containing a message queue that needs to deliver the message data, and generates a key value Key containing the message sequence number by using the sequence number of the message sequence of the message queue.
- the key value Key must include at least the message queue identifier and the message sequence number.
- the specific format may be the message queue identifier + the message sequence number, or the message sequence number + message queue identifier, and other information may be added according to the service requirement, such as the message length. Wait.
- the message data reading mode is the message data corresponding to the received message sequence number of the message queue, the received message sequence number of the message queue needs to be incremented.
- the method for reading the message data by the second distributed program may be received by the method, where the request includes a message queue identifier for reading the message data, and when the received message sequence number of the message queue is not equal to the serial number of the sent message, the receiving The message sequence number generates a key value Key.
- the format of the generated Key here should be consistent with the generated key value Key when receiving the message data, and the message data is read in the distributed Key-Va ue storage system according to the generated Key.
- the reading is successful, the read message data is delivered to the second distributed program, and the received message sequence number of the message queue is incremented by one.
- the received message sequence number of the message queue is equal to the transmitted message sequence number, the message data is not read.
- the second distributed program reads the message data request and may also apply to read multiple pieces of message data at a time. The implementation method at this time is similar to the above, except that the operation of reading the message data and modifying the received message sequence number multiple times is repeated.
- both the message sequence number and the received message sequence number of the message queue define a maximum value. If the message sequence number exceeds the defined maximum value, the message sequence number is inverted, that is, counting from the initial value.
- the maximum value of the message sequence number is defined as 255, and the initial value is 0.
- the message sequence number is 255, a message is received, and the message sequence number of the message queue is changed to 0.
- the message sequence number is incremented, if the maximum value of the message sequence number is reached, the message sequence number is inverted.
- the metadata of the message queue is preferably stored in the relational database, and the strict delivery guarantee capability of the message delivery is realized.
- the message queue identifier can also be used as the key value Key, and the metadata is stored as Va lue in the distributed Key-Va lue storage system. Accordingly, steps 401, 402 read or modify metadata in a relational database or a distributed Key-Va lue storage system.
- the foregoing metadata includes at least a message queue identifier, a sent message sequence number, and a received message sequence number.
- the cloud message service device distributes the message sequence number according to the message queue.
- Key-Va 1 ue storage system stores messages, and Incrementally modifying the sending message sequence number of the message queue; when the second distributed program requests to receive the message data, the cloud message serving device reads the message data according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number of the message queue, The order guarantee of the message delivery of the cloud message service is realized. Furthermore, by storing and modifying the metadata of the message queue in the relational database, a strict one-time distribution guarantee capability is provided, thereby ensuring the order guarantee of the message delivery and the strict one-time distribution guarantee.
- FIG. 5 is a diagram of a method for selecting whether a message delivery order guarantee is required by a distributed program in a cloud message service according to another embodiment of the present invention.
- the distributed program selects whether the message delivery sequence guarantee is required to determine the read order of the message data, and the embodiment is based on the embodiment shown in FIG. Step 402 is refined, and the step of receiving the first distributed program to transmit the message data is substantially the same as the method of the step 401 in the embodiment shown in FIG. 4, and thus the illustration of the step of receiving the first distributed program to send the message data is omitted.
- the distributed program selects whether the message delivery sequence guarantee is required to determine the read order of the message data, and the embodiment is based on the embodiment shown in FIG. Step 402 is refined, and the step of receiving the first distributed program to transmit the message data is substantially the same as the method of the step 401 in the embodiment shown in FIG. 4, and thus the illustration of the step of receiving the first distributed program to send the message data is omitted. And description.
- the method for reading the message data by the second distributed program may be received by the method that the message queue identifier of the read message data is included in the request, and when the sequence number of the received message of the message queue is not equal to the serial number of the sent message, receiving The message sequence number generates a key value Key, and the format of the generated Key should be the same as the format of the Key generated when receiving the message data, and the message data is read in the distributed Key-Va lue storage system according to the generated Key.
- the received message sequence number of the message queue is equal to the sent message sequence number, the message data is not read.
- step 502 whether the message data is successfully read in the distributed Key-Va lue storage system is successful.
- the cloud message service device may not be able to read the message data.
- step 502 If the reading of the message data in step 502 is unsuccessful, further determining whether the message delivery of the second distributed program requires sequential guarantee.
- Whether the second distributed program needs the order of message delivery can be judged according to the value of the metadata "whether or not" of the message queue. If the value is yes, it indicates that order guarantee is needed, otherwise it means that order guarantee is not needed. Further, the value of "whether or not the order" of the message queue can be set by the distributed program through a command message, where the distributed program can be the message data sent in the message delivery.
- the first distributed program can also be a second distributed program that receives the message data. For example, the first distributed program sends a command message containing a parameter requiring a sequence indication, and sets the value of "whether or not" of the message queue to YES.
- the message data request contains a parameter indicating that order preservation is required, and the value of the message queue "sort order" is set to YES.
- the order guarantee for determining whether the second distributed program needs to be delivered may also be based on the parameter indicating whether the order is included in the request for reading the message data by the second distributed program, and when the order is instructed, the order guarantee is required. Indication of non-preservation indicates that no order guarantee is required.
- the current message data reading process ends and the received message sequence number is not modified. In this way, when the next message data reading process is performed, the unread message data is continuously read according to the received message sequence number until the message data is successfully read, thereby achieving order guarantee.
- step 503 If it is determined in step 503 that the second distributed program messaging does not need to provide a sequence guarantee, record the unsuccessful message sequence number and read the message data of the next received message sequence number.
- the message sequence number of the unread success message is added to the unread success message sequence number of the message queue, and the received message sequence number of the message queue is incremented, and the message data of the next received message sequence number is read. Until the read message data is successful or no message data is readable in the message queue, that is, the received message sequence number of the message queue is equal to the sent message sequence number.
- the message data that is successfully read is returned to the second distributed program, and the sequence number of the received message sequence of the message queue is modified to be 1 and the sequence number of the message is successfully read.
- the message data corresponding to the received message sequence number of the message queue is read.
- the received message sequence number of the message queue needs to be incremented, that is, the received message sequence number of the message queue is Read the successful message sequence number plus one.
- the received message sequence number of the message queue defines a maximum value. If the received message sequence number exceeds the defined maximum value, the message sequence number is inverted, that is, counting again from the initial value.
- the second distributed program read is received in step 501.
- the request for the message data first determines whether there is unread message data in the message queue that was originally skipped by the unsuccessful read, and if so, reads the message data.
- the specific implementation manner may be: determining whether the metadata of the message queue "unread success message sequence number" is empty, and if there is message data that is not successfully read, obtaining a message sequence number from the unread success message sequence number Using the message sequence number to generate a key value Key, reading the message data in the distributed Key-Va lue storage system according to the generated Key, and if the reading is successful, transmitting the read message data to the second distributed program.
- the message sequence number that has been read this time is deleted in the unread success message sequence number of the message queue, and the current message data reading process ends. If the reading is unsuccessful, continue to obtain the next message serial number from the unread successful message sequence number until the read message data is successful or not read. The message sequence number is no new message sequence number can be read. take. If the unread success message sequence number of the message queue is empty or the message data corresponding to all the message sequence numbers in the unsuccessful message sequence number is unsuccessfully read, the message is read according to the normal message data reading manner. The queue receives the message data corresponding to the message sequence number.
- the second distributed program reads the message data request and may also apply to read the plurality of message data at a time.
- the implementation method at this time is similar to the above, except that the operation of reading the message data multiple times and modifying the serial number of the received message is repeated.
- the key value Key includes at least a message queue identifier and a message sequence number
- the specific format may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and other information may be added according to service requirements.
- the message length and the like, the format of the key value Key generated when the message data sent by the first distributed module is stored in the distributed Key-Va lue storage system and the message data is read to the second distributed program should be the same.
- the metadata of the message queue is preferably stored in the relational database, or the message queue identifier is used as the key value Key, and the metadata is stored as Va lue in the distributed Key-Va lue storage system. Accordingly, metadata is read or modified in a relational database or a distributed Key-Va lue storage system.
- the above metadata includes at least information such as a message queue identifier, a sent message sequence number, a received message sequence number, a hold order, an unread success message sequence number, and the like.
- the message data when the first distributed program sends the message data, the message data is stored in the distributed Key-Va lue storage system, and the sequence number of the sent message of the message queue is incrementally modified; when the second distributed program requests the message data Read the message data according to the received message sequence number of the message queue.
- the message data fails to be read, determine whether to continue reading the message data until the read is successful, or incrementally modify the message queue according to whether the distributed program needs the order guarantee setting.
- Receiving message The serial number continues to read the message data of the next received message sequence number, and simultaneously records the message sequence number that has not been successfully read, and then reads it when the subsequent second distributed program requests to read the message data.
- the cloud message service is required to provide strict order guarantee according to the settings of the distributed program. Further, by storing and modifying the metadata of the message queue in the relational database, a strict one-time distribution guarantee capability is provided, thereby ensuring the order guarantee and distribution guarantee of the message delivery.
- the cloud messaging service device of Figure 6 includes an interface unit 601, a message queue management unit 602, and a storage unit 603.
- the interface unit 601 is configured to receive a message sent by the first distributed program, receive a request for reading the message data by the second distributed program, and send the message data read by the storage unit 603 to the second distributed program.
- the message queue management unit 602 is configured to notify the storage unit 603 to store the message data carried by the message received by the interface unit 601, and increment the sending message sequence number of the message queue corresponding to the message; the request for reading the message data according to the interface unit 601
- the notification storage unit 603 reads the message data, and increments the received message sequence number of the message queue when the message data corresponding to the received message sequence number of the message queue is successfully read.
- the storage unit 603 includes a distributed Key-Va lue storage system for performing storage or reading of the message data.
- the method may be as follows, the interface unit receives the message sent by the first distributed program, where the message includes a message queue identifier of the message queue that needs to deliver the message data, and the message queue management unit generates the message including the message sequence number of the message queue.
- the key value of the serial number Key The message queue management unit notifies the storage unit to store the message data carried in the received message in the distributed Key-Va lue storage system according to the key value Key, and the message queue management unit increments the sequence number of the sent message of the message queue by one.
- the interface unit receives a request from the second distributed program to read the message data, and the request includes a message queue identifier for reading the message data.
- the message queue management unit When the received message sequence number of the message queue is not equal to the sent message sequence number, the message queue management unit generates a key value Key by receiving the message sequence number, and notifies the storage unit to read the message data in the distributed Key-Va lue storage system. If the reading is successful, the interface unit passes the read message data to the second distributed program, and the message queue management unit increments the received message sequence number of the message queue by one.
- the message queue management unit determines whether the message delivery of the second distributed program requires sequential guarantee. If a sequence guarantee is required, the message queue management unit notifies the storage unit to continue reading the unread message data until Successfully read the message data. If the second distributed program message delivery does not need to provide a sequence guarantee, the message queue management unit records the message sequence number of the unsuccessful read, and increments the received message sequence number of the message queue, and notifies the storage unit to read the next received message sequence number. Message data.
- the specific method may be that the message queue management unit adds the message sequence number of the unread success message to the unread success message sequence number of the message queue, and reads the message data of the next received message sequence number until the message is read. The message data is successful or no message data is readable in the message queue, that is, the received message sequence number of the message queue is equal to the sent message sequence number.
- the above-mentioned message queue management unit determines whether the order of the second distributed program needs to be delivered can be determined according to the value of the metadata of the message queue "whether or not the order is saved", and if the value is yes, it indicates that order guarantee is required, otherwise it means that it is unnecessary. Order guarantee. Further, whether the value of the message queue is saved may be set by the message queue management unit according to the command message of the distributed program, and the distributed program may be the first distributed program that sends the message data in the message delivery or the received message data. The second distributed program. For example, the first distributed program sends a command message containing parameters requiring a sequence indication, and the message queue management unit sets the value of the message queue's order to be YES.
- the message queue management module may also be configured according to the request of the second distributed program to read the message data or the parameter carried by the message of the first distributed program to send the message data, for example, in the request of the second distributed program to read the message data.
- the inclusion of a parameter indicates that the message delivery needs to be preserved, and the message queue management unit sets the value of the message queue to be guaranteed to be YES.
- the message queue management unit determines whether the second distributed program needs the order of message delivery, and may also include a parameter indicating whether to save the order included in the request for reading the message data by the second distributed program, and indicates Order guarantee is required, indicating no order preservation means no order guarantee is required.
- the receiving unit further receives a request for the second distributed program to read the message data, and the message queue management unit first determines whether the message queue has an unread original that was not successfully read.
- the message data can be determined by determining whether the metadata of the message queue "unread successful message sequence number" is empty. If there is unread successful message data, the storage unit is notified to read the message data.
- the message queue management unit obtains a message sequence number from the unread success message sequence number, and generates a key value Key by using the message sequence number to notify the storage unit to read in the distributed Key-Va lue storage system.
- the interface unit transmits the read message data to the second distributed program, and the message queue management unit deletes the read in the unread successful message sequence number of the message queue. Take the successful message sequence number. If the read is unsuccessful, the message queue management unit continues to successfully cancel from the unquery of the message queue. The next message sequence number is obtained in the sequence number until the message data is successfully read or not read. The message sequence is read in the sequence number of the message. If the unread success message sequence number of the message queue is empty or the message data corresponding to all message sequence numbers in the unsuccessful success message sequence number is unsuccessfully read, the message queue management unit notifies the storage unit to obtain the message queue reception. The message data corresponding to the message sequence number.
- the key value Key includes at least a message queue identifier and a message sequence number, and the specific format may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and other information may be added according to service requirements.
- the message length and the like, the format of the key value Key generated when the message data sent by the first distributed module is stored in the distributed Key-Va lue storage system and the message data is read to the second distributed program should be the same.
- the key value Key can be generated by the message queue management unit, and then the storage unit is notified to store or read the message data in the distributed Key-Va lue storage system according to the Key.
- the message queue management unit may also only transmit information such as a message queue identifier, a message sequence number, and the like of the message queue to the storage unit, and the storage unit generates a key value Key to store or read the message data in the distributed Key-Va lue storage system.
- the message sequence number and the received message sequence number of the message queue both define a maximum value, and if the message sequence number exceeds the defined maximum value, the message sequence number is reversed, that is, the number is restarted from the initial value. .
- the message queue management unit increments the message sequence number, if the maximum value of the message sequence number is reached, the message sequence number is reversed.
- the storage unit may further include a relational database, and preferably store the metadata of the message queue in the relational database, or use the message queue identifier as the key value Key, and the metadata is stored as Va lue in the distribution.
- the storage unit also reads or modifies the metadata of the message queue in a relational database or distributed Key-Va lue storage system.
- the above metadata includes at least one of a message queue identifier, a sent message sequence number, a received message sequence number, a hold order, an unread success message sequence number, and the like.
- the distributed Key-Va lue storage system and the relational database in this embodiment may be physically together with other parts of the cloud message service device, or may be distributed on multiple network physical entities. .
- the cloud message service device of the embodiment of the present invention stores the message data carried by the message in the distributed Key-Va lue storage system, and incrementally modifies the sequence of the message sequence of the message queue;
- the second distributed program requests to receive the message data, according to the cancellation
- the received message sequence number of the message queue reads the message data, and incrementally modifies the received message sequence number of the message queue, thereby realizing the sequence guarantee of the message delivery of the cloud message service.
- the disclosed systems, devices, and methods may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
- the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
- the components displayed for the unit may or may not be physical units, ie may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
- each functional unit in various embodiments of the present invention may be integrated into one processing unit
- each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- a computer device which may be a personal computer, server, or network device, etc.
- the foregoing storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM, Random Acces s Memory), a magnetic disk or an optical disk, and the like, which can store program codes. medium.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
一种云消息服务中实现消息传递的方法和装置 技术领域 Method and device for realizing message delivery in cloud message service
本发明实施例涉及 IT技术领域, 并且更具体地, 涉及云消息服务中实 现消息传递的方法和装置。 背景技术 Embodiments of the present invention relate to the field of IT technology and, more particularly, to a method and apparatus for implementing message delivery in a cloud messaging service. Background technique
分布式程序在分布式模块上运行, 通过网络来共同完成一项任务, 实 现分布式应用业务。 分布式程序之间一般采用 MOM ( Mes sage-or iented Middleware , 消息中间件)进行通信, MOM通过提供消息队列模型为分布式 程序之间提供了一种有效的通信方法, 为构建分布式系统提供了一种松耦合 的方式。 在基于消息中间件的分布式系统中, 分布式程序之间的通信, 通过 消息中间件系统来路由和分发消息, 分布式程序之间不需要直接建立连接, 而是通过分布式程序与消息中间件系统来建立连接, 实现分布式程序间的通 信。 分布式模块是运行分布式程序的具体物理实体, 通过在多个模块上运行 的分布式程序, 共同完成分布式应用业务, 分布式模块与运行消息中间件的 消息中间件系统相连, 实现分布式程序之间的消息传递。 Distributed programs run on distributed modules to accomplish a task through the network to implement distributed application services. MOM (Mes sage-oriented Middleware) is generally used for communication between distributed programs. MOM provides an effective communication method between distributed programs by providing a message queue model, which provides a distributed system. A loosely coupled way. In a distributed system based on message middleware, communication between distributed programs, through the message middleware system to route and distribute messages, there is no need to establish a direct connection between distributed programs, but through distributed programs and messages A system to establish a connection to achieve communication between distributed programs. A distributed module is a specific physical entity running a distributed program. The distributed application is executed by a distributed program running on multiple modules. The distributed module is connected to a message middleware system running the message middleware to implement distributed Messaging between programs.
随着云计算和移动互联网等技术的发展, 部署在数据中心的各类服务 器、 PC机、移动设备等构成一个复杂的全球规模的分布式系统, 云消息服务 就是采用消息中间件为这个分布式系统提供通信的服务。 With the development of technologies such as cloud computing and mobile Internet, various types of servers, PCs, and mobile devices deployed in the data center constitute a complex global-scale distributed system. Cloud messaging services use message middleware for this distributed The system provides services for communication.
云消息服务首先应实现消息中间件的高可用性和伸缩性,保证能够为大 量的用户提供不间断的服务能力, 并且能够根据负载变化动态调整资源; 其 次是在保证前者的情况下提供消息传递的顺序保证。 The cloud messaging service should first implement high availability and scalability of the message middleware, ensure uninterrupted service capability for a large number of users, and dynamically adjust resources according to load changes. Secondly, provide message delivery while ensuring the former. Order guarantee.
云消息服务中实现高可用性和伸缩性的一种通常方法是使用分布式的 Key-Va lue (键值对)存储系统实现数据的存储, 但是该方法并不能提供顺 序保证: 实现云消息服务的云消息服务设备中每条消息都有多个副本存储在 多个服务器上, 当分布式程序从云消息服务设备上接收消息时, 云消息服务 设备一般基于带权重的随机选择算法来选择一部分服务器获取消息,如果分 布式程序持续向云消息服务设备请求接收消息, 那么按照选择算法最终将会 遍历所有的服务器, 所有消息都会返回给分布式程序, 但是由于每次请求都 是选择一部分服务器来获取消息,也就无法保证接收消息的顺序与发送消息 的顺序相同。 而很多程序对顺序保证存在要求, 不能提供有效顺序保证的云 消息服务存在应用上的局限性。 A common way to achieve high availability and scalability in cloud messaging services is to use a distributed Key-Va lue (key-value pair) storage system to store data, but this approach does not provide a sequence guarantee: Implementing cloud messaging services Each message in the cloud message service device has multiple copies stored on multiple servers. When the distributed program receives the message from the cloud message service device, the cloud message service device generally selects a part of the server based on a weighted random selection algorithm. Get the message, if the distributed program continues to request the cloud message service device to receive the message, then according to the selection algorithm will eventually traverse all the servers, all messages will be returned to the distributed program, but because each request is selected to select a part of the server to obtain Messages, there is no guarantee that the order of receiving messages and sending messages The order is the same. However, many programs have requirements for order guarantees, and cloud message services that cannot provide effective order guarantee have application limitations.
如上所述, 目前的消息中间件系统, 还无法实现在满足云消息服务对于 高可用性和伸缩性的要求的同时, 又能够提供很好的顺序保证, 从而造成云 消息服务在应用上的局限性。 发明内容 As mentioned above, the current message middleware system can not achieve the high availability and scalability requirements of the cloud message service, and can provide a good sequence guarantee, thus causing the limitation of the cloud message service in application. . Summary of the invention
本发明实施例提供了一种云信息服务中实现消息传递的方法和装置, 能 够在保障云消息服务的高可用性和伸缩性要求的同时, 提供很好的顺序保 证。 The embodiment of the invention provides a method and a device for implementing message delivery in a cloud information service, which can provide a good sequence guarantee while ensuring the high availability and scalability requirements of the cloud message service.
一方面, 提供了一种云消息服务中实现消息传递的方法, 包括, 接收第 一分布式程序发送的消息,在分布式 Key-Va lue存储系统中存储该消息携带 的消息数据, 并递增所述消息对应的消息队列的发送消息序列号; 接收第二 分布式程序读取消息数据的请求,在分布式 Key-Va lue存储系统中读取消息 数据, 将读取的消息数据发送给第二分布式程序, 并在该消息数据为该消息 队列的接收消息序列号对应的消息数据时, 递增该消息队列的接收消息序列 另一方面, 提供了一种云消息服务设备, 包括: 接口单元, 用于接收第 一分布式程序发送的消息; 接收第二分布式程序读取消息数据的请求, 以及 将存储单元读取的消息数据发送给所述第二分布式程序; 消息队列管理单 元, 用于通知存储单元存储接口单元接收的消息携带的消息数据, 并递增所 述消息对应的消息队列的发送消息序列号; 根据接口单元接收的所述读取消 息数据的请求, 通知所述存储单元读取消息数据, 并在读取所述消息队列的 接收消息序列号对应的消息数据成功时, 递增所述消息队列的接收消息序列 号。 所述存储单元,包括分布式 Key-Va lue存储系统, 用于进行所述消息数 据的存储或读取。 In one aspect, a method for implementing message delivery in a cloud message service is provided, including: receiving a message sent by a first distributed program, storing message data carried by the message in a distributed Key-Va lue storage system, and incrementing the Sending a message sequence number of the message queue corresponding to the message; receiving a request for reading the message data by the second distributed program, reading the message data in the distributed Key-Va lue storage system, and transmitting the read message data to the second a distributed program, and when the message data is the message data corresponding to the received message sequence number of the message queue, incrementing the received message sequence of the message queue, on the other hand, provides a cloud message service device, including: an interface unit, Receiving a message sent by the first distributed program; receiving a request for the second distributed program to read the message data, and transmitting the message data read by the storage unit to the second distributed program; the message queue management unit, Notifying the storage unit to store the message data carried by the message received by the interface unit, and incrementing the cancellation Sending a message sequence number of the message queue corresponding to the message; in response to the request for reading the message data received by the interface unit, notifying the storage unit to read the message data, and reading the sequence number of the received message of the message queue When the message data is successful, the received message sequence number of the message queue is incremented. The storage unit includes a distributed Key-Va lue storage system for performing storage or reading of the message data.
本发明实施例通过为每个消息队列设置一个发送消息序列号和一个接 收消息序列号, 当第一分布式程序发送消息数据时, 云消息服务设备接收数 据并生成包含发送消息队列发送消息序列号的键值 Key, 用消息数据作为数 值 Va lue,在分布式 Key-Va lue存储系统中存储消息数据,并递增修改消息队 列的发送消息序列号; 当第二分布式程序请求接收消息数据时, 云消息服务 设备按照消息队列的接收消息序列号在分布式 Key-Va lue存储系统中读取消 息数据, 并递增修改消息队列的接收消息序列号。 实现了云消息服务的高可 用性和伸缩性要求, 同时又保障了消息传递的顺序保证。 附图说明 In the embodiment of the present invention, by setting a sending message sequence number and a receiving message sequence number for each message queue, when the first distributed program sends the message data, the cloud message service device receives the data and generates a sequence number including the sending message queue sending message. The key value Key, using the message data as the value Va lue, storing the message data in the distributed Key-Va lue storage system, and incrementally modifying the sent message sequence number of the message queue; when the second distributed program requests to receive the message data, Cloud messaging service The device reads the message data in the distributed Key-Va lue storage system according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number of the message queue. The high availability and scalability requirements of cloud messaging services are realized, while ensuring the order guarantee of message delivery. DRAWINGS
为了更清楚地说明本发明实施例的技术方案, 下面将对实施例描述中所 需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图仅仅是本发 明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前 提下, 还可以根据这些附图获得其他的附图。 In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be described in detail below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是本发明实施例在分布式系统中实现云消息服务的系统架构图。 图 2是本发明实施例中消息队列的元数据的结构示意图。 FIG. 1 is a system architecture diagram of implementing a cloud message service in a distributed system according to an embodiment of the present invention. 2 is a schematic structural diagram of metadata of a message queue in an embodiment of the present invention.
图 3是本发明实施例中消息数据在 Key-Va lue存储系统中的存储格式示 意图。 Figure 3 is a diagram showing the storage format of message data in a Key-Va lue storage system in an embodiment of the present invention.
图 4是根据本发明一个实施例的云消息服务中实现消息传递的方法。 图 5是根据本发明另一个实施例的云消息服务中由分布式程序选择消息 传递提供顺序保证的方法。 4 is a diagram of a method of implementing messaging in a cloud messaging service in accordance with one embodiment of the present invention. Figure 5 is a diagram of a method for providing sequence assurance by distributed program selection messaging in a cloud messaging service in accordance with another embodiment of the present invention.
图 6是根据本发明一个实施例的云消息服务设备的框图。 具体实施方式 6 is a block diagram of a cloud messaging service device in accordance with one embodiment of the present invention. detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是 全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创 造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without making creative labor are within the scope of the present invention.
首先对顺序保证进行筒单说明。 顺序保证是指, 在进行通信的分布式程 序之间, 分布式程序接收消息的顺序应与发送消息的顺序相同, 不能出现乱 序, 例如, 分布式程序发送 4条消息的顺序是: 消息 A-消息 B-消息 C-消息 D, 则分布式程序接收这 4条消息的顺序也应该是: 消息 A-消息 B-消息 C- 消息 D, 而不能是其他顺序,绝大多数分布式程序都要求能够提供顺序保证。 First, the order guarantee is described in the order. The order guarantee means that the distributed program should receive the messages in the same order as the sent messages, and the order of sending the messages cannot be out of order. For example, the order in which the distributed program sends 4 messages is: Message A - Message B - Message C - Message D, then the order in which the distributed program receives these 4 messages should also be: Message A - Message B - Message C - Message D, but not in other order, most distributed programs Requirements can provide order guarantees.
图 1是本发明实施例在分布式系统中实现云消息服务的系统架构图。 下 面描述的本发明实施例可应用于图 1所示的云消息服务系统架构中。 FIG. 1 is a system architecture diagram of implementing a cloud message service in a distributed system according to an embodiment of the present invention. The embodiments of the present invention described below are applicable to the cloud messaging service system architecture shown in FIG.
如图 1所示,分布式程序发送消息数据给云消息服务设备或从云消息服 务设备中获取消息数据, 从而实现分布式程序之间的消息传递。 分布式程序 在分布式模块上运行, 分布式程序之间的消息传递实际上是通过分布式模块 间的消息传递进行传递, 同一分布式模块上运行的分布式程序之间进行消息 传递也要通过云消息服务设备。 云消息服务设备主要分为三个部分: 对消息 队列进行维护管理、 进行消息传递的消息队列管理单元, 实现消息相关的数 据存储的存储单元, 以及与分布式程序接口的接口单元。 As shown in Figure 1, the distributed program sends message data to the cloud message service device or from the cloud message service. The message data is obtained in the service device, thereby realizing message delivery between distributed programs. Distributed programs run on distributed modules. Message passing between distributed programs is actually delivered through message passing between distributed modules. Message passing between distributed programs running on the same distributed module is also passed. Cloud messaging service device. The cloud message service device is mainly divided into three parts: a message queue management unit that performs maintenance management on the message queue, a message delivery, a storage unit that implements message-related data storage, and an interface unit that interfaces with the distributed program.
如图 2所示,本发明实施例中为每个消息队列设置一个发送消息序列号 和一个接收消息序列号作为消息队列的元数据。 当然, 根据应用需要, 每个 消息队列还可能设置是否保序、 未读取成功消息序列号、 消息队列长度等一 个或多个其他元数据。发送消息序列号和接收消息序列号均为一个从初始状 态开始递增的序列, 两者的初始状态应该一致, 如均从 0开始递增, 或均从 1开始递增。 分布式程序每发送一条消息到消息队列中, 该消息队列的发送 消息序列号就递增加一, 分布式程序每从一个消息队列中接收一条消息, 该 消息队列的接收消息序列号就递增加一。 定义一个消息序列号的最大值, 当 发送消息序列号超过消息序列号最大值时, 发送消息序列号进行反转, 即重 新从初始状态, 例如 0开始计数, 同样的, 接收消息序列号超过消息序列号 最大值时也会进行发转。 当一个消息队列的接收消息序列号小于发送消息序 列号, 或接收消息序列号大于发送消息序列号但发送消息队列号比接收消息 序列号多进行了一次反转时,表示该消息队列中仍然存在未被分布式程序接 收的消息, 分布式程序可以从该消息队列接收消息, 当接收消息序列号等于 发送消息序列号时, 表示消息队列中的消息已经被接收完了, 则不会从该消 息队列读取消息给分布式程序。 一般, 消息序列号最大值会设置足够大, 以 避免出现反转的发送消息序列号接收消息数据并递增, 最终超过少反转一次 的接收消息序列号而导致未读取的消息数据被覆盖的情况。 As shown in FIG. 2, in the embodiment of the present invention, a message sequence number and a received message sequence number are set for each message queue as metadata of the message queue. Of course, depending on the application, each message queue may also set one or more other metadata such as whether to save order, unread successful message sequence number, message queue length, and so on. Both the send message sequence number and the receive message sequence number are sequences that start from the initial state. The initial state of the two should be the same, such as increasing from 0, or increasing from 1. Each time a distributed program sends a message to the message queue, the sequence number of the sent message of the message queue is incremented by one. Each time the distributed program receives a message from a message queue, the sequence number of the received message of the message queue is incremented by one. . Define the maximum value of a message serial number. When the sending message sequence number exceeds the maximum value of the message sequence number, the sending message sequence number is reversed, that is, it starts counting again from the initial state, for example, 0. Similarly, the received message sequence number exceeds the message. The serial number will also be forwarded when the serial number is the maximum. When the received message sequence number of a message queue is smaller than the sent message sequence number, or the received message sequence number is greater than the sent message sequence number but the sent message queue number is more inverted than the received message sequence number, it indicates that the message queue still exists. A message that is not received by the distributed program, the distributed program can receive the message from the message queue. When the received message sequence number is equal to the sent message sequence number, indicating that the message in the message queue has been received, the message queue will not be received from the message queue. Read messages to distributed programs. Generally, the maximum value of the message sequence number is set to be large enough to avoid the reversed transmission message sequence number receiving the message data and incrementing, and finally exceeds the received message sequence number that is inverted less frequently, resulting in the unread message data being overwritten. Happening.
如图 3所示, 消息数据在分布式 Key-Va lue存储系统中进行存储时, 用 包含消息序列号的信息组成 Key,具体组成规则中至少要包含消息队列标识、 消息序列号, 例如 Key的组成可以为消息队列标识 +消息序列号, 或为消息 序列号 +消息队列标识, 并可根据需要添加其他信息作为 Key的前缀或后缀 等, 例如消息长度。 用接收到的分布式程序消息中携带的消息数据作为 Va lue , 云消息服务设备接收的分布式程序所发送的消息一般会携带消息队 列名称、 消息数据, 有时也会包含时间戳、 数字签名等信息, 本发明实施例 中仅指保存消息数据部分, 当然, 根据实际应用的消息传递需要也可以保存 消息携带的其他信息。 因此, 实现了在分布式 Key-Va lue存储系统中存储和 访问消息数据,通过包含消息序列号的 Key直接定位查找到分布式存储系统 中的消息数据。 As shown in FIG. 3, when the message data is stored in the distributed Key-Va lue storage system, the information is composed of the message sequence number, and the specific composition rule includes at least the message queue identifier and the message sequence number, such as Key. The composition may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and may add other information as a prefix or suffix of the Key, such as a message length, as needed. The message data carried in the received distributed program message is used as Va lue. The message sent by the distributed program received by the cloud message service device generally carries the message queue name, message data, and sometimes also includes a timestamp, a digital signature, and the like. Information, embodiment of the invention Only the part of the message data is saved. Of course, other information carried by the message can also be saved according to the actual application of the message transmission. Therefore, the storage and access of the message data in the distributed Key-Va lue storage system is realized, and the message data in the distributed storage system is directly located and located through the Key containing the message sequence number.
分布式程序发送消息时,云消息服务设备修改消息队列的发送消息序列 号, 并把发送消息序列号作为消息序列号按照规则生成 Key, 按照所生成的 Key在分布式 Key-Va lue存储系统中进行消息数据的存储。 分布式程序需要 接收消息时, 云消息服务设备把消息队列的接收消息序列号作为消息序列号 按照规则生成 Key, 按照所生成的 Key到分布式 Key-Va lue存储系统中读取 消息数据, 从而实现了消息传递的顺序保证。 When the distributed program sends a message, the cloud message service device modifies the sequence number of the message sent by the message queue, and generates a key according to the rule by using the sequence number of the message as the message sequence number, according to the generated key in the distributed Key-Va lue storage system. Store the message data. When the distributed program needs to receive the message, the cloud message service device generates the key according to the rule by using the received message sequence number of the message queue as the message sequence number, and reads the message data according to the generated Key to the distributed Key-Va lue storage system, thereby The order guarantee of message delivery is realized.
此外, 程序通过消息中间件进行消息传递, 往往还有分发保证的要求。 分发保证的模型一般分为三种: 最多一次分发、 至少一次分发和严格一次分 发。 最多一次分发是指: 对于每一条消息, 向消息中间件请求接收消息的分 布式程序最多只会接收到一次, 但可能会出现接收不到的情况。 至少一次分 发是指: 对于每一条消息, 向消息中间件请求接收消息的分布式程序一定可 以接收到, 但可能会出现重复接收的情况。 严格一次分发是指: 对于每一条 消息, 向消息中间件请求接收消息的分布式程序一定可以接收到, 并且只会 接收到一次。 通常来说, 大多数应用程序期望严格一次分发的保证。 In addition, the program delivers messages through message middleware, often with distribution assurance requirements. There are three general models for distribution assurance: up to one distribution, at least one distribution, and strict one-time distribution. A maximum of one distribution means: For each message, the distributed program that requests the message middleware to receive the message will only receive it at most once, but may not receive it. At least one distribution means: For each message, the distributed program that requests the message middleware to receive the message must be received, but there may be repeated reception. Strict one-time distribution means: For each message, the distributed program that requests the message middleware to receive the message must be received and will only be received once. In general, most applications expect a guarantee of strict one-time distribution.
云消息服务中实现高可用性和伸缩性的通常方法是使用分布式的 Key-Va lue存储系统进行消息数据的存储,但是该方法并不能提供分发保证: 云消息服务设备中每条消息数据都有多个副本存储在多个服务器上, 当分布 式程序从云消息服务设备上接收消息数据时, 云消息服务设备一般基于带权 重的随机选择算法来选择一部分服务器获取消息数据,分布式程序持续向云 消息服务设备请求接收消息数据, 那么最终将会遍历所有的服务器, 所有消 息数据都会返回给程序, 如果一次分布式程序请求接收消息数据, 而存储了 被接收消息数据副本的某个服务器发生故障,那么故障服务器上的这条消息 数据的状态不会变为已接收或者删除, 在下一次请求接收消息数据时, 该服 务器从故障状态恢复之后, 这条消息数据就会被重复接收, 也就是会出现重 复消息, 只能保证至少一次分发。 而很多应用程序对分发保证存在要求, 不 能提供严格一次分发保证的云消息服务存在应用上的局限性。 综上所述, 目 前的消息中间件系统,还不能在既满足云消息服务的高可用性和伸缩性的要 求, 又能够提供很好的顺序保证, 并进一步提供分发保证的能力, 从而造成 云消息服务在应用上的局限性。 The usual way to achieve high availability and scalability in cloud messaging services is to use distributed Key-Va lue storage systems for storage of message data, but this method does not provide distribution guarantees: Every message data in the cloud messaging service device has Multiple copies are stored on multiple servers. When the distributed program receives the message data from the cloud message service device, the cloud message service device generally selects a part of the server to obtain the message data based on the weighted random selection algorithm, and the distributed program continues to The cloud message service device requests to receive the message data, then it will eventually traverse all the servers, and all the message data will be returned to the program. If a distributed program requests to receive the message data, a server that stores the received message data copy fails. Then, the status of the message data on the faulty server does not become received or deleted. After the next request to receive the message data, after the server recovers from the fault state, the message data is repeatedly received, that is, Duplicate message appears, only Can guarantee at least one distribution. However, many applications have requirements for distribution assurance, and cloud messaging services that do not provide strict one-time distribution guarantee have application limitations. In summary, the current messaging middleware system cannot meet the high availability and scalability of cloud messaging services. Seeking, can provide a good order guarantee, and further provide the ability to distribute guarantees, thus causing the limitations of cloud messaging services.
每个消息队列都设置了至少包括消息队列标识、 发送消息序列号、 接收 消息序列号的元数据, 可以将消息队列的元数据存储在关系型数据库中, 借 助关系型数据库的特点保证元数据操作的事务性, 即当云消息服务中多个程 序或者多个服务器节点需要同时更新一个消息队列的元数据时,所有操作将 被作为一个单独的操作对待, 要么成功完成, 要么根本不执行, 不会出现一 部分成功一部分失败的情况, 也就不会出现元数据操作重复的情况, 按照不 会操作重复的消息队列的发送消息序列号、接收消息序列号进行消息数据的 读取, 也就避免了出现重复消息, 从而实现了严格一次的分发保证能力。 Each message queue is set with at least a message queue identifier, a message sequence number, and a message sequence number. The metadata of the message queue can be stored in a relational database, and the metadata operation is guaranteed by the characteristics of the relational database. Transactional, that is, when multiple programs or multiple server nodes in the cloud message service need to update the metadata of one message queue at the same time, all operations will be treated as a single operation, either successfully completed or not executed at all, no There will be a part of successful failures, and there will be no repeated metadata operations. The message data will be read according to the sequence of sending messages and receiving message sequence numbers of the message queue that does not operate repeatedly. Duplicate messages appear, resulting in a strict distribution guarantee capability.
本发明实施例在图 1所述的系统架构上, 当第一分布式程序发送消息数 据时, 云消息服务设备接收消息数据, 按照消息队列的发送消息序列号在分 布式 Key-Va lue存储系统中存储消息数据, 并递增修改发送消息序列号; 当 第二分布式程序请求接收消息数据时, 云消息服务设备按照消息队列的接收 消息序列号读取消息数据, 并递增修改接收消息序列号, 实现了云消息服务 的消息传递的顺序保证。 从而满足了云消息服务的高可用性和伸缩性要求, 同时又实现了消息的顺序保证。 In the embodiment of the present invention, when the first distributed program sends the message data, the cloud message service device receives the message data according to the message sequence number of the message queue in the distributed Key-Va lue storage system. Storing the message data, and incrementally modifying the sent message sequence number; when the second distributed program requests to receive the message data, the cloud message service device reads the message data according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number, The order guarantee of the message delivery of the cloud message service is realized. Therefore, the high availability and scalability requirements of the cloud message service are met, and the order guarantee of the message is realized.
并进一步地, 可以通过将消息队列的包括消息队列标识、 发送消息序列 号、接收消息序列号的元数据存储在关系型数据库中实现严格一次的分发保 证能力。 从而满足了云消息服务的高可用性和伸缩性要求, 又同时保障了消 息的顺序保证及分发保证。 And further, the strict distribution guarantee capability can be realized by storing the metadata of the message queue including the message queue identifier, the sending message sequence number, and the received message sequence number in the relational database. This satisfies the high availability and scalability requirements of the cloud messaging service, while ensuring the order guarantee and distribution guarantee of the message.
图 4是本发明一个实施例云消息服务中实现消息传递的方法。 FIG. 4 is a diagram of a method for implementing message delivery in a cloud message service according to an embodiment of the present invention.
401 , 接收第一分布式程序发送的消息, 在分布式 Key-Va lue存储系统 中存储所接收消息携带的消息数据, 并递增消息所对应的消息队列的发送消 息序列号。 401. Receive a message sent by the first distributed program, store the message data carried by the received message in the distributed Key-Va lue storage system, and increment the sending message sequence number of the message queue corresponding to the message.
可以采用如下的方法, 接收到第一分布式程序发送的消息, 消息携带包 含需要传递消息数据的消息队列的消息队列标识, 用该消息队列的发送消息 序列号生成包含消息序列号的键值 Key, 键值 Key中至少要包含消息队列标 识、 消息序列号, 具体格式可以为消息队列标识 +消息序列号, 或为消息序 列号 +消息队列标识, 并可根据业务需要添加其他信息, 如消息长度等。 从 而按照所生成的 Key在分布式 Key- Va lue存储系统中存储收到的消息携带的 消息数据, 并将该消息队列的发送消息序列号递增加一。 The message sent by the first distributed program may be received by using the following method: the message carries a message queue identifier containing a message queue that needs to deliver the message data, and generates a key value Key containing the message sequence number by using the sequence number of the message sequence of the message queue. The key value Key must include at least the message queue identifier and the message sequence number. The specific format may be the message queue identifier + the message sequence number, or the message sequence number + message queue identifier, and other information may be added according to the service requirement, such as the message length. Wait. Thus storing the received message in the distributed Key-Va lue storage system according to the generated Key Message data, and increment the sequence number of the sent message of the message queue by one.
402 , 接收第二分布式程序读取消息数据的请求, 在分布式 Key-Va lue 存储系统中读取消息数据, 将读取的消息数据发送给第二分布式程序, 并在 该消息数据为该消息队列的接收消息序列号对应的消息数据时,递增该消息 队列的接收消息序列号。 402. Receive a request for the second distributed program to read the message data, read the message data in the distributed Key-Va lue storage system, and send the read message data to the second distributed program, where the message data is When the message queue receives the message data corresponding to the sequence number of the message, the sequence number of the received message of the message queue is incremented.
假如消息数据读取方式为读取的是该消息队列的接收消息序列号对应 的消息数据, 此时, 需要递增该消息队列的接收消息序列号。 If the message data reading mode is the message data corresponding to the received message sequence number of the message queue, the received message sequence number of the message queue needs to be incremented.
可以采用如下的方法, 接收第二分布式程序读取消息数据的请求, 请求 中包含读取消息数据的消息队列标识, 当该消息队列的接收消息序列号不等 于发送消息序列号时,用接收消息序列号生成键值 Key, 当然,此处生成 Key 的格式应与接收消息数据时生成键值 Key一致,按照所生成的 Key在分布式 Key-Va 1 ue存储系统中读取消息数据, 若读取成功, 则将读取的消息数据传 递给第二分布式程序, 并将该消息队列的接收消息序列号递增加一。 当该消 息队列的接收消息序列号等于发送消息序列号时, 不读取消息数据。 第二分 布式程序读取消息数据请求也可能一次申请读取多条消息数据, 这时的实现 方法和上面类似, 只是会重复进行多次读取消息数据和修改接收消息序列号 的操作。 The method for reading the message data by the second distributed program may be received by the method, where the request includes a message queue identifier for reading the message data, and when the received message sequence number of the message queue is not equal to the serial number of the sent message, the receiving The message sequence number generates a key value Key. Of course, the format of the generated Key here should be consistent with the generated key value Key when receiving the message data, and the message data is read in the distributed Key-Va ue storage system according to the generated Key. If the reading is successful, the read message data is delivered to the second distributed program, and the received message sequence number of the message queue is incremented by one. When the received message sequence number of the message queue is equal to the transmitted message sequence number, the message data is not read. The second distributed program reads the message data request and may also apply to read multiple pieces of message data at a time. The implementation method at this time is similar to the above, except that the operation of reading the message data and modifying the received message sequence number multiple times is repeated.
当然, 消息队列的发送消息序列号和接收消息序列号均会定义一个最大 值, 如果消息序列号超过定义的最大值, 则消息序列号会进行反转, 即重新 从初始值开始计数。 例如, 消息序列号的最大值定义为 255 , 初始值为 0 , 当发送消息序列号为 255时又接收到一条消息, 此时会把消息队列的发送消 息序列号修改为 0。上述的 401、 402步骤中,对消息序列号进行递增处理时, 如果达到了消息序列号的最大值, 则将消息序列号进行反转处理。 Of course, both the message sequence number and the received message sequence number of the message queue define a maximum value. If the message sequence number exceeds the defined maximum value, the message sequence number is inverted, that is, counting from the initial value. For example, the maximum value of the message sequence number is defined as 255, and the initial value is 0. When the message sequence number is 255, a message is received, and the message sequence number of the message queue is changed to 0. In the above steps 401 and 402, when the message sequence number is incremented, if the maximum value of the message sequence number is reached, the message sequence number is inverted.
本实施例中优选地将消息队列的元数据存储在关系型数据库中, 实现消 息传递的严格一次的分发保证能力。 也可以以消息队列标识作为键值 Key, 元数据作为 Va lue存储在分布式 Key-Va lue存储系统中。相应地, 步骤 401、 402会到关系型数据库或分布式 Key-Va lue存储系统中读取或修改元数据。 上述元数据中至少包含消息队列标识、 发送消息序列号、 接收消息序列号信 本发明实施例在当第一分布式程序发送消息数据时, 云消息服务设备按 照消息队列的发送消息序列号在分布式 Key-Va 1 ue存储系统中存储消息, 并 递增修改消息队列的发送消息序列号; 当第二分布式程序请求接收消息数据 时, 云消息服务设备根据消息队列的接收消息序列号读取消息数据, 并递增 修改消息队列的接收消息序列号, 实现了云消息服务的消息传递的顺序保 证。 并进一步地, 通过在关系型数据库中存储和修改消息队列的元数据, 提 供了严格一次的分发保证能力,从而保障了消息传递的顺序保证及严格一次 分发保证。 In this embodiment, the metadata of the message queue is preferably stored in the relational database, and the strict delivery guarantee capability of the message delivery is realized. The message queue identifier can also be used as the key value Key, and the metadata is stored as Va lue in the distributed Key-Va lue storage system. Accordingly, steps 401, 402 read or modify metadata in a relational database or a distributed Key-Va lue storage system. The foregoing metadata includes at least a message queue identifier, a sent message sequence number, and a received message sequence number. In the embodiment of the present invention, when the first distributed program sends the message data, the cloud message service device distributes the message sequence number according to the message queue. Key-Va 1 ue storage system stores messages, and Incrementally modifying the sending message sequence number of the message queue; when the second distributed program requests to receive the message data, the cloud message serving device reads the message data according to the received message sequence number of the message queue, and incrementally modifies the received message sequence number of the message queue, The order guarantee of the message delivery of the cloud message service is realized. Furthermore, by storing and modifying the metadata of the message queue in the relational database, a strict one-time distribution guarantee capability is provided, thereby ensuring the order guarantee of the message delivery and the strict one-time distribution guarantee.
图 5是根据本发明另一个实施例的云消息服务中由分布式程序选择是否 需要消息传递提供顺序保证的方法。 图 5中在读取消息数据不成功时, 由分 布式程序选择是否需要消息传递提供顺序保证, 来确定消息数据的读取顺 序, 本实施例在图 4所示实施例的基础上对其中的 402步骤进行了细化, 而 接收第一分布式程序发送消息数据的步骤与图 4所示实施例中 401步骤的方 法基本相同, 因此省略了接收第一分布式程序发送消息数据步骤的图示和描 述。 FIG. 5 is a diagram of a method for selecting whether a message delivery order guarantee is required by a distributed program in a cloud message service according to another embodiment of the present invention. In FIG. 5, when the read message data is unsuccessful, the distributed program selects whether the message delivery sequence guarantee is required to determine the read order of the message data, and the embodiment is based on the embodiment shown in FIG. Step 402 is refined, and the step of receiving the first distributed program to transmit the message data is substantially the same as the method of the step 401 in the embodiment shown in FIG. 4, and thus the illustration of the step of receiving the first distributed program to send the message data is omitted. And description.
501 , 接收第二分布式程序读取消息数据的请求, 在分布式 Key-Va lue 存储系统中读取消息。 501. Receive a request for the second distributed program to read the message data, and read the message in the distributed Key-Va lue storage system.
可以采用如下的方法, 接收第二分布式程序读取消息数据的请求, 请求 中包含读取消息数据的消息队列标识, 当该消息队列的接收消息序列号不等 于发送消息序列号时, 用接收消息序列号生成键值 Key, 生成 Key的格式应 与接收消息数据时生成 Key 的格式一样, 按照所生成的 Key 在分布式 Key-Va lue存储系统中读取消息数据。 当该消息队列的接收消息序列号等于 发送消息序列号时, 不读取消息数据。 The method for reading the message data by the second distributed program may be received by the method that the message queue identifier of the read message data is included in the request, and when the sequence number of the received message of the message queue is not equal to the serial number of the sent message, receiving The message sequence number generates a key value Key, and the format of the generated Key should be the same as the format of the Key generated when receiving the message data, and the message data is read in the distributed Key-Va lue storage system according to the generated Key. When the received message sequence number of the message queue is equal to the sent message sequence number, the message data is not read.
502 , 501 步骤中在分布式 Key-Va lue存储系统中读取消息数据是否成 功。 In step 502, 501, whether the message data is successfully read in the distributed Key-Va lue storage system is successful.
当存储消息数据的一个或多个存储系统节点发生故障等情况,会导致云 消息服务设备读取消息数据不成功。 When a failure occurs in one or more storage system nodes that store message data, the cloud message service device may not be able to read the message data.
503 , 如果 502步骤中读取消息数据不成功, 则进一步判断该第二分布 式程序的消息传递是否需要顺序保证。 503. If the reading of the message data in step 502 is unsuccessful, further determining whether the message delivery of the second distributed program requires sequential guarantee.
第二分布式程序是否需要消息传递的顺序保证可以根据该消息队列的 元数据 "是否保序" 的值来判断, 值为是则表示需要顺序保证, 为否则表示 不需要顺序保证。 进一步地, 消息队列的 "是否保序" 的值可以由分布式程 序通过命令消息设置, 此处的分布式程序可以是消息传递中发送消息数据的 第一分布式程序也可以是接收消息数据的第二分布式程序。 例如, 第一分布 式程序发送包含需要保序指示的参数的命令消息,将消息队列的 "是否保序" 的值设为是。也可以在第二分布式程序读取消息数据的请求中或者在第一分 布式程序发送消息数据的消息中提供参数设置消息队列 "是否保序" 的值, 例如在第二分布式程序读取消息数据的请求中包含参数指示需要保序, 则将 消息队列 "是否保序" 的值置为是。 Whether the second distributed program needs the order of message delivery can be judged according to the value of the metadata "whether or not" of the message queue. If the value is yes, it indicates that order guarantee is needed, otherwise it means that order guarantee is not needed. Further, the value of "whether or not the order" of the message queue can be set by the distributed program through a command message, where the distributed program can be the message data sent in the message delivery. The first distributed program can also be a second distributed program that receives the message data. For example, the first distributed program sends a command message containing a parameter requiring a sequence indication, and sets the value of "whether or not" of the message queue to YES. It is also possible to provide a value of the parameter setting message queue "whether or not" in the request of the second distributed program to read the message data or in the message of the first distributed program to send the message data, for example in the second distributed program read The message data request contains a parameter indicating that order preservation is required, and the value of the message queue "sort order" is set to YES.
此外,判断第二分布式程序是否需要消息传递的顺序保证也可以根据第 二分布式程序在读取消息数据的请求中包含的指示是否保序的参数, 当指示 保序则表示需要顺序保证, 指示不保序则表示不需要顺序保证。 In addition, the order guarantee for determining whether the second distributed program needs to be delivered may also be based on the parameter indicating whether the order is included in the request for reading the message data by the second distributed program, and when the order is instructed, the order guarantee is required. Indication of non-preservation indicates that no order guarantee is required.
如果确定该第二分布式程序消息传递需要提供顺序保证,则本次消息数 据读取流程结束, 不会修改接收消息序列号。 这样, 在进行下次消息数据读 取流程时, 按照接收消息序列号会继续读取本次未读取的消息数据, 直到成 功读取到该消息数据为止, 从而实现顺序保证。 If it is determined that the second distributed program messaging needs to provide a sequence guarantee, the current message data reading process ends and the received message sequence number is not modified. In this way, when the next message data reading process is performed, the unread message data is continuously read according to the received message sequence number until the message data is successfully read, thereby achieving order guarantee.
504 , 如果 503步骤中确定该第二分布式程序消息传递不需要提供顺序 保证, 则记录读取不成功的消息序列号, 读取下一接收消息序列号的消息数 据。 504. If it is determined in step 503 that the second distributed program messaging does not need to provide a sequence guarantee, record the unsuccessful message sequence number and read the message data of the next received message sequence number.
具体可以为,在该消息队列的未读取成功消息序列号中添加本次未读取 成功的消息序列号, 并递增消息队列的接收消息序列号, 读取下一个接收消 息序列号的消息数据, 直至读取消息数据成功或消息队列中已无消息数据可 读, 即该消息队列的接收消息序列号等于发送消息序列号。 Specifically, the message sequence number of the unread success message is added to the unread success message sequence number of the message queue, and the received message sequence number of the message queue is incremented, and the message data of the next received message sequence number is read. Until the read message data is successful or no message data is readable in the message queue, that is, the received message sequence number of the message queue is equal to the sent message sequence number.
505 , 将读取的消息数据返回给第二分布式程序, 并修改消息队列的接 收消息序列号。 505. Return the read message data to the second distributed program, and modify the received message sequence number of the message queue.
具体可以为, 将读取成功的消息数据返回给第二分布式程序, 并修改该 消息队列的接收消息序列号为读取成功的消息序列号加 1。 Specifically, the message data that is successfully read is returned to the second distributed program, and the sequence number of the received message sequence of the message queue is modified to be 1 and the sequence number of the message is successfully read.
正常的消息数据读取方式中,读取的是该消息队列的接收消息序列号对 应的消息数据, 此时, 需要递增该消息队列的接收消息序列号, 即该消息队 列的接收消息序列号为读取成功的消息序列号加 1。 In the normal message data reading mode, the message data corresponding to the received message sequence number of the message queue is read. At this time, the received message sequence number of the message queue needs to be incremented, that is, the received message sequence number of the message queue is Read the successful message sequence number plus one.
同样的, 消息队列的接收消息序列号会定义一个最大值, 如果接收消息 序列号超过定义的最大值, 则消息序列号会进行反转, 即重新从初始值开始 计数。 Similarly, the received message sequence number of the message queue defines a maximum value. If the received message sequence number exceeds the defined maximum value, the message sequence number is inverted, that is, counting again from the initial value.
在本发明实施例中, 进一步地, 在步骤 501中接收到第二分布式程序读 取消息数据的请求,会首先确定该消息队列中是否有原读取不成功被跳过的 未读消息数据, 如有则读取该消息数据。 具体实施方式可以为判断该消息队 列的元数据 "未读取成功消息序列号"是否为空, 如有未读取成功的消息数 据, 则从未读取成功消息序列号中获取一个消息序列号, 采用该消息序列号 生成键值 Key, 按照所生成的 Key在分布式 Key-Va lue存储系统中读取消息 数据, 如果读取成功则将读取的消息数据传递给第二分布式程序, 并在该消 息队列的未读取成功消息序列号中删除本次已读取的消息序列号, 本次消息 数据读取过程结束。如读取不成功则继续从未读取成功消息序列号中获取下 一个消息序列号, 直至读取消息数据成功或未读取成功消息序列号中已没有 新的消息序列号可以进行消息数据读取。如该消息队列的未读取成功消息序 列号为空或未读取成功消息序列号中所有消息序列号对应的消息数据均读 取不成功, 则按照正常的消息数据读取方式读取该消息队列的接收消息序列 号对应的消息数据。 In the embodiment of the present invention, further, the second distributed program read is received in step 501. The request for the message data first determines whether there is unread message data in the message queue that was originally skipped by the unsuccessful read, and if so, reads the message data. The specific implementation manner may be: determining whether the metadata of the message queue "unread success message sequence number" is empty, and if there is message data that is not successfully read, obtaining a message sequence number from the unread success message sequence number Using the message sequence number to generate a key value Key, reading the message data in the distributed Key-Va lue storage system according to the generated Key, and if the reading is successful, transmitting the read message data to the second distributed program. And the message sequence number that has been read this time is deleted in the unread success message sequence number of the message queue, and the current message data reading process ends. If the reading is unsuccessful, continue to obtain the next message serial number from the unread successful message sequence number until the read message data is successful or not read. The message sequence number is no new message sequence number can be read. take. If the unread success message sequence number of the message queue is empty or the message data corresponding to all the message sequence numbers in the unsuccessful message sequence number is unsuccessfully read, the message is read according to the normal message data reading manner. The queue receives the message data corresponding to the message sequence number.
第二分布式程序读取消息数据请求也可能一次申请读取多条消息数据, 这时的实现方法和上面类似, 只是会重复进行多次读取消息数据和修改接收 消息序列号的操作。 The second distributed program reads the message data request and may also apply to read the plurality of message data at a time. The implementation method at this time is similar to the above, except that the operation of reading the message data multiple times and modifying the serial number of the received message is repeated.
本发明实施例中键值 Key至少要包含消息队列标识、 消息序列号, 具体 格式可以为消息队列标识 +消息序列号, 或为消息序列号 +消息队列标识, 并 可根据业务需要添加其他信息, 如消息长度等, 在分布式 Key-Va lue存储系 统中存储第一分布式模块发送的消息数据与读取消息数据给第二分布式程 序时生成键值 Key的格式应相同。 In the embodiment of the present invention, the key value Key includes at least a message queue identifier and a message sequence number, and the specific format may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and other information may be added according to service requirements. For example, the message length and the like, the format of the key value Key generated when the message data sent by the first distributed module is stored in the distributed Key-Va lue storage system and the message data is read to the second distributed program should be the same.
本实施例中优选地将消息队列的元数据存储在关系型数据库中,也可以 以消息队列标识作为键值 Key, 元数据作为 Va lue存储在分布式 Key-Va lue 存储系统中。 相应地, 会到关系型数据库或分布式 Key-Va lue存储系统中读 取或修改元数据。 上述元数据中至少包含消息队列标识、 发送消息序列号、 接收消息序列号、 是否保序、 未读取成功消息序列号等信息。 In this embodiment, the metadata of the message queue is preferably stored in the relational database, or the message queue identifier is used as the key value Key, and the metadata is stored as Va lue in the distributed Key-Va lue storage system. Accordingly, metadata is read or modified in a relational database or a distributed Key-Va lue storage system. The above metadata includes at least information such as a message queue identifier, a sent message sequence number, a received message sequence number, a hold order, an unread success message sequence number, and the like.
本发明实施例在第一分布式程序发送消息数据时, 在分布式 Key-Va lue 存储系统中存储消息数据, 并递增修改消息队列的发送消息序列号; 在第二 分布式程序请求消息数据时, 根据消息队列的接收消息序列号读取消息数 据, 当读取消息数据失败时, 根据分布式程序是否需要顺序保证的设置确定 是否继续读取该消息数据直至读取成功, 或者递增修改消息队列的接收消息 序列号, 继续读取下一个接收消息序列号的消息数据, 同时将未读取成功的 消息序列号记录下来,在后续第二分布式程序请求读取消息数据时再进行读 取。从而实现了根据分布式程序的设置确定是否需要云消息服务提供严格的 顺序保证。 并进一步地, 通过在关系型数据库中存储和修改消息队列的元数 据, 提供了严格一次的分发保证能力, 从而保障了消息传递的顺序保证及分 发保证。 In the embodiment of the present invention, when the first distributed program sends the message data, the message data is stored in the distributed Key-Va lue storage system, and the sequence number of the sent message of the message queue is incrementally modified; when the second distributed program requests the message data Read the message data according to the received message sequence number of the message queue. When the message data fails to be read, determine whether to continue reading the message data until the read is successful, or incrementally modify the message queue according to whether the distributed program needs the order guarantee setting. Receiving message The serial number continues to read the message data of the next received message sequence number, and simultaneously records the message sequence number that has not been successfully read, and then reads it when the subsequent second distributed program requests to read the message data. Thereby, it is determined whether the cloud message service is required to provide strict order guarantee according to the settings of the distributed program. Further, by storing and modifying the metadata of the message queue in the relational database, a strict one-time distribution guarantee capability is provided, thereby ensuring the order guarantee and distribution guarantee of the message delivery.
图 6是根据本发明一个实施例的云消息服务设备的框图。 图 6的云消息 服务设备包括接口单元 601、 消息队列管理单元 602和存储单元 603。 6 is a block diagram of a cloud messaging service device in accordance with one embodiment of the present invention. The cloud messaging service device of Figure 6 includes an interface unit 601, a message queue management unit 602, and a storage unit 603.
接口单元 601 用于接收第一分布式程序发送的消息;接收第二分布式程 序读取消息数据的请求, 以及将存储单元 603读取的消息数据发送给第二分 布式程序。 消息队列管理单元 602用于通知存储单元 603存储接口单元 601 接收的消息携带的消息数据, 并递增所述消息对应的消息队列的发送消息序 列号; 根据接口单元 601接收的读取消息数据的请求, 通知存储单元 603读 取消息数据, 并在读取该消息队列的接收消息序列号对应的消息数据成功 时,递增该消息队列的接收消息序列号。存储单元 603 ,包括分布式 Key-Va lue 存储系统, 用于进行所述消息数据的存储或读取。 The interface unit 601 is configured to receive a message sent by the first distributed program, receive a request for reading the message data by the second distributed program, and send the message data read by the storage unit 603 to the second distributed program. The message queue management unit 602 is configured to notify the storage unit 603 to store the message data carried by the message received by the interface unit 601, and increment the sending message sequence number of the message queue corresponding to the message; the request for reading the message data according to the interface unit 601 The notification storage unit 603 reads the message data, and increments the received message sequence number of the message queue when the message data corresponding to the received message sequence number of the message queue is successfully read. The storage unit 603 includes a distributed Key-Va lue storage system for performing storage or reading of the message data.
可以采用如下的方法, 接口单元接收到第一分布式程序发送的消息, 消 息中包含需要传递消息数据的消息队列的消息队列标识, 消息队列管理单元 用该消息队列的发送消息序列号生成包含消息序列号的键值 Key。 消息队列 管理单元通知存储单元根据键值 Key在分布式 Key-Va lue存储系统中存储收 到的消息携带的消息数据, 消息队列管理单元将该消息队列的发送消息序列 号递增加一。 The method may be as follows, the interface unit receives the message sent by the first distributed program, where the message includes a message queue identifier of the message queue that needs to deliver the message data, and the message queue management unit generates the message including the message sequence number of the message queue. The key value of the serial number Key. The message queue management unit notifies the storage unit to store the message data carried in the received message in the distributed Key-Va lue storage system according to the key value Key, and the message queue management unit increments the sequence number of the sent message of the message queue by one.
接口单元接收到第二分布式程序读取消息数据的请求,请求中包含读取 消息数据的消息队列标识。 当该消息队列的接收消息序列号不等于发送消息 序列号时, 消息队列管理单元用接收消息序列号生成键值 Key, 通知存储单 元在分布式 Key-Va lue存储系统中读取消息数据。 若读取成功, 接口单元将 读取的消息数据传递给第二分布式程序, 消息队列管理单元将该消息队列的 接收消息序列号递增加一。 The interface unit receives a request from the second distributed program to read the message data, and the request includes a message queue identifier for reading the message data. When the received message sequence number of the message queue is not equal to the sent message sequence number, the message queue management unit generates a key value Key by receiving the message sequence number, and notifies the storage unit to read the message data in the distributed Key-Va lue storage system. If the reading is successful, the interface unit passes the read message data to the second distributed program, and the message queue management unit increments the received message sequence number of the message queue by one.
进一步地, 如果存储单元读取消息数据不成功, 则消息队列管理单元判 断第二分布式程序的消息传递是否需要顺序保证。 如果需要提供顺序保证, 则消息队列管理单元会通知存储单元继续读取本次未读取的消息数据, 直到 成功读取到该消息数据为止。如果第二分布式程序消息传递不需要提供顺序 保证, 则消息队列管理单元记录读取不成功的消息序列号, 并递增消息队列 的接收消息序列号, 通知存储单元读取下一接收消息序列号的消息数据。 具 体方法可以为, 消息队列管理单元在该消息队列的未读取成功消息序列号中 添加本次未读取成功的消息序列号, 并读取下一个接收消息序列号的消息数 据, 直至读取消息数据成功或消息队列中已无消息数据可读, 即该消息队列 的接收消息序列号等于发送消息序列号。 Further, if the storage unit reads the message data unsuccessfully, the message queue management unit determines whether the message delivery of the second distributed program requires sequential guarantee. If a sequence guarantee is required, the message queue management unit notifies the storage unit to continue reading the unread message data until Successfully read the message data. If the second distributed program message delivery does not need to provide a sequence guarantee, the message queue management unit records the message sequence number of the unsuccessful read, and increments the received message sequence number of the message queue, and notifies the storage unit to read the next received message sequence number. Message data. The specific method may be that the message queue management unit adds the message sequence number of the unread success message to the unread success message sequence number of the message queue, and reads the message data of the next received message sequence number until the message is read. The message data is successful or no message data is readable in the message queue, that is, the received message sequence number of the message queue is equal to the sent message sequence number.
上述消息队列管理单元判断第二分布式程序是否需要消息传递的顺序 保证可以根据该消息队列的元数据 "是否保序" 的值来判断, 值为是则表示 需要顺序保证, 为否则表示不需要顺序保证。 进一步地, 消息队列的是否保 序的值可以由消息队列管理单元根据分布式程序的命令消息进行设置, 分布 式程序可以是消息传递中发送消息数据的第一分布式程序也可以是接收消 息数据的第二分布式程序。 例如, 第一分布式程序发送包含需要保序指示的 参数的命令消息, 由消息队列管理单元将消息队列的是否保序的值设为是。 也可以由消息队列管理模块根据第二分布式程序读取消息数据的请求或者 第一分布式程序发送消息数据的消息携带的参数进行设置, 例如在第二分布 式程序读取消息数据的请求中包含参数指示消息传递需要保序, 则消息队列 管理单元将消息队列是否保序的值置为是。 此外, 消息队列管理单元判断第 二分布式程序是否需要消息传递的顺序保证也可以根据第二分布式程序在 读取消息数据的请求中包含的指示是否保序的参数, 当指示保序则表示需要 顺序保证, 指示不保序则表示不需要顺序保证。 The above-mentioned message queue management unit determines whether the order of the second distributed program needs to be delivered can be determined according to the value of the metadata of the message queue "whether or not the order is saved", and if the value is yes, it indicates that order guarantee is required, otherwise it means that it is unnecessary. Order guarantee. Further, whether the value of the message queue is saved may be set by the message queue management unit according to the command message of the distributed program, and the distributed program may be the first distributed program that sends the message data in the message delivery or the received message data. The second distributed program. For example, the first distributed program sends a command message containing parameters requiring a sequence indication, and the message queue management unit sets the value of the message queue's order to be YES. The message queue management module may also be configured according to the request of the second distributed program to read the message data or the parameter carried by the message of the first distributed program to send the message data, for example, in the request of the second distributed program to read the message data. The inclusion of a parameter indicates that the message delivery needs to be preserved, and the message queue management unit sets the value of the message queue to be guaranteed to be YES. In addition, the message queue management unit determines whether the second distributed program needs the order of message delivery, and may also include a parameter indicating whether to save the order included in the request for reading the message data by the second distributed program, and indicates Order guarantee is required, indicating no order preservation means no order guarantee is required.
在本发明实施例中, 进一步地, 接收单元接收到第二分布式程序读取消 息数据的请求, 消息队列管理单元会先确定该消息队列中是否有原未读取成 功被跳过的未读消息数据, 具体可以通过判断该消息队列的元数据 "未读取 成功消息序列号"是否为空。 如有未读取成功的消息数据, 则通知存储单元 读取该消息数据。 具体的实施方式可以为, 消息队列管理单元从未读取成功 消息序列号中获取一个消息序列号, 采用该消息序列号生成键值 Key, 通知 存储单元在分布式 Key-Va lue存储系统中读取消息数据,如果读取成功则由 接口单元将读取的消息数据传递给第二分布式程序, 并由消息队列管理单元 在该消息队列的未读取成功消息序列号中删除本次已读取成功的消息序列 号。 如读取不成功, 则消息队列管理单元继续从该消息队列的未读取成功消 息序列号中获取下一个消息序列号, 直至读取消息数据成功或未读取成功消 息序列号中已没有新的消息序列号可以进行消息数据读取。如该消息队列的 未读取成功消息序列号为空或未读取成功消息序列号中所有消息序列号对 应的消息数据均读取不成功, 则消息队列管理单元通知存储单元获取消息队 列的接收消息序列号对应的消息数据。 本发明实施例中键值 Key至少要包含消息队列标识、 消息序列号, 具体 格式可以为消息队列标识 +消息序列号, 或为消息序列号 +消息队列标识, 并 可根据业务需要添加其他信息, 如消息长度等, 在分布式 Key-Va lue存储系 统中存储第一分布式模块发送的消息数据与读取消息数据给第二分布式程 序时生成键值 Key的格式应相同。键值 Key可以由消息队列管理单元生成后, 然后通知存储单元根据 Key在分布式 Key-Va lue存储系统中存储或读取消息 数据。 消息队列管理单元也可以仅传递消息队列的消息队列标识、 消息序列 号等信息给存储单元, 由存储单元生成键值 Key, 在分布式 Key-Va lue存储 系统中存储或读取消息数据。 In the embodiment of the present invention, the receiving unit further receives a request for the second distributed program to read the message data, and the message queue management unit first determines whether the message queue has an unread original that was not successfully read. The message data can be determined by determining whether the metadata of the message queue "unread successful message sequence number" is empty. If there is unread successful message data, the storage unit is notified to read the message data. In a specific implementation manner, the message queue management unit obtains a message sequence number from the unread success message sequence number, and generates a key value Key by using the message sequence number to notify the storage unit to read in the distributed Key-Va lue storage system. Taking the message data, if the reading is successful, the interface unit transmits the read message data to the second distributed program, and the message queue management unit deletes the read in the unread successful message sequence number of the message queue. Take the successful message sequence number. If the read is unsuccessful, the message queue management unit continues to successfully cancel from the unquery of the message queue. The next message sequence number is obtained in the sequence number until the message data is successfully read or not read. The message sequence is read in the sequence number of the message. If the unread success message sequence number of the message queue is empty or the message data corresponding to all message sequence numbers in the unsuccessful success message sequence number is unsuccessfully read, the message queue management unit notifies the storage unit to obtain the message queue reception. The message data corresponding to the message sequence number. In the embodiment of the present invention, the key value Key includes at least a message queue identifier and a message sequence number, and the specific format may be a message queue identifier + a message sequence number, or a message sequence number + a message queue identifier, and other information may be added according to service requirements. For example, the message length and the like, the format of the key value Key generated when the message data sent by the first distributed module is stored in the distributed Key-Va lue storage system and the message data is read to the second distributed program should be the same. The key value Key can be generated by the message queue management unit, and then the storage unit is notified to store or read the message data in the distributed Key-Va lue storage system according to the Key. The message queue management unit may also only transmit information such as a message queue identifier, a message sequence number, and the like of the message queue to the storage unit, and the storage unit generates a key value Key to store or read the message data in the distributed Key-Va lue storage system.
当然,本实施例中消息队列的发送消息序列号和接收消息序列号均会定 义一个最大值, 消息序列号超过定义的最大值, 则消息序列号会进行反转, 即重新从初始值开始计数。 消息队列管理单元对消息序列号进行递增处理 时, 如果达到了消息序列号的最大值, 则将消息序列号进行反转处理。 Certainly, in this embodiment, the message sequence number and the received message sequence number of the message queue both define a maximum value, and if the message sequence number exceeds the defined maximum value, the message sequence number is reversed, that is, the number is restarted from the initial value. . When the message queue management unit increments the message sequence number, if the maximum value of the message sequence number is reached, the message sequence number is reversed.
本实施例中存储单元还可以进一步地包括关系型数据库, 并优选地将消 息队列的元数据存储在关系型数据库中, 也可以以消息队列标识作为键值 Key, 元数据作为 Va lue存储在分布式 Key-Va lue存储系统中。 存储单元也 会相应地在关系型数据库或分布式 Key-Va lue存储系统中读取或修改消息队 列的元数据。 上述元数据中至少包含消息队列标识、 发送消息序列号、 接收 消息序列号、 是否保序、 未读取成功消息序列号等信息中的一种或几种。 In this embodiment, the storage unit may further include a relational database, and preferably store the metadata of the message queue in the relational database, or use the message queue identifier as the key value Key, and the metadata is stored as Va lue in the distribution. In the Key-Va lue storage system. The storage unit also reads or modifies the metadata of the message queue in a relational database or distributed Key-Va lue storage system. The above metadata includes at least one of a message queue identifier, a sent message sequence number, a received message sequence number, a hold order, an unread success message sequence number, and the like.
本实施例中的分布式 Key-Va lue存储系统和关系型数据库,作为存储单 元的一部分, 在物理上可以和云消息良务设备的其他部分在一起, 也可以分 布在多个网络物理实体上。 The distributed Key-Va lue storage system and the relational database in this embodiment, as part of the storage unit, may be physically together with other parts of the cloud message service device, or may be distributed on multiple network physical entities. .
因此, 本发明实施例的云消息服务设备在第一分布式程序发送消息时, 在分布式 Key-Va lue存储系统中存储该消息携带的消息数据, 并递增修改消 息队列的发送消息序列号; 在第二分布式程序请求接收消息数据时, 根据消 息队列的接收消息序列号读取消息数据 , 并递增修改消息队列的接收消息序 列号, 实现了云消息服务的消息传递的顺序保证。 并进一步地, 当读取消息 数据失败时,根据分布式程序是否需要顺序保证的需求确定是否继续读取该 消息数据直至读取成功, 或者继续读取下一个接收消息序列号的消息数据, 同时将未读取成功的消息序列号记录下来,在后续分布式程序请求读取消息 数据时再进行读取,从而实现了根据分布式程序的设置确定是否需要云消息 服务提供严格的顺序保证。 并进一步地, 通过在关系型数据库中存储和修改 消息队列的元数据, 提供了严格一次的分发保证能力, 从而保障了消息传递 的顺序保证及分发保证。 Therefore, when the first distributed program sends a message, the cloud message service device of the embodiment of the present invention stores the message data carried by the message in the distributed Key-Va lue storage system, and incrementally modifies the sequence of the message sequence of the message queue; When the second distributed program requests to receive the message data, according to the cancellation The received message sequence number of the message queue reads the message data, and incrementally modifies the received message sequence number of the message queue, thereby realizing the sequence guarantee of the message delivery of the cloud message service. And further, when the reading of the message data fails, determining whether to continue reading the message data until the reading is successful according to whether the distributed program needs the order guarantee requirement, or continuing to read the message data of the next received message sequence number, and simultaneously The sequence number of the message that has not been successfully read is recorded, and is read after the subsequent distributed program requests to read the message data, thereby realizing whether the cloud message service is required to provide strict order guarantee according to the setting of the distributed program. Further, by storing and modifying the metadata of the message queue in the relational database, a strict one-time distribution guarantee capability is provided, thereby ensuring the order guarantee and distribution guarantee of the message delivery.
本领域普通技术人员可以意识到, 结合本文中所公开的实施例描述的各 示例的单元及算法步骤, 能够以电子硬件、 计算机软件或者二者的结合来实 现, 为了清楚地说明硬件和软件的可互换性, 在上述说明中已经按照功能一 般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执 行, 取决于技术方案的特定应用和设计约束条件。 专业技术人员可以对每个 特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超 出本发明的范围。 Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software or a combination of both, in order to clearly illustrate hardware and software. Interchangeability, the composition and steps of the various examples have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到, 为描述的方便和筒洁, 上述描 述的系统、 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应 过程, 在此不再赘述。 It will be apparent to those skilled in the art that, for the convenience of the description and the cleaning process, the specific operation of the system, the device and the unit described above may be referred to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统、 装置和 方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示 意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可 以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个 系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间 的耦合或直接耦合或通信连接可以是通过一些接口, 装置或单元的间接耦合 或通信连接, 可以是电性, 机械或其它的形式。 为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。 In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise. The components displayed for the unit may or may not be physical units, ie may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
另外, 在本发明各个实施例中的各功能单元可以集成在一个处理单元 中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一 个单元中。 上述集成的单元既可以采用硬件的形式实现, 也可以采用软件功 能单元的形式实现。 In addition, each functional unit in various embodiments of the present invention may be integrated into one processing unit In addition, each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销 售或使用时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方 案的全部或部分可以以软件产品的形式体现出来, 该计算机软件产品存储在 一个存储介质中, 包括若干指令用以使得一台计算机设备(可以是个人计算 机, 服务器, 或者网络设备等)执行本发明各个实施例所述方法的全部或部 分步骤。而前述的存储介质包括: U盘、移动硬盘、只读存储器( ROM, Read-Only Memory ), 随机存取存储器 ( RAM, Random Acces s Memory ), 磁碟或者光盘 等各种可以存储程序代码的介质。 The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM, Random Acces s Memory), a magnetic disk or an optical disk, and the like, which can store program codes. medium.
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。 The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.
Claims
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2011/083400 WO2013078689A1 (en) | 2011-12-02 | 2011-12-02 | Method and device for realizing message transfer in cloud message service |
| CN201180003087.2A CN102668516B (en) | 2011-12-02 | 2011-12-02 | Method and apparatus for realizing message passing amid cloud information service |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2011/083400 WO2013078689A1 (en) | 2011-12-02 | 2011-12-02 | Method and device for realizing message transfer in cloud message service |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2013078689A1 true WO2013078689A1 (en) | 2013-06-06 |
Family
ID=46774773
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2011/083400 Ceased WO2013078689A1 (en) | 2011-12-02 | 2011-12-02 | Method and device for realizing message transfer in cloud message service |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN102668516B (en) |
| WO (1) | WO2013078689A1 (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109767834A (en) * | 2019-01-04 | 2019-05-17 | 浪潮软件集团有限公司 | A medical image data sharing service method and system based on cloud message service platform and object storage |
| CN113127508A (en) * | 2021-04-23 | 2021-07-16 | 中国工商银行股份有限公司 | Method, device and system for acquiring sequence number |
| CN113656199A (en) * | 2021-08-19 | 2021-11-16 | 深圳华锐金融技术股份有限公司 | Service message transmission method, device, computer equipment and storage medium |
Families Citing this family (22)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102955717B (en) * | 2012-11-05 | 2015-05-20 | 北京奇虎科技有限公司 | Message management equipment and method in distributed message processing system |
| CN103034541B (en) * | 2012-11-16 | 2016-09-28 | 北京奇虎科技有限公司 | A kind of distributed information system and equipment therein and method |
| CN103870464A (en) * | 2012-12-10 | 2014-06-18 | 腾讯科技(北京)有限公司 | Unread message processing method, display method and device |
| CN103761141A (en) * | 2013-12-13 | 2014-04-30 | 北京奇虎科技有限公司 | Method and device for realizing message queue |
| CN103984734B (en) * | 2014-05-20 | 2017-05-17 | 中国科学院软件研究所 | Cloud service message transmission method orienting high-performance computation |
| CN105119801B (en) * | 2015-07-08 | 2019-04-05 | Oppo广东移动通信有限公司 | A kind of social message management method, system, user terminal and server |
| CN105955895B (en) * | 2016-04-20 | 2019-04-12 | 北京小米移动软件有限公司 | Logic control method and device, the data processing equipment of Distributed Message Queue |
| CN106170013B (en) * | 2016-06-29 | 2019-06-07 | 上海浦东发展银行股份有限公司信用卡中心 | A kind of Kafka message uniqueness method based on Redis |
| CN106708427B (en) * | 2016-11-17 | 2019-05-10 | 华中科技大学 | A storage method suitable for key-value pair data |
| CN108345617B (en) * | 2017-01-24 | 2022-05-06 | 阿里巴巴集团控股有限公司 | Data synchronization method and device and electronic equipment |
| CN108038007B (en) * | 2017-11-30 | 2022-04-05 | 中电福富信息科技有限公司 | Method and system for orderly processing messages based on Ignite |
| CN109600302A (en) * | 2018-11-27 | 2019-04-09 | 金瓜子科技发展(北京)有限公司 | A kind of method, apparatus orderly communicated, storage medium and electronic equipment |
| US11055313B2 (en) | 2018-12-05 | 2021-07-06 | Ebay Inc. | Free world replication protocol for key-value store |
| CN112398744B (en) * | 2019-08-16 | 2024-09-06 | 阿里巴巴集团控股有限公司 | Network communication method and device and electronic equipment |
| CN112448898A (en) * | 2019-08-28 | 2021-03-05 | 无锡江南计算技术研究所 | Message order-preserving method based on sequence number mechanism |
| CN113365231A (en) * | 2020-03-05 | 2021-09-07 | 北京沃东天骏信息技术有限公司 | Method and device for sending short message |
| CN111464621B (en) * | 2020-03-30 | 2022-06-24 | 四川新网银行股份有限公司 | Method for detecting message sending and receiving quantity in asynchronous communication of distributed system |
| CN113824636B (en) * | 2020-06-18 | 2024-10-15 | 中兴通讯股份有限公司 | Message sending method, receiving method, electronic device, system and storage medium |
| CN113766437B (en) * | 2020-08-31 | 2023-04-07 | 北京沃东天骏信息技术有限公司 | Short message sending method and device |
| CN112040001A (en) * | 2020-09-07 | 2020-12-04 | 平安科技(深圳)有限公司 | Request processing method and device based on distributed storage |
| CN112860460B (en) * | 2021-02-23 | 2022-01-04 | 创盛视联数码科技(北京)有限公司 | Event distribution method and system for real-time classroom |
| US12223369B2 (en) * | 2021-07-08 | 2025-02-11 | Dell Products L.P. | Message oriented middleware cluster synchronization |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6058389A (en) * | 1997-10-31 | 2000-05-02 | Oracle Corporation | Apparatus and method for message queuing in a database system |
| US20050078605A1 (en) * | 2003-10-14 | 2005-04-14 | International Business Machines Corporaton | Managing message arrival to ensure proper matching of unordered messages |
| US7509378B2 (en) * | 2003-03-11 | 2009-03-24 | Bea Systems, Inc. | System and method for message ordering in a message oriented network |
-
2011
- 2011-12-02 WO PCT/CN2011/083400 patent/WO2013078689A1/en not_active Ceased
- 2011-12-02 CN CN201180003087.2A patent/CN102668516B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6058389A (en) * | 1997-10-31 | 2000-05-02 | Oracle Corporation | Apparatus and method for message queuing in a database system |
| US7509378B2 (en) * | 2003-03-11 | 2009-03-24 | Bea Systems, Inc. | System and method for message ordering in a message oriented network |
| US20050078605A1 (en) * | 2003-10-14 | 2005-04-14 | International Business Machines Corporaton | Managing message arrival to ensure proper matching of unordered messages |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109767834A (en) * | 2019-01-04 | 2019-05-17 | 浪潮软件集团有限公司 | A medical image data sharing service method and system based on cloud message service platform and object storage |
| CN109767834B (en) * | 2019-01-04 | 2023-04-07 | 浪潮软件集团有限公司 | Medical image data sharing service method and system |
| CN113127508A (en) * | 2021-04-23 | 2021-07-16 | 中国工商银行股份有限公司 | Method, device and system for acquiring sequence number |
| CN113656199A (en) * | 2021-08-19 | 2021-11-16 | 深圳华锐金融技术股份有限公司 | Service message transmission method, device, computer equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102668516A (en) | 2012-09-12 |
| CN102668516B (en) | 2014-09-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2013078689A1 (en) | Method and device for realizing message transfer in cloud message service | |
| CN107295080A (en) | Date storage method and server applied to distributed server cluster | |
| US11741075B2 (en) | Methods and system of tracking transactions for distributed ledger | |
| US20120150930A1 (en) | Cloud storage and method for managing the same | |
| US10484449B2 (en) | Email webclient notification queuing | |
| CN109714409B (en) | Message management method and system | |
| JP6191159B2 (en) | Server, backup system, backup method, and computer program | |
| CN104980519A (en) | Multi-computer room storage system | |
| WO2021184992A1 (en) | Mirror image file uploading method, related device and computer storage medium | |
| CN108781226B (en) | Communication system | |
| US20120296946A1 (en) | File management apparatus and file management apparatus controlling method | |
| CN114900449B (en) | Resource information management method, system and device | |
| CN103944974A (en) | Method for processing protocol messages, method for processing faults of controllers and related device | |
| CN111274047A (en) | Information processing method, terminal, system, computer device and storage medium | |
| JP2015114952A (en) | Network system, monitoring control unit, and software verification method | |
| US10419368B1 (en) | Dynamic scaling of computing message architecture | |
| CN114885020B (en) | Data transmission system and method | |
| CN116346834A (en) | Session synchronization method, device, computing equipment and computer storage medium | |
| US20150081808A1 (en) | Email webclient automatic failover | |
| CN117043760A (en) | Media storage for online meetings in edge network storage | |
| CN118450161B (en) | Management method and system for live video data storage service | |
| US10320715B1 (en) | Automated scaling of computing message architecture | |
| WO2025013074A1 (en) | Method and system for performing backup and restoration of application | |
| CN117520284A (en) | Management method and electronic device for file synchronization tasks | |
| CN117555685A (en) | Resource state synchronization method, console, platform and system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| WWE | Wipo information: entry into national phase |
Ref document number: 201180003087.2 Country of ref document: CN |
|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 11876462 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 11876462 Country of ref document: EP Kind code of ref document: A1 |