WO2021137768A1 - Method, apparatus and device for consuming messages based on message queue - Google Patents

Method, apparatus and device for consuming messages based on message queue Download PDF

Info

Publication number
WO2021137768A1
WO2021137768A1 PCT/SG2020/050799 SG2020050799W WO2021137768A1 WO 2021137768 A1 WO2021137768 A1 WO 2021137768A1 SG 2020050799 W SG2020050799 W SG 2020050799W WO 2021137768 A1 WO2021137768 A1 WO 2021137768A1
Authority
WO
WIPO (PCT)
Prior art keywords
reading position
message
current
writing
length
Prior art date
Application number
PCT/SG2020/050799
Other languages
French (fr)
Inventor
Yang Zhang
Changdong CUI
Jialin QIAN
Meng CHAI
Yongchao Cui
Tao Yin
Huimin Chen
Kaiyang JIANG
Shuqiang ZHU
Chaoxu Zhang
Wenjie Liu
Renbin WANG
Hongzhen ZHANG
Original Assignee
Envision Digital International Pte. Ltd.
Shanghai Envision Digital Co., Ltd.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Envision Digital International Pte. Ltd., Shanghai Envision Digital Co., Ltd. filed Critical Envision Digital International Pte. Ltd.
Publication of WO2021137768A1 publication Critical patent/WO2021137768A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • the present disclosure relates to the field of computer data communications, and in particular, relates to a method, an apparatus and a device for consuming messages based on a message queue.
  • Message queue is a method for communicating between applications, where an application, after sending a message to the message queue, may return immediately, and the reliable transmission of the message can be ensured by a message system.
  • a message producer i.e. a message publisher
  • a message consumer i.e. an active message acquirer
  • the embodiments of the present disclosure provide a method, an apparatus and a device for consuming messages based on a message queue, such that consumers with a low consumption speed, when reading a message, have a minimal impact on producers or other consumers in a message transmitting system.
  • the technical solutions are as follows.
  • a method for consuming messages based on a message queue includes:
  • an apparatus for consuming messages based on a message queue includes:
  • a writing module configured to write a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer;
  • an acquiring module configured to acquire a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence;
  • a processing module configured to update the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and [0013] a reading module configured to send a message in the message file read at the target reading position to the consumer program.
  • a computer device is provided.
  • the computer device is provided with a sensor, and includes a processor and a memory.
  • the memory stores at least one instruction, at least one program, a code set or an instruction set.
  • the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the method for consuming messages based on a message queue as defined in the aspects above.
  • the current reading position When the current writing position coincides with the current reading position, the current reading position is updated to the target reading position, that is, the current reading position is updated along a writing direction of the cyclic writing sequence, such that the reading position and the writing position of the consumer program maintain a distance again, and for consumer programs with an occasional low consumption speed, only a small part of messages may be lost.
  • FIG. 1 is a schematic diagram of a computer system according to an exemplary embodiment of the present disclosure
  • FIG. 2 is a structural block diagram of a server according to an exemplary embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of a message system according to an exemplary embodiment of the present disclosure.
  • FIG. 4 is a flowchart of a method for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure
  • FIG. 5 is a flowchart of a method for transmitting messages based on a message queue according to another exemplary embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a message system according to another exemplary embodiment of the present disclosure.
  • FIG. 7 is a flowchart of a method for performing a writing operation by a message queue according to an exemplary embodiment of the present disclosure
  • FIG. 8 is a schematic diagram of reading and writing situations of a message fde at a certain time according to an exemplary embodiment of the present disclosure
  • FIG. 9 is a flowchart of a method for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure
  • FIG. 10 is a schematic diagram of a situation where a message file is read at a certain time according to another exemplary embodiment of the present disclosure.
  • FIG. 11 is a flowchart of a method for consuming messages based on a message queue according to another exemplary embodiment of the present disclosure
  • FIG. 12 is a block diagram of an apparatus for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure
  • FIG. 13 is a block diagram of an apparatus for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure.
  • FIG. 14 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
  • a producer refers to an application or a module that generates a message, such as a social application
  • a consumer refers to an application or a module that reads a message and is capable of subsequently processing on the read message.
  • the social application needs to read a verification code in a short message service (SMS) application.
  • SMS short message service
  • FIG. 1 is a structural block diagram of a computer system according to an exemplary embodiment of the present disclosure.
  • the computer system 100 includes: a producer program 120 for supporting message sending, a consumer program 160 for supporting message acquisition, and a message queue 140.
  • the producer program 120 establishes a communication with the message queue 140.
  • the producer program 120 includes: a social application, a shopping application, a video application, a music application, an image application, etc.
  • the message queue 140 includes at least one of a server, a plurality of servers, a cloud computing platform, and a virtualization center.
  • the message queue 140 includes a memory 142 and a processor 144.
  • the memory 142 is configured to store a message published by the producer program 120
  • the processor 144 is configured to support the consumer program 160 to acquire the message generated by the producer.
  • the consumer program 160 establishes a communication with the message queue 140.
  • the consumer program 160 includes: a social application, a shopping application, a video application, a music application, an image application, etc.
  • the producer program 120 and the consumer program 160 may be the same application, or different categories of applications, or different applications under the same category.
  • the producer program 120 and the message queue 140 are in the same terminal; or the consumer program 160 and the message queue 140 are in the same terminal; or the producer program 120 and the consumer program 160 are in the same terminal; or the producer program 120, the consumer program 160, and the message queue 140 are in the same terminal; or the producer program 120, the consumer program 160, and the message queue 140 are distributed on different terminals, respectively.
  • the message queue 140 is responsible for primary computing work, and the producer program 120 and the consumer program 160 are responsible for secondary computing work; or, the message queue 140 is responsible for the secondary computing work, and the producer program 120 and the consumer program 160 are responsible for the primary computing work; or, a distributed computing architecture is employed among the message queue 140, the producer program 120, and the consumer program 160 for collaborative computing.
  • At least one producer program 120 and at least one consumer program 160 are present in the computer system 100, and this embodiment is illustrated by taking only one producer program 120 and one consumer program 160 as an example. Terminals in which the producer program 120 and the consumer program 160 are located are the same or different in device type.
  • the device type includes at least one of the following: smart phones, tablet computers, e-book readers, MP3 players, MP4 players, portable laptop computers, desktop computers and notebook computers.
  • the number of the above terminals may be more or less. For example, there may be only one, tens of, hundreds of, or more terminals above, wherein the number of the terminals and the device type thereof are not limited in the embodiments of the present disclosure.
  • FIG. 2 is a schematic structural diagram of a server according to an exemplary embodiment of the present disclosure.
  • the server is the message queue 140 illustrated in FIG. 1.
  • the server 200 includes a central processing unit (CPU) 201, a system memory 204 including a random-access memory (RAM) 202 and a read-only memory (ROM) 203, and a system bus 205 connecting the system memory 204 and the central processing unit 201.
  • the server 200 further includes a basic input/output system (I/O system) 206 for transmitting information among various components in a computer, and a mass storage device 207 for storing an operating system 213, an application 214 and other program modules 215.
  • I/O system basic input/output system
  • the basic input/output system 206 includes a display 208 for displaying information and an input device 209 such as a mouse, a keyboard and the like, for inputting information by a user.
  • the display 208 and the input device 209 are both connected to the central processing unit 201 through an input/output controller 210 connected to the system bus 205.
  • the basic input/output system 206 may further include the input/output controller 210 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse or an electronic stylus.
  • the input/output controller 210 further provides an output to a display screen, a printer, or other types of output devices.
  • the mass storage device 207 is connected to the central processing unit 201 through a mass storage controller (not illustrated) connected to the system bus 205.
  • the mass storage device 207 and a computer-readable medium associated therewith provide non-volatile storage for the server 200. That is, the mass storage device 207 may include a computer-readable medium (not illustrated) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
  • a computer-readable medium such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
  • the computer-readable medium may include a computer storage medium and a communication medium.
  • the computer storage medium includes volatile and nonvolatile as well as removable and non-removable media implemented by any methods or technologies for storing information such as computer-readable instructions, data structures, program modules or other data.
  • the computer storage medium includes an RAM, an ROM, an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory or other solid-state storage technologies, a CD-ROM, a digital versatile disc (DVD) or other optical storages, a tape cassette, a magnetic tape, a magnetic disk storage or other magnetic storage devices.
  • the system memory 204 and the mass storage device 207 may be collectively referred to as a memory.
  • the server 200 may further be operated by being connected by a network such as the Internet to a remote computer. That is, the server 200 may be connected to the network 212 by a network interface unit 211 connected to the system bus 205; or that is, the server 200 may be connected to other types of networks or remote computer systems (not illustrated) by using the network interface unit 211.
  • a network such as the Internet
  • the server 200 may be connected to the network 212 by a network interface unit 211 connected to the system bus 205; or that is, the server 200 may be connected to other types of networks or remote computer systems (not illustrated) by using the network interface unit 211.
  • the memory further includes one or more programs, which is/are stored in the memory and configured to be executed by the CPU.
  • the producer refers to an application that generates a message; the consumer refers to an application that acquires (or actively reads or is authorized to read) the message; and the message queue refers to a "container" that stores the message generated by the producer.
  • the producer only needs to generate the message and deposit the message in the message queue, without the need of determining which consumer acquires the message from the message queue. Therefore, one producer corresponding to one consumer, or one producer corresponding to a plurality of consumers, or a plurality of producers corresponding to a plurality of consumers may be implemented by the message queue.
  • the producer is a communication application; the consumer is a shopping application; and the shopping application reads a message, such as a verification code, deposited in the message queue by the communication application.
  • a producer 101 deposits a message in a message queue 10; and the message queue 10 generates a message file, writes the message into the message file, and records reading positions of a consumer 102 and a consumer 103 in the message file.
  • Different consumers are different in consumption speed, that is, the speeds at which the consumer 102 and the consumer 103 read the same message are different.
  • the consumer 102 and the consumer 103 may read the message file according to their respective reading positions. The reading positions at which the consumers read the file are recorded, such that the consumer 102 and the consumer 103 may independently acquire the message without interfering with each other.
  • the consumer 102 reads to a 46 th byte of a file 2
  • the consumer 103 reads to an 1112 nd byte of a file 3
  • the message queue 10 records the reading positions of the consumer 102 and the consumer 103, such that the consumer 102 and the consumer 103, when reading again, may continue to read the message according to the above reading positions.
  • the consumer 102 and the consumer 103 above may acquire the message from the message queue 10 simultaneously, or acquire the message from the message queue 10 in a certain sequence.
  • five message files are generated in the message queue 10.
  • the five message files are divided into a type-A and a type-B.
  • Type-A messages are generated by three producers, and type-B messages are generated by two producers, wherein the three producers generating the type -A messages are social applications, and the two producers generating the type-B messages are music applications.
  • the type-A messages are read by one consumer, and the type-b messages are read by two consumers.
  • the three consumers read the messages in the message files according to their respective reading positions without interfering with one another.
  • FIG. 4 is a flowchart of a method for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
  • a message file is acquired.
  • the message file stores a message generated by a producer program in a form of message queue.
  • the message file refers to a file that stores a message generated by a producer program; the producer program is any application, such as a social application, a game application, a music application, a video application, an image application, a system application and the like.
  • the message queue generates a message file based on a message generated by the producer program, and the generated message file contains the message; alternatively, the message queue is provided with a message file in default, and stores a message generated by the producer program in the message file after acquiring the message; alternatively, the message file is generated by the producer program and acquired from the producer program by the message queue.
  • the message queue is provided with a message processing module, which generates a message file according to a message generated by the producer program.
  • step 402 a reading position of a consumer program in the message file is determined from consumer status data.
  • the consumer status data is in one-to-one correspondence to the consumer program.
  • Consumer status data refers to data that characterizes a reading status of a consumer program.
  • the reading status includes at least one of the following: an identifier of a message file to be read, a reading start position, a reading content, a reading number of times, a reading time, and a reading end position.
  • the consumer status data is stored in a consumer status fde, or the consumer status data may be uploaded to a cloud server.
  • the reading status includes: an identifier of a read message file, a reading start position and a reading end position
  • the message queue determines the identifier of the message file to be read from consumer data, and then a message file in which the message to be read by the consumer program is located is determined; a current start position to be read of the consumer program is determined according to the reading start position; and a position of the consumer program after completing current message reading is determined according to the reading end position, and optionally, this position is a start position for next message reading.
  • a first message in the message file is read according to the reading position.
  • the reading position includes at least one of the following: an identifier (such as a name or a number) of a reading file, a reading start position (such as a 52 nd byte), and a reading end position (such as a 520 th byte).
  • the reading position is a start position of current message reading of the consumer program.
  • the reading position is a 65 th byte in a message file B; and the message queue determines the message file B as a message file to be read by the consumer program according to the reading position, and determines that the consumer program starts the reading from the 65 th byte in the message file B.
  • step 404 the first message is sent to the consumer program.
  • the message queue sends a message corresponding to the 65 th byte in the message file B to the consumer program.
  • FIG. 5 is a flowchart of a method for transmitting messages based on a message queue according to another exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
  • step 501 at least two message files are acquired.
  • the message files include at least two message files arranged in sequence.
  • the sequence is a sequence in which messages are written into the message files cyclically; or the sequence is a sequence in which the messages are read cyclically; or the sequence is a sequence in which the message files are generated.
  • FIG. 6 is a structural block diagram of a message transmitting system according to an exemplary embodiment of the present disclosure.
  • the message transmitting system 200 includes a producer 1 (that is, a producer program), a message queue 21, and n consumers (that is, consumer programs), with n being a positive integer (such as a consumer 1, a consumer 2 ... a consumer n).
  • the producer 1 generates two messages and sends them to the message queue 21.
  • the message queue 21 includes a message processing module 201, which generates two message files based on the two messages.
  • the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag.
  • the producer 1 generates two types of messages corresponding to two message tags, one for each type of message.
  • acquiring the message files by the message queue 21 includes the following sub-steps.
  • a first message tag corresponding to a consumer program is determined.
  • the message queue 21 first determines the first message tag, which corresponds to the type of a first message.
  • a message file corresponding to the first message tag is determined from at least two types of message files.
  • a type corresponding to the first message file is a type-A
  • a type corresponding to the first message file is a type-B
  • a type corresponding to the first message file is a type-C.
  • the form of the tag is not limited in the present disclosure.
  • the message queue 21 determines that the first message tag corresponding to the consumer program is a, or may determine that a type of the message file is the type-A; and the message queue 21 may further determine a reading position of the consumer program from the message files belonging to the type-A.
  • step 502 a reading position of a consumer program in the message file is determined from consumer status data.
  • the consumer status data is in one-to-one correspondence to the consumer program.
  • each consumer program corresponds to its respective consumer status file, which stores the consumer status data of the consumer program.
  • a consumer status file corresponding to a consumer 1 is a file 1
  • a consumer status file corresponding to a consumer 2 is a file 2
  • a consumer status file corresponding to a consumer 3 is a file 3.
  • the file 1, the file 2 and the file 3 are different from one another.
  • a first target message file to be read is determined between at least two message files according to a first message file identifier in the reading position.
  • step 504 a first message is read from the first target message file according to a first message file offset in the reading position.
  • the reading position includes: a first message file identifier and a first message file offset.
  • the first message file identifier is intended to characterize which file in the message queue is read by the consumer program, for example, what the consumer program reads is a message in a message file A;
  • the first message file offset is intended to characterize a reading position of the consumer program in the first message file, for example, a 52 nd byte in the first message file.
  • a message file offset is expressed in bytes.
  • the first message file identifier 2019122115330001 indicates a first message file numbered 0001 at 15:53 on December 21, 2019; and offset_a indicates that the first message file numbered 0001 offset is a bytes.
  • the forms of the message file identifier and the message file offset are not limited in the present disclosure.
  • the first message is sent to the consumer program.
  • Step 505 is the same as step 404, and is not repeated herein.
  • Steps SI and S2 are executed in combination with other steps or not executed.
  • the message queue may first determine the type which each message file belongs to according to a message tag corresponding to the message file, and then read the first message according to the first message file identifier and the reading position of the first message.
  • a plurality of consumer programs can independently read messages from the message queue, thereby enabling "one sender and multiple receivers” and “multiple senders and multiple receivers” in a mode with a plurality of messages or a plurality of types of message.
  • the following describes a process that a message generated by a producer program is written into a message file by a message queue .
  • FIG. 7 is a flowchart of a method for transmitting messages based on a message queue in conjunction with message tags according to an exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
  • step 701 a second message generated by a producer program is acquired.
  • the message file includes at least two message files arranged in sequence, and each message file has an upper limit of file size.
  • the upper limit of file size of the message file 1 is 100 megabytes (MB).
  • a second message generated by one producer program is a message belonging to a plurality of types; alternatively, a plurality of messages are generated by a plurality of producer programs, and the messages generated by the each producer program belong to different types.
  • the message file includes at least two types of message files, and each type of message file corresponds to a respective message tag.
  • this step includes the following sub-steps.
  • SI 1 a second message tag corresponding to the second message is determined.
  • the message queue first determines the second message tag, which corresponds to a first message type.
  • a message file corresponding to the second message tag is determined from at least two types of message files.
  • a type corresponding to the second message file is a type-A
  • a type corresponding to the second message file is a type-B
  • a type corresponding to the second message file is atype-C.
  • the form of the tag is not limited in the present disclosure.
  • a last writing position of the producer program is acquired. The last writing position includes a second message file identifier and a second message file offset.
  • the writing position indicates a corresponding position when a message generated by the producer program is written into a message file last time by the message queue.
  • the second message file identifier is intended to characterize which file the message queue writes the message into, for example, the message queue writes the producer program into the message file A; and the second message file offset is intended to characterize a position into which the message queue writes the message in the second message file, for example, a 52 nd byte in the second message file.
  • a data volume of a message is expressed in bytes.
  • the second message file identifier 2019122114330001 indicates a second message file numbered 0001 at 14:33 on December 21, 2019; and offset_c indicates that the second message file offset numbered 0001 is P bytes.
  • the forms of the message file identifier and the message file offset are not limited in the present disclosure.
  • step 703a the second message is written into a k th message file, in the case that a total size of the second message does not reach an upper limit of file size in the k th message file, and the last writing position is updated.
  • a k th message file is a message file corresponding to the second message file identifier, and a total size of the second message is a sum of a data volume of the second message and the second message file offset, wherein k>2 and k is an integer.
  • the message queue When writing a message into a message file, the message queue first judges whether a magnitude of the total size of the second message is greater than a file size of the message file to be written into, wherein the total size of the second message is a sum of the message to be written and a current writing position; and if the sum is not greater than the file size of the message file to be written into, the message queue writes the message to be written directly into the message file.
  • the message queue updates a byte in the k th message file as the last writing position.
  • the message queue writes the message into an 110 th byte in the third message file, and updates the last writing position to the 110 th byte of a message file numbered 0003.
  • step 703b a (k+l) th message file is generated in the case that the total size of the second message reaches the upper limit of file size in the k th message file, the second message is written into the (k+l) th message file, and the last writing position is updated, wherein k>2 and k is an integer.
  • the message to be written is written into a message fil next to the message file to be written into.
  • a message intends to be written into a message file numbered 0004 (which is a fourth file in the message queue)
  • the total size of the message is greater than the size of the message file numbered 0004
  • the message queue generates a fifth file numbered as 0005.
  • the message queue generates a (k+l) th file in advance.
  • the (k+l) th file is generated simultaneously; or the message queue generates n files simultaneously, wherein n is a total number of message files in the message queue.
  • step 703c in the case that the total size of the second message reaches the upper limit of file size in the n th message file, the message in the first message file is deleted, then the second message is written into the first message file and the last writing position is updated, wherein k ⁇ n and n is a positive integer greater than 2.
  • message files further include: an upper limit n of the number of message files.
  • n is 50, and there are 50 message files in the message queue which are numbered as 0000-0049.
  • the message queue writes a message to a message file No. 0048
  • the total size of second message reaches the upper limit of file size in a 50 th file
  • the message queue starts writing from a first message file (message file numbered 0000). That is, after a message in the first message file is deleted, the message queue writes the message into the first message file, and updates the last writing position to a b th byte in the message file numbered 0000
  • the message queue may write messages generated by producer programs into message files cyclically. After a message is written into a message file, a process of writing the message and a process of reading the message are executed simultaneously, or in a certain sequence.
  • FIG. 8 is reading and writing situations of a message file at a certain time.
  • the reading and writing situations include: a reading position of a consumer program 311 in a message file 03 (with an arrow pointing to the reading position), a reading position of a consumer program 312 in a message file 04, and a reading position of a consumer program 313 in a message file 09, wherein a writing position of the message file 03 is a position 301.
  • the message queue may delete messages in message files.
  • a message storage time in a k th message file is greater than a time threshold, and a message file corresponding to a last writing position is an m th message file, wherein m ⁇ n and m is a positive integer.
  • the message queue 21 is provided with a garbage collecting module 203, which is configured to delete messages of which the retained time is too long.
  • k is 10
  • the time threshold is 60 seconds
  • a message file into which a message is written currently is a 20 th message file. If a storage time of messages in a 10 th message file, arranged in a cyclic writing sequence, in the message queue is greater than the time threshold, the message queue acquires a storage time of messages in a 9 th message file.
  • messages in a second target message file are deleted in the case that the storage time of the messages in the (k-l) th message file is greater than the time threshold.
  • the second target message file is a message file that is in a reverse sequence and is located between a k th message file and an m th message file.
  • the reverse sequence is a sequence reverse to the cyclic writing sequence.
  • the cyclic writing sequence refers to writing messages into message files in an increasing sequence of number of the message files.
  • the message queue starts writing from a message file numbered 001, which is a first file, and continues writing till a message file numbered 050 (i.e. a 50 th message file), and after the 50 message files are full, writes into the first message file again.
  • the reverse sequence refers to performing checking or deleting operations in a decreasing sequence of number by starting from the sequence of last writing position.
  • a message file corresponding to the last writing position is a message file numbered 020 (i.e.
  • a 20 th message file when a message with a storage time greater than the time threshold is determined, checking is started from the 20 th message file till the first message file. If a storage time of a message in the first message file still does not exceed the time threshold, a 50 th message file, a 49 th message file... and a 21 st message file are checked till determining a message file corresponding to a message with a storage time greater than the time threshold.
  • the second target message file is a message file that is in a reverse sequence and is located between a 10 th message file and a 20 th message file, excluding the 10 th message file and the 20 th message file. That is, messages in a 9 th message file, an 8 th message file, a 7 th message file...and a first message file are deleted, and meanwhile, messages in a 49 th message file, a 48 th message file, a 47 th message file...and a 21 st message file are deleted.
  • a target message file into which a second message is written is determined by determining that a total size of the second message reaches an upper limit of file size in the file to be written into. If a plurality of messages or a plurality of types of messages exist, the message queue first determines a type of a message file to be written into by determining a message tag, and then writes the message, thereby ensuring that the messages written by the message queue is accurate and ordered.
  • FIG. 9 is a flowchart of a method for consumption based on a message queue according to an exemplary embodiment of the present disclosure. The method is applicable to the computer system 100 illustrated in FIG. 1, and includes the following steps.
  • step 901 a message is written into a corresponding current writing position in a message file.
  • the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, wherein n is a positive integer.
  • n is 50; 50 message files are stored in the message queue and numbered from 000 to 049, respectively; and the message queue writes received messages generated by producers into the 50 files cyclically.
  • a writing sequence of the message files includes an increasing sequence of file numbers or a decreasing sequence of file numbers.
  • messages are to be written into a message file numbered 000, and messages originally written into the message file numbered 000 are overwritten by new messages; or the original written messages are deleted first, and then new messages are written.
  • the message files may further be written in a cyclic writing sequence according to initials of file names. For example, cyclic writing is started from a file which the file name is A.
  • the message queue writes a message into a current writing position which is an 100 th byte in a message file numbered 030.
  • step 902 a corresponding current reading position of a consumer program in the message file is acquired.
  • the current reading position is a reading position determined in the n message files according to a cyclic reading sequence.
  • a cyclic reading sequence is the same as the cyclic writing sequence, and is determined as the cyclic writing sequence of the messages is determined.
  • the cyclic reading sequence refers to reading in an increasing sequence of file numbers.
  • the message queue acquires a current reading position which is an 100 th byte in a message file numbered 030.
  • the current reading position is updated to a target reading position in to the case that the current writing position coincides with the current reading position.
  • the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence.
  • a target reading position is a reading position defined by the message queue by default, or a reading position automatically selected by a server according to a consumption speed of a consumer program.
  • a distance between the current reading position and the target reading position is constant; or the distance becomes larger and larger; or the distance is intelligently adjusted according to the consumption speed of the consumer program.
  • the current reading position is an 100 th byte in a message file numbered 030
  • the target reading position is an 100 th byte in a message file numbered 048.
  • the message queue updates the current reading position from the 100 th byte in the message file numbered 030 to the 100 th byte in the message file numbered 048.
  • step 903 further includes the following sub-steps.
  • step 9031 a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time is acquired.
  • the history reading position of the consumer program coincides with the history writing position of the producer program twice, and a timestamp of a first (i.e., last) coincidence is a time M 1.
  • step 9032 a second timestamp when the current reading position coincides with the current writing position is acquired.
  • a timestamp of a second (i.e., current) coincidence is a time M2.
  • step 9033 the current reading position is updated to the target reading position according to a difference between the first timestamp and the second timestamp.
  • a corresponding relationship exists between the difference between the first timestamp and the second timestamp, and the target reading position.
  • the target reading position is kx(M2-Ml).
  • step 904 a message in the message file read at the target reading position is sent to the consumer program.
  • the message queue starts reading from the 100 th byte in the message file numbered 048, and sends the read message to the consumer program.
  • the current reading position when the current writing position coincides with the current reading position, the current reading position is updated to the target reading position, that is, the current reading position is updated along a writing direction of the cyclic writing sequence, such that the reading position and the writing position of the consumer program maintain a distance again, and for consumer programs with an occasional low consumption speed, only a small part of messages may be lost.
  • FIG. 11 illustrates a flowchart of a method for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure. This method may be applied to the computer system 100 illustrated in FIG. 1, and includes the following steps.
  • step 1101 a message is written into a corresponding current writing position in a message fde.
  • the message is generated by a producer program, and the current writing position is a writing position determined in n message fdes according to a cyclic writing sequence, wherein n is a positive integer.
  • step 1102 a corresponding current reading position of a consumer program in the message fde is acquired.
  • the current reading position is a reading position determined in the n message fdes according to a cyclic reading sequence.
  • Steps 1101 and 1102 are the same as steps 901 and 902 illustrated in FIG. 9, and are not be repeated herein.
  • step 1103 a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time is acquired.
  • step 1104 a second timestamp when the current reading position coincides with the current writing position is acquired.
  • Steps 1103 and 1104 are the same as steps 9031 and 9032, and are not be repeated herein.
  • step 1105a the current reading position is updated to a first target reading position in to the case that a difference between the first timestamp and the second timestamp is greater than a time threshold.
  • a length between the current reading position and the first target reading position is a second length, wherein the second length is a predetermined value.
  • the predetermined value is 10 megabytes in length.
  • the predetermined value is an initial value or a default value defined by a computer device.
  • the message files include at least two message files arranged in sequence, and a message file 03, a message file 04, and a message file 09 are stored in the message queue.
  • a consumer 1 corresponds to a reading position 411 (as illustrate by the arrow)
  • a consumer 2 corresponds to a reading position 412
  • a consumer 3 corresponds to a reading position 413
  • a current writing position of the message queue is a writing position 401.
  • a reading speed at the reading position 411 is very high, and may "catch up” the writing position 401; a reading speed at the reading position 412 is very low, the writing position 401 is very close to the reading position 412 and may "catch up” the reading position 412; and a reading speed at the reading position 413 is normal, and the writing position 401 and the reading position 413 maintain a certain distance.
  • the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 10 megabytes from the current reading position to a writing direction of the cyclic writing sequence. For example, a reading position after the movement is the reading position 413, and the corresponding timestamp Ml is recorded.
  • the time threshold is a maximum slow-start decision time N.
  • N the number of bits in the message queue.
  • the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 10 megabytes from the current reading position to the writing direction of the cyclic writing sequence.
  • step 1105b the current reading position is updated to a second target reading position in the case that the difference between the first timestamp and the second timestamp is not greater than a time threshold.
  • a length between the history reading position and a history target reading position is a first length
  • a length between the current reading position and the second target reading position is a second length
  • the first length is less than the second length.
  • the second length and the first length satisfy a corresponding relationship, such as a multiple relationship; or the second length is determined with a predetermined method such as a comparison table, for example, a first length a corresponds to a second length b; or the second length is equal to the first length plus a predetermined step length.
  • the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 20 megabytes from the current reading position to the writing direction of the cyclic writing sequence. Based on this, when the writing position 401 "catches up" the reading position 412 for the third time, a timestamp M3 is recorded. If M3-M2 ⁇ N, the reading position 412 is moved by a length corresponding to 40 megabytes from the current reading position to the writing direction of the cyclic writing sequence.
  • a target reading position after the updating may change.
  • the updated target reading position is acquired as follows.
  • the current reading position is updated to a third target reading position in the case that the second length reaches a predetermined length, wherein a length between the current reading position and the third target reading position is the predetermined length.
  • the total number of times refers to a cumulative number of times when the reading position of the consumer program coincides with the writing position of the producer program.
  • a process proceeds till the length by which the reading position 412 is moved reaches a predetermined maximum value (i.e., the predetermined length) Q.
  • the predetermined maximum value Q i.e., the predetermined length
  • the writing position 401 may take a long time to "catch up" the updated reading position of the consumer.
  • the length by which the reading position is moved is still a length corresponding to 10 megabytes as long as a time interval between any timestamp and a last timestamp is greater than N.
  • the current reading position is updated to a third target reading position in the case that the total number of times reaches the predetermined number of times.
  • the current reading position is moved to the writing direction of the cyclic writing sequence by a length corresponding to Q bytes.
  • step 1106 a message in the message file read at the target reading position is sent to the consumer program.
  • Step 1106 is the same as step 904, and is not repeated herein.
  • producer programs are online shopping programs (a customer side) corresponding to users
  • consumer programs include a management program of an online shopping platform, an online shopping program (a merchant side) corresponding to merchants, and an express program corresponding to express companies.
  • a plurality of producer programs are accessed to the message queue.
  • messages generated by the respective producer programs are purchase orders corresponding to flash sale products.
  • the purchase orders include information such as goods purchased by customers, quantity, price, order number, delivery address, and coupon usage.
  • the message queue generates corresponding message files according to the purchase orders.
  • the message file may be tagged according to types of goods.
  • the consumer programs read messages in the message files according to tags corresponding to the message files, first message files identifiers, and first message files offsets. Three consumers read the messages from the message files independently according to their own reading positions.
  • the management program of the online shopping platform processes the read messages to derive that a turnover of a food category in one flash sale scenario is 50,000 yuan; the online shopping program corresponding to the merchants processes the read messages to derive that a turnover of a product in one flash sale scenario is 10,000 yuan; and the express program processes the read messages to derive that a delivery address of a user A is No. 187, XX Street, MG District, MG City.
  • a plurality of consumers may read messages in a message queue simultaneously, which improves the efficiency of transmission of the message queue and ensures the smoothness in message transmission in high concurrency scenarios for the server.
  • FIG. 12 is a block diagram of an apparatus for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure.
  • This apparatus may be implemented as all of or a part of a terminal through software, hardware or a combination of both.
  • the apparatus includes:
  • a first acquiring module 1210 configured to acquire a message file, the message file storing a message generated by a producer program in a form of message queue;
  • a first processing module 1220 configured to determine a reading position of a consumer program in the message file from consumer status data, the consumer status data is in one-to-one correspondence to the consumer program;
  • a first reading module 1230 configured to read a first message in the message file according to the reading position
  • a sending module 1240 configured to send the first message to the consumer program.
  • the message file includes at least two message files arranged in sequence, and the reading position includes: a first message file identifier and a first message file offset;
  • the first processing module 1220 is configured to determine a first target message file to be read between at least two message files according to a first message file identifier in the reading position;
  • the first reading module 1230 is configured to read the first message from the first target message file according to a first message file offset in the reading position.
  • the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag; wherein [00190] the first acquiring module 1210 is configured to determine a first message tag corresponding to the consumer program, and to determine, from at least two types of message files, a message file corresponding to the first message tag.
  • the apparatus includes a writing module; and the message files include at least two message files arranged in sequence, with each message file having an upper limit of file size;
  • the first acquiring module 1210 is configured to acquire a second message generated by the producer program, and to acquire a last writing position of the producer program, the last writing position includes a second message file identifier and a second message file offset;
  • the first writing module 1250 is configured to write the second message into a k th message file and to update the last writing position in the case that a total size of the second message does not reach the upper limit of file size in the k th message file, wherein the k th message file is a message file corresponding to the second message file identifier, and a total size of the second message is a sum of a data volume of second message and the second message file offset, with k>2 and k being a positive integer; and
  • the first writing module 1250 is configured to generate a (k+l) th message file, to write the second message into the (k+l) th message file and to update the last writing position in to the case that the total size of the second message reaches the upper limit of file size in the k th message file.
  • the message files further include: an upper limit n of the number of message files;
  • the first writing module 1250 is configured to delete the message in the first message file, then to write the second message into the first message file and to update the last writing position in to the case that the total size of the second message reaches the upper limit of file size in the n th message file, with k ⁇ n and n being a positive integer greater than 2.
  • the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag; wherein [00198] the first processing module 1220 is configured to determine a second message tag corresponding to the second message, and to determine, from at least two types of message files, a message file corresponding to the second message tag.
  • the apparatus includes a deleting module 1260; and it is assumed that a storage time of a message in a k th message file is greater than a time threshold, and a message file corresponding to a last writing position is an m th message file, with m ⁇ n and m being a positive integer;
  • the first acquiring module 1210 is configured to acquire a storage time of a message in a (k-l) th message file
  • the deleting module 1260 is configured to delete messages in a second target message file in to the case that the storage time of the message in the (k-l) th message file is greater than the time threshold.
  • the second target message file is a message file that is in a reverse sequence and is located between the k th message file and the m th message file.
  • FIG. 13 is a block diagram of an apparatus for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure.
  • This apparatus may be implemented as all of or a part of a terminal through software, hardware or a combination of both.
  • the apparatus includes:
  • a second writing module 1310 configured to write a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer;
  • a second acquiring module 1320 configured to acquire a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence;
  • a second processing module 1330 configured to update the current reading position to a target reading position in to the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and [00206] a second reading module 1340 configured to send a message in the message file read at the target reading position to the consumer program.
  • the second acquiring module 1320 is configured to acquire a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time;
  • the second acquiring module 1320 is configured to acquire a second timestamp when the current reading position coincides with the current writing position
  • the second processing module 1330 is configured to update the current reading position to the target reading position according to a difference between the first timestamp and the second timestamp.
  • the second processing module 1330 is configured to update the current reading position to a second target reading position in to the case that a difference between the first timestamp and the second timestamp is not greater than a time threshold; a length between the history reading position and the history target reading position is a first length, a length between the current reading position and the second target reading position is a second length, and the first length is less than the second length.
  • the second processing module 1330 is configured to update the current reading position to a first target reading position in the case that the difference between the first timestamp and the second timestamp is greater than the time threshold; a length between the current reading position and the first target reading position is a second length, and the second length is a predetermined value.
  • the second acquiring module 1320 is configured to acquire a total length when the history reading position of the consumer program is updated in a history update process; and the second processing module 1330 is configured to update the current reading position to a third target reading position in the case that the total length reaches a predetermined length, and a length between the current reading position and the third target reading position is the predetermined length.
  • the second acquiring module 1320 is configured to acquire a total number of times of when the history reading position of the consumer program is updated in the history update process; and the second processing module 1330 is configured to update the current reading position to the third target reading position in to the case that the total number of times reaches a predetermined number of times.
  • the present disclosure further provides a computer device.
  • the computer device 1400 includes a processor 1401 and a memory 1402.
  • the memory 1402 stores at least one instruction, at least one program, a code set or an instruction set, wherein the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor 1401 to implement a method for transmitting messages based on a message queue and a method for consuming messages based on a message queue, as described in the method embodiments above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure discloses a method, an apparatus and a device for consuming messages based on a message queue, and belongs to the field of computer data communications. The method includes: writing a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, wherein n is a positive integer; acquiring a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence; updating the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and sending a message in the message file read at the target reading position to the consumer program.

Description

METHOD, APPARATUS AND DEVICE FOR CONSUMING MESSAGES BASED ON MESSAGE QUEUE
TECHNICAU FIEUD
[0001] The present disclosure relates to the field of computer data communications, and in particular, relates to a method, an apparatus and a device for consuming messages based on a message queue.
BACKGROUND
[0002] Message queue (MQ) is a method for communicating between applications, where an application, after sending a message to the message queue, may return immediately, and the reliable transmission of the message can be ensured by a message system. A message producer (i.e. a message publisher) publishes the message to the message queue, a message consumer (i.e. an active message acquirer) acquires the message from the message queue, and there is no mutual interference between the producer and the consumer.
SUMMARY
[0003] The embodiments of the present disclosure provide a method, an apparatus and a device for consuming messages based on a message queue, such that consumers with a low consumption speed, when reading a message, have a minimal impact on producers or other consumers in a message transmitting system. The technical solutions are as follows.
[0004] According to one aspect of the present disclosure, a method for consuming messages based on a message queue is provided. The method includes:
[0005] writing a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer;
[0006] acquiring a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence;
[0007] updating the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and
[0008] sending a message in the message file read at the target reading position to the consumer program.
[0009] According to another aspect of the present disclosure, an apparatus for consuming messages based on a message queue is provided. The apparatus includes:
[0010] a writing module configured to write a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer;
[0011] an acquiring module configured to acquire a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence;
[0012] a processing module configured to update the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and [0013] a reading module configured to send a message in the message file read at the target reading position to the consumer program.
[0014] According to another aspect of the present disclosure, a computer device is provided. The computer device is provided with a sensor, and includes a processor and a memory. The memory stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the method for consuming messages based on a message queue as defined in the aspects above.
[0015] The technical solutions provided by embodiments of the present disclosure may bring the following beneficial effects.
[0016] When the current writing position coincides with the current reading position, the current reading position is updated to the target reading position, that is, the current reading position is updated along a writing direction of the cyclic writing sequence, such that the reading position and the writing position of the consumer program maintain a distance again, and for consumer programs with an occasional low consumption speed, only a small part of messages may be lost.
BRIEF DESCRIPTION OF THE DRAWINGS [0017] In order to describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings as described below show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may also derive other drawings from these accompanying drawings without creative efforts.
[0018] FIG. 1 is a schematic diagram of a computer system according to an exemplary embodiment of the present disclosure;
[0019] FIG. 2 is a structural block diagram of a server according to an exemplary embodiment of the present disclosure;
[0020] FIG. 3 is a schematic diagram of a message system according to an exemplary embodiment of the present disclosure;
[0021] FIG. 4 is a flowchart of a method for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure;
[0022] FIG. 5 is a flowchart of a method for transmitting messages based on a message queue according to another exemplary embodiment of the present disclosure;
[0023] FIG. 6 is a schematic diagram of a message system according to another exemplary embodiment of the present disclosure;
[0024] FIG. 7 is a flowchart of a method for performing a writing operation by a message queue according to an exemplary embodiment of the present disclosure;
[0025] FIG. 8 is a schematic diagram of reading and writing situations of a message fde at a certain time according to an exemplary embodiment of the present disclosure;
[0026] FIG. 9 is a flowchart of a method for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure;
[0027] FIG. 10 is a schematic diagram of a situation where a message file is read at a certain time according to another exemplary embodiment of the present disclosure;
[0028] FIG. 11 is a flowchart of a method for consuming messages based on a message queue according to another exemplary embodiment of the present disclosure;
[0029] FIG. 12 is a block diagram of an apparatus for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure;
[0030] FIG. 13 is a block diagram of an apparatus for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure; and [0031] FIG. 14 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] To present the object, technical solutions and advantages of the present disclosure more clearly, the embodiments of the present disclosure are described in further detail with reference to the accompanying drawings.
[0033] First, the terms involved in the embodiments of the present disclosure are introduced as follows.
[0034] A producer refers to an application or a module that generates a message, such as a social application;
[0035] A consumer refers to an application or a module that reads a message and is capable of subsequently processing on the read message. For example, the social application needs to read a verification code in a short message service (SMS) application.
[0036] FIG. 1 is a structural block diagram of a computer system according to an exemplary embodiment of the present disclosure. The computer system 100 includes: a producer program 120 for supporting message sending, a consumer program 160 for supporting message acquisition, and a message queue 140.
[0037] The producer program 120 establishes a communication with the message queue 140. The producer program 120 includes: a social application, a shopping application, a video application, a music application, an image application, etc.
[0038] The message queue 140 includes at least one of a server, a plurality of servers, a cloud computing platform, and a virtualization center. The message queue 140 includes a memory 142 and a processor 144. The memory 142 is configured to store a message published by the producer program 120, and the processor 144 is configured to support the consumer program 160 to acquire the message generated by the producer.
[0039] The consumer program 160 establishes a communication with the message queue 140. The consumer program 160 includes: a social application, a shopping application, a video application, a music application, an image application, etc.
[0040] Optionally, the producer program 120 and the consumer program 160 may be the same application, or different categories of applications, or different applications under the same category. [0041] Optionally, the producer program 120 and the message queue 140 are in the same terminal; or the consumer program 160 and the message queue 140 are in the same terminal; or the producer program 120 and the consumer program 160 are in the same terminal; or the producer program 120, the consumer program 160, and the message queue 140 are in the same terminal; or the producer program 120, the consumer program 160, and the message queue 140 are distributed on different terminals, respectively.
[0042] Optionally, the message queue 140 is responsible for primary computing work, and the producer program 120 and the consumer program 160 are responsible for secondary computing work; or, the message queue 140 is responsible for the secondary computing work, and the producer program 120 and the consumer program 160 are responsible for the primary computing work; or, a distributed computing architecture is employed among the message queue 140, the producer program 120, and the consumer program 160 for collaborative computing.
[0043] It should be understood that at least one producer program 120 and at least one consumer program 160 are present in the computer system 100, and this embodiment is illustrated by taking only one producer program 120 and one consumer program 160 as an example. Terminals in which the producer program 120 and the consumer program 160 are located are the same or different in device type. The device type includes at least one of the following: smart phones, tablet computers, e-book readers, MP3 players, MP4 players, portable laptop computers, desktop computers and notebook computers.
[0044] Those skilled in the art may know that the number of the above terminals may be more or less. For example, there may be only one, tens of, hundreds of, or more terminals above, wherein the number of the terminals and the device type thereof are not limited in the embodiments of the present disclosure.
[0045] FIG. 2 is a schematic structural diagram of a server according to an exemplary embodiment of the present disclosure. The server is the message queue 140 illustrated in FIG. 1. [0046] Specifically, the server 200 includes a central processing unit (CPU) 201, a system memory 204 including a random-access memory (RAM) 202 and a read-only memory (ROM) 203, and a system bus 205 connecting the system memory 204 and the central processing unit 201. The server 200 further includes a basic input/output system (I/O system) 206 for transmitting information among various components in a computer, and a mass storage device 207 for storing an operating system 213, an application 214 and other program modules 215. [0047] The basic input/output system 206 includes a display 208 for displaying information and an input device 209 such as a mouse, a keyboard and the like, for inputting information by a user. The display 208 and the input device 209 are both connected to the central processing unit 201 through an input/output controller 210 connected to the system bus 205. The basic input/output system 206 may further include the input/output controller 210 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse or an electronic stylus. Similarly, the input/output controller 210 further provides an output to a display screen, a printer, or other types of output devices.
[0048] The mass storage device 207 is connected to the central processing unit 201 through a mass storage controller (not illustrated) connected to the system bus 205. The mass storage device 207 and a computer-readable medium associated therewith provide non-volatile storage for the server 200. That is, the mass storage device 207 may include a computer-readable medium (not illustrated) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0049] Without loss of generality, the computer-readable medium may include a computer storage medium and a communication medium. The computer storage medium includes volatile and nonvolatile as well as removable and non-removable media implemented by any methods or technologies for storing information such as computer-readable instructions, data structures, program modules or other data. The computer storage medium includes an RAM, an ROM, an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory or other solid-state storage technologies, a CD-ROM, a digital versatile disc (DVD) or other optical storages, a tape cassette, a magnetic tape, a magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art may know that the computer storage medium is not limited to the types described above. The system memory 204 and the mass storage device 207 may be collectively referred to as a memory.
[0050] According to various embodiments of the present disclosure, the server 200 may further be operated by being connected by a network such as the Internet to a remote computer. That is, the server 200 may be connected to the network 212 by a network interface unit 211 connected to the system bus 205; or that is, the server 200 may be connected to other types of networks or remote computer systems (not illustrated) by using the network interface unit 211.
[0051] The memory further includes one or more programs, which is/are stored in the memory and configured to be executed by the CPU.
[0052] The producer refers to an application that generates a message; the consumer refers to an application that acquires (or actively reads or is authorized to read) the message; and the message queue refers to a "container" that stores the message generated by the producer. The producer only needs to generate the message and deposit the message in the message queue, without the need of determining which consumer acquires the message from the message queue. Therefore, one producer corresponding to one consumer, or one producer corresponding to a plurality of consumers, or a plurality of producers corresponding to a plurality of consumers may be implemented by the message queue. For example, the producer is a communication application; the consumer is a shopping application; and the shopping application reads a message, such as a verification code, deposited in the message queue by the communication application.
[0053] As illustrated in FIG. 3, a producer 101 deposits a message in a message queue 10; and the message queue 10 generates a message file, writes the message into the message file, and records reading positions of a consumer 102 and a consumer 103 in the message file. Different consumers are different in consumption speed, that is, the speeds at which the consumer 102 and the consumer 103 read the same message are different. When the consumer 102 and the consumer 103 actively read the message from the message queue 10, the consumer 102 and the consumer 103 may read the message file according to their respective reading positions. The reading positions at which the consumers read the file are recorded, such that the consumer 102 and the consumer 103 may independently acquire the message without interfering with each other. In an example, the consumer 102 reads to a 46th byte of a file 2, the consumer 103 reads to an 1112nd byte of a file 3, and the message queue 10 records the reading positions of the consumer 102 and the consumer 103, such that the consumer 102 and the consumer 103, when reading again, may continue to read the message according to the above reading positions.
[0054] It should be understood that the consumer 102 and the consumer 103 above may acquire the message from the message queue 10 simultaneously, or acquire the message from the message queue 10 in a certain sequence. There may be one or more producers 101, who may generate one or more types of messages; the messages generated by a plurality of producers are same or different in category; and there may be one or more message files generated in the message queue 10. Illustratively, five message files are generated in the message queue 10. The five message files are divided into a type-A and a type-B. Type-A messages are generated by three producers, and type-B messages are generated by two producers, wherein the three producers generating the type -A messages are social applications, and the two producers generating the type-B messages are music applications. The type-A messages are read by one consumer, and the type-b messages are read by two consumers. The three consumers read the messages in the message files according to their respective reading positions without interfering with one another.
[0055] FIG. 4 is a flowchart of a method for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
[0056] In step 401, a message file is acquired. The message file stores a message generated by a producer program in a form of message queue.
[0057] The message file refers to a file that stores a message generated by a producer program; the producer program is any application, such as a social application, a game application, a music application, a video application, an image application, a system application and the like.
[0058] Optionally, the message queue generates a message file based on a message generated by the producer program, and the generated message file contains the message; alternatively, the message queue is provided with a message file in default, and stores a message generated by the producer program in the message file after acquiring the message; alternatively, the message file is generated by the producer program and acquired from the producer program by the message queue. Illustratively, the message queue is provided with a message processing module, which generates a message file according to a message generated by the producer program.
[0059] There may be one or more message files, which belong to the same type or different types. There may be one or more producer programs; one producer program may generate one or more messages, which belong to the same type or different types; and the producer programs may be of the same or different types.
[0060] In step 402, a reading position of a consumer program in the message file is determined from consumer status data. The consumer status data is in one-to-one correspondence to the consumer program.
[0061] Consumer status data refers to data that characterizes a reading status of a consumer program. Optionally, the reading status includes at least one of the following: an identifier of a message file to be read, a reading start position, a reading content, a reading number of times, a reading time, and a reading end position. Optionally, the consumer status data is stored in a consumer status fde, or the consumer status data may be uploaded to a cloud server.
[0062] In an example, the reading status includes: an identifier of a read message file, a reading start position and a reading end position The message queue determines the identifier of the message file to be read from consumer data, and then a message file in which the message to be read by the consumer program is located is determined; a current start position to be read of the consumer program is determined according to the reading start position; and a position of the consumer program after completing current message reading is determined according to the reading end position, and optionally, this position is a start position for next message reading. [0063] There is one or more consumer status data, and one or more consumer programs, and each consumer program corresponds to its respective reading position.
[0064] In step 403, a first message in the message file is read according to the reading position. [0065] Optionally, the reading position includes at least one of the following: an identifier (such as a name or a number) of a reading file, a reading start position (such as a 52nd byte), and a reading end position (such as a 520th byte). Illustratively, the reading position is a start position of current message reading of the consumer program. The reading position is a 65th byte in a message file B; and the message queue determines the message file B as a message file to be read by the consumer program according to the reading position, and determines that the consumer program starts the reading from the 65th byte in the message file B.
[0066] In step 404, the first message is sent to the consumer program.
[0067] Illustratively, as described in step 403, the message queue sends a message corresponding to the 65th byte in the message file B to the consumer program.
[0068] In summary, according to the method provided by this embodiment, a message file storing a message is acquired by a message queue; a reading position of the consumer program is determined according to consumer status data; and a read message is sent to the consumer program according to the reading position of the consumer. In this way, when a plurality of consumer programs read messages in the message queue, there is no need for the message queue to copy the message in a plurality of copies, which enables a plurality of consumers to consume the messages independently of each other, thereby improving the efficiency of message transmission of the message queue. [0069] FIG. 5 is a flowchart of a method for transmitting messages based on a message queue according to another exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
[0070] In step 501, at least two message files are acquired.
[0071] Optionally, the message files include at least two message files arranged in sequence. Optionally, the sequence is a sequence in which messages are written into the message files cyclically; or the sequence is a sequence in which the messages are read cyclically; or the sequence is a sequence in which the message files are generated.
[0072] FIG. 6 is a structural block diagram of a message transmitting system according to an exemplary embodiment of the present disclosure. The message transmitting system 200 includes a producer 1 (that is, a producer program), a message queue 21, and n consumers (that is, consumer programs), with n being a positive integer (such as a consumer 1, a consumer 2 ... a consumer n).
[0073] Illustratively, the producer 1 generates two messages and sends them to the message queue 21. The message queue 21 includes a message processing module 201, which generates two message files based on the two messages.
[0074] Optionally, the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag. Illustratively, the producer 1 generates two types of messages corresponding to two message tags, one for each type of message. Here, acquiring the message files by the message queue 21 includes the following sub-steps.
[0075] In SI, a first message tag corresponding to a consumer program is determined.
[0076] The message queue 21 first determines the first message tag, which corresponds to the type of a first message.
[0077] In S2, a message file corresponding to the first message tag is determined from at least two types of message files.
[0078] Illustratively, when the first message tag is a, a type corresponding to the first message file is a type-A; when the first message tag is b, a type corresponding to the first message file is a type-B; and when the first message tag is c, a type corresponding to the first message file is a type-C. The form of the tag is not limited in the present disclosure.
[0079] In an example, the message queue 21 determines that the first message tag corresponding to the consumer program is a, or may determine that a type of the message file is the type-A; and the message queue 21 may further determine a reading position of the consumer program from the message files belonging to the type-A.
[0080] In step 502, a reading position of a consumer program in the message file is determined from consumer status data. The consumer status data is in one-to-one correspondence to the consumer program.
[0081] Optionally, there are at least two consumer programs, and each consumer program corresponds to its respective consumer status file, which stores the consumer status data of the consumer program. [0082] Illustratively, as shown in FIG. 6, a consumer status file corresponding to a consumer 1 is a file 1, a consumer status file corresponding to a consumer 2 is a file 2 and a consumer status file corresponding to a consumer 3 is a file 3. The file 1, the file 2 and the file 3 are different from one another.
[0083] In step 503, a first target message file to be read is determined between at least two message files according to a first message file identifier in the reading position.
[0084] In step 504, a first message is read from the first target message file according to a first message file offset in the reading position.
[0085] Optionally, the reading position includes: a first message file identifier and a first message file offset. The first message file identifier is intended to characterize which file in the message queue is read by the consumer program, for example, what the consumer program reads is a message in a message file A;, and the first message file offset is intended to characterize a reading position of the consumer program in the first message file, for example, a 52nd byte in the first message file. Optionally, a message file offset is expressed in bytes.
[0086] The following describes relationships among the first message file identifier, the first message file offset, and the first message file tag with reference to Table 1.
[0087] Table 1
Figure imgf000013_0001
Figure imgf000014_0001
[0088] The first message file identifier 2019122115330001 indicates a first message file numbered 0001 at 15:53 on December 21, 2019; and offset_a indicates that the first message file numbered 0001 offset is a bytes. The forms of the message file identifier and the message file offset are not limited in the present disclosure. [0089] In step 505, the first message is sent to the consumer program.
[0090] Step 505 is the same as step 404, and is not repeated herein.
[0091] It should be understood that the steps above may be executed cyclically, that is, a consumer program cyclically reads messages in message files. Steps SI and S2 are executed in combination with other steps or not executed. [0092] In summary, according to the method provided by this embodiment, when a message queue acquires a plurality of message files, a reading position of a first message is determined according to a first message file identifier and a first message file offset; and if the plurality of message files belong to a plurality of types, the message queue may first determine the type which each message file belongs to according to a message tag corresponding to the message file, and then read the first message according to the first message file identifier and the reading position of the first message. In this way, a plurality of consumer programs can independently read messages from the message queue, thereby enabling "one sender and multiple receivers" and "multiple senders and multiple receivers" in a mode with a plurality of messages or a plurality of types of message. [0093] The following describes a process that a message generated by a producer program is written into a message file by a message queue .
[0094] FIG. 7 is a flowchart of a method for transmitting messages based on a message queue in conjunction with message tags according to an exemplary embodiment of the present disclosure. This method is applicable to the computer system 100 illustrated in FIG. 1. The method includes the following steps.
[0095] In step 701, a second message generated by a producer program is acquired.
[0096] The message file includes at least two message files arranged in sequence, and each message file has an upper limit of file size. Illustratively, the upper limit of file size of the message file 1 is 100 megabytes (MB).
[0097] Optionally, a second message generated by one producer program is a message belonging to a plurality of types; alternatively, a plurality of messages are generated by a plurality of producer programs, and the messages generated by the each producer program belong to different types.
[0098] Optionally, the message file includes at least two types of message files, and each type of message file corresponds to a respective message tag. When the acquired second messages belong to a plurality of types, this step includes the following sub-steps.
[0099] In SI 1, a second message tag corresponding to the second message is determined.
[00100] The message queue first determines the second message tag, which corresponds to a first message type.
[00101] In S22, a message file corresponding to the second message tag is determined from at least two types of message files.
[00102] Illustratively, when the second message tag is a, a type corresponding to the second message file is a type-A; when the second message tag is b, a type corresponding to the second message file is a type-B; and when the second message tag is c, a type corresponding to the second message file is atype-C. The form of the tag is not limited in the present disclosure. [00103] In step 702, a last writing position of the producer program is acquired. The last writing position includes a second message file identifier and a second message file offset.
[00104] The writing position indicates a corresponding position when a message generated by the producer program is written into a message file last time by the message queue. The second message file identifier is intended to characterize which file the message queue writes the message into, for example, the message queue writes the producer program into the message file A; and the second message file offset is intended to characterize a position into which the message queue writes the message in the second message file, for example, a 52nd byte in the second message file. Optionally, a data volume of a message is expressed in bytes. [00105] The following describes relationships among the second message fde identifier, the second message file offset, and the second message file tag in conjunction with Table 2.
[00106] Table 2
Figure imgf000016_0001
[00107] The second message file identifier 2019122114330001 indicates a second message file numbered 0001 at 14:33 on December 21, 2019; and offset_c indicates that the second message file offset numbered 0001 is P bytes. The forms of the message file identifier and the message file offset are not limited in the present disclosure.
[00108] In step 703a, the second message is written into a kth message file, in the case that a total size of the second message does not reach an upper limit of file size in the kth message file, and the last writing position is updated.
[00109] A kth message file is a message file corresponding to the second message file identifier, and a total size of the second message is a sum of a data volume of the second message and the second message file offset, wherein k>2 and k is an integer.
[00110] When writing a message into a message file, the message queue first judges whether a magnitude of the total size of the second message is greater than a file size of the message file to be written into, wherein the total size of the second message is a sum of the message to be written and a current writing position; and if the sum is not greater than the file size of the message file to be written into, the message queue writes the message to be written directly into the message file. The message queue updates a byte in the kth message file as the last writing position. [00111] Illustratively, when k is 3, and the total size of the second message does not reach an upper limit of file size of a third message file (a second message file identifier as 0003), the message queue writes the message into an 110th byte in the third message file, and updates the last writing position to the 110th byte of a message file numbered 0003.
[00112] In step 703b, a (k+l)th message file is generated in the case that the total size of the second message reaches the upper limit of file size in the kth message file, the second message is written into the (k+l)th message file, and the last writing position is updated, wherein k>2 and k is an integer.
[00113] If the total size of second message reaches the upper limit of file size of the message file to be written into, the message to be written is written into a message fil next to the message file to be written into. Illustratively, when a message intends to be written into a message file numbered 0004 (which is a fourth file in the message queue), and the total size of the message is greater than the size of the message file numbered 0004, the message queue generates a fifth file numbered as 0005.
[00114] Optionally, the message queue generates a (k+l)th file in advance. For example, when the message queue generates the kth file, the (k+l)th file is generated simultaneously; or the message queue generates n files simultaneously, wherein n is a total number of message files in the message queue.
[00115] In step 703c, in the case that the total size of the second message reaches the upper limit of file size in the nth message file, the message in the first message file is deleted, then the second message is written into the first message file and the last writing position is updated, wherein k<n and n is a positive integer greater than 2.
[00116] Optionally, message files further include: an upper limit n of the number of message files.
[00117] Illustratively, n is 50, and there are 50 message files in the message queue which are numbered as 0000-0049. When the message queue writes a message to a message file No. 0048, the total size of second message reaches the upper limit of file size in a 50th file, and the message queue starts writing from a first message file (message file numbered 0000). That is, after a message in the first message file is deleted, the message queue writes the message into the first message file, and updates the last writing position to a bth byte in the message file numbered 0000
[00118] It should be understood that the above steps may be executed cyclically. That is, the message queue may write messages generated by producer programs into message files cyclically. After a message is written into a message file, a process of writing the message and a process of reading the message are executed simultaneously, or in a certain sequence.
[00119] Illustratively, FIG. 8 is reading and writing situations of a message file at a certain time. The reading and writing situations include: a reading position of a consumer program 311 in a message file 03 (with an arrow pointing to the reading position), a reading position of a consumer program 312 in a message file 04, and a reading position of a consumer program 313 in a message file 09, wherein a writing position of the message file 03 is a position 301.
[00120] In an optional embodiment, the message queue may delete messages in message files. [00121] It is assumed that a message storage time in a kth message file is greater than a time threshold, and a message file corresponding to a last writing position is an mth message file, wherein m<n and m is a positive integer.
[00122] In S10, the storage time of the message in the (k-l)th message file is acquired.
[00123] As illustrated in FIG. 6, the message queue 21 is provided with a garbage collecting module 203, which is configured to delete messages of which the retained time is too long. Illustratively, k is 10, the time threshold is 60 seconds, there are 50 message files in the message queue in total, and a message file into which a message is written currently is a 20th message file. If a storage time of messages in a 10th message file, arranged in a cyclic writing sequence, in the message queue is greater than the time threshold, the message queue acquires a storage time of messages in a 9th message file.
[00124] In S20, messages in a second target message file are deleted in the case that the storage time of the messages in the (k-l)th message file is greater than the time threshold. The second target message file is a message file that is in a reverse sequence and is located between a kth message file and an mth message file.
[00125] The reverse sequence is a sequence reverse to the cyclic writing sequence. For example, the cyclic writing sequence refers to writing messages into message files in an increasing sequence of number of the message files. For example, the message queue starts writing from a message file numbered 001, which is a first file, and continues writing till a message file numbered 050 (i.e. a 50th message file), and after the 50 message files are full, writes into the first message file again. The reverse sequence refers to performing checking or deleting operations in a decreasing sequence of number by starting from the sequence of last writing position. For example, a message file corresponding to the last writing position is a message file numbered 020 (i.e. a 20th message file), and when a message with a storage time greater than the time threshold is determined, checking is started from the 20th message file till the first message file. If a storage time of a message in the first message file still does not exceed the time threshold, a 50th message file, a 49th message file... and a 21st message file are checked till determining a message file corresponding to a message with a storage time greater than the time threshold.
[00126] In an example, when a storage time of a message in a 9th message file is also greater than the time threshold, the second target message file is a message file that is in a reverse sequence and is located between a 10th message file and a 20th message file, excluding the 10th message file and the 20th message file. That is, messages in a 9th message file, an 8th message file, a 7th message file...and a first message file are deleted, and meanwhile, messages in a 49th message file, a 48th message file, a 47th message file...and a 21st message file are deleted.
[00127] In summary, according to the method provided by this embodiment, a target message file into which a second message is written is determined by determining that a total size of the second message reaches an upper limit of file size in the file to be written into. If a plurality of messages or a plurality of types of messages exist, the message queue first determines a type of a message file to be written into by determining a message tag, and then writes the message, thereby ensuring that the messages written by the message queue is accurate and ordered.
[00128] When a plurality of consumers actively read messages in the message queue, there may be a situation where consumers read the messages at a low speed (consumption speed). In related arts, the message queue does not cache messages, but only transmits the messages to consumers, regardless of whether consumers with low consumption speeds may read the messages in time. [00129] Based on the situation above, when a plurality of consumers with different consumption speeds read messages transmitted by the message queue, consumers with low consumption speeds may lose a large number of messages.
[00130] To solve the problem above, the present disclosure further provides a method for consuming messages based on a message queue. The method is applicable to all situations where messages are written cyclically, and is not limited to the message writing situations in the embodiments described above. [00131] FIG. 9 is a flowchart of a method for consumption based on a message queue according to an exemplary embodiment of the present disclosure. The method is applicable to the computer system 100 illustrated in FIG. 1, and includes the following steps.
[00132] In step 901, a message is written into a corresponding current writing position in a message file. The message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, wherein n is a positive integer.
[00133] Illustratively, n is 50; 50 message files are stored in the message queue and numbered from 000 to 049, respectively; and the message queue writes received messages generated by producers into the 50 files cyclically. Optionally, a writing sequence of the message files includes an increasing sequence of file numbers or a decreasing sequence of file numbers. Illustratively, when a message file numbered 049 is full, messages are to be written into a message file numbered 000, and messages originally written into the message file numbered 000 are overwritten by new messages; or the original written messages are deleted first, and then new messages are written. Optionally, the message files may further be written in a cyclic writing sequence according to initials of file names. For example, cyclic writing is started from a file which the file name is A.
[00134] Illustratively, the message queue writes a message into a current writing position which is an 100th byte in a message file numbered 030.
[00135] In step 902, a corresponding current reading position of a consumer program in the message file is acquired. The current reading position is a reading position determined in the n message files according to a cyclic reading sequence.
[00136] A cyclic reading sequence is the same as the cyclic writing sequence, and is determined as the cyclic writing sequence of the messages is determined. Illustratively, the cyclic reading sequence refers to reading in an increasing sequence of file numbers. Illustratively, the message queue acquires a current reading position which is an 100th byte in a message file numbered 030. [00137] In step 903, the current reading position is updated to a target reading position in to the case that the current writing position coincides with the current reading position. The target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence. [00138] Optionally, a target reading position is a reading position defined by the message queue by default, or a reading position automatically selected by a server according to a consumption speed of a consumer program. Optionally, a distance between the current reading position and the target reading position is constant; or the distance becomes larger and larger; or the distance is intelligently adjusted according to the consumption speed of the consumer program.
[00139] Illustratively, the current reading position is an 100th byte in a message file numbered 030, and the target reading position is an 100th byte in a message file numbered 048. The message queue updates the current reading position from the 100th byte in the message file numbered 030 to the 100th byte in the message file numbered 048.
[00140] Each time when a reading position of the consumer program coincides with a writing position of the producer program, the message queue updates the corresponding reading position to a target position. Optionally, during the reading of the consumer program and the writing of the producer program, when the reading position coincides with the writing position at least twice, step 903 further includes the following sub-steps.
[00141] In step 9031, a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time is acquired.
[00142] Illustratively, the history reading position of the consumer program coincides with the history writing position of the producer program twice, and a timestamp of a first (i.e., last) coincidence is a time M 1.
[00143] In step 9032, a second timestamp when the current reading position coincides with the current writing position is acquired.
[00144] Illustratively, a timestamp of a second (i.e., current) coincidence is a time M2.
[00145] In step 9033, the current reading position is updated to the target reading position according to a difference between the first timestamp and the second timestamp.
[00146] Optionally, a corresponding relationship exists between the difference between the first timestamp and the second timestamp, and the target reading position. For example, the timestamp difference and the target reading position satisfies y=kx, where y is the target reading position, k is a constant, and x is the timestamp difference. Illustratively, the target reading position is kx(M2-Ml).
[00147] In step 904, a message in the message file read at the target reading position is sent to the consumer program.
[00148] The message queue starts reading from the 100th byte in the message file numbered 048, and sends the read message to the consumer program.
[00149] In summary, according to the method provided by this embodiment, when the current writing position coincides with the current reading position, the current reading position is updated to the target reading position, that is, the current reading position is updated along a writing direction of the cyclic writing sequence, such that the reading position and the writing position of the consumer program maintain a distance again, and for consumer programs with an occasional low consumption speed, only a small part of messages may be lost.
[00150] FIG. 11 illustrates a flowchart of a method for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure. This method may be applied to the computer system 100 illustrated in FIG. 1, and includes the following steps.
[00151] In step 1101, a message is written into a corresponding current writing position in a message fde. The message is generated by a producer program, and the current writing position is a writing position determined in n message fdes according to a cyclic writing sequence, wherein n is a positive integer.
[00152] In step 1102, a corresponding current reading position of a consumer program in the message fde is acquired. The current reading position is a reading position determined in the n message fdes according to a cyclic reading sequence.
[00153] Steps 1101 and 1102 are the same as steps 901 and 902 illustrated in FIG. 9, and are not be repeated herein.
[00154] In step 1103, a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time is acquired.
[00155] In step 1104, a second timestamp when the current reading position coincides with the current writing position is acquired.
[00156] Steps 1103 and 1104 are the same as steps 9031 and 9032, and are not be repeated herein.
[00157] In step 1105a, the current reading position is updated to a first target reading position in to the case that a difference between the first timestamp and the second timestamp is greater than a time threshold. [00158] A length between the current reading position and the first target reading position is a second length, wherein the second length is a predetermined value. Illustratively, the predetermined value is 10 megabytes in length. Optionally, the predetermined value is an initial value or a default value defined by a computer device.
[00159] As illustrated in FIG. 10, the message files include at least two message files arranged in sequence, and a message file 03, a message file 04, and a message file 09 are stored in the message queue. Illustratively, a consumer 1 corresponds to a reading position 411 (as illustrate by the arrow), a consumer 2 corresponds to a reading position 412, a consumer 3 corresponds to a reading position 413, and a current writing position of the message queue is a writing position 401. A reading speed at the reading position 411 is very high, and may "catch up" the writing position 401; a reading speed at the reading position 412 is very low, the writing position 401 is very close to the reading position 412 and may "catch up" the reading position 412; and a reading speed at the reading position 413 is normal, and the writing position 401 and the reading position 413 maintain a certain distance.
[00160] Illustratively, when the writing position 401 "catches up" the reading position 412 for the first time, the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 10 megabytes from the current reading position to a writing direction of the cyclic writing sequence. For example, a reading position after the movement is the reading position 413, and the corresponding timestamp Ml is recorded.
[00161] Illustratively, the time threshold is a maximum slow-start decision time N. When M2-M1>N (N>0, with N indicating the maximum slow-start decision time), the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 10 megabytes from the current reading position to the writing direction of the cyclic writing sequence.
[00162] In step 1105b, the current reading position is updated to a second target reading position in the case that the difference between the first timestamp and the second timestamp is not greater than a time threshold.
[00163] A length between the history reading position and a history target reading position is a first length, and a length between the current reading position and the second target reading position is a second length, wherein the first length is less than the second length. Optionally, the second length and the first length satisfy a corresponding relationship, such as a multiple relationship; or the second length is determined with a predetermined method such as a comparison table, for example, a first length a corresponds to a second length b; or the second length is equal to the first length plus a predetermined step length.
[00164] When M2-M1<N, the message queue updates the reading position 412 of the consumer, and moves the reading position 412 by a length corresponding to 20 megabytes from the current reading position to the writing direction of the cyclic writing sequence. Based on this, when the writing position 401 "catches up" the reading position 412 for the third time, a timestamp M3 is recorded. If M3-M2<N, the reading position 412 is moved by a length corresponding to 40 megabytes from the current reading position to the writing direction of the cyclic writing sequence.
[00165] Optionally, when the length during updating of the current reading position of the consumer program satisfies a certain condition, a target reading position after the updating may change.
[00166] The updated target reading position is acquired as follows.
[00167] The current reading position is updated to a third target reading position in the case that the second length reaches a predetermined length, wherein a length between the current reading position and the third target reading position is the predetermined length.
[00168] The total number of times refers to a cumulative number of times when the reading position of the consumer program coincides with the writing position of the producer program. [00169] Based on the above method for updating the reading position to the taiget position, a process proceeds till the length by which the reading position 412 is moved reaches a predetermined maximum value (i.e., the predetermined length) Q. When the message queue moves the reading position to the writing direction of the cyclic writing sequence by a length corresponding to Q (640 megabytes), the writing position 401 may take a long time to "catch up" the updated reading position of the consumer. Before the length of the movement reaches the predetermined maximum value Q, the length by which the reading position is moved is still a length corresponding to 10 megabytes as long as a time interval between any timestamp and a last timestamp is greater than N.
[00170] Alternatively, the process proceeds in the following way. [00171] The current reading position is updated to a third target reading position in the case that the total number of times reaches the predetermined number of times.
[00172] Illustratively, when the reading position of the consumer program coincides with the writing position of the producer program for 10 times, the current reading position is moved to the writing direction of the cyclic writing sequence by a length corresponding to Q bytes.
[00173] In step 1106, a message in the message file read at the target reading position is sent to the consumer program.
[00174] Step 1106 is the same as step 904, and is not repeated herein.
[00175] In summary, for consumer programs always with a low consumption speed, every time they are "caught up", the number of lost messages changes from small to large till the predetermined length is reached, and the current reading position is updated to the target reading position corresponding to the predetermined length, such that the consumer programs always with a low consumption speed may be "caught up" again after a long time, thereby minimizing resource consumption of the message system by the consumer programs always with a low consumption speed and their impacts on the producer programs and other consumer programs. [00176] The following describes a scenario of online flash sale shopping by way of example. In this scenario, producer programs are online shopping programs (a customer side) corresponding to users, and consumer programs include a management program of an online shopping platform, an online shopping program (a merchant side) corresponding to merchants, and an express program corresponding to express companies.
[00177] In the scenario of flash sale shopping, a plurality of producer programs are accessed to the message queue. Illustratively, messages generated by the respective producer programs are purchase orders corresponding to flash sale products. The purchase orders include information such as goods purchased by customers, quantity, price, order number, delivery address, and coupon usage. The message queue generates corresponding message files according to the purchase orders. Illustratively, the message file may be tagged according to types of goods. The consumer programs read messages in the message files according to tags corresponding to the message files, first message files identifiers, and first message files offsets. Three consumers read the messages from the message files independently according to their own reading positions. For example, the management program of the online shopping platform processes the read messages to derive that a turnover of a food category in one flash sale scenario is 50,000 yuan; the online shopping program corresponding to the merchants processes the read messages to derive that a turnover of a product in one flash sale scenario is 10,000 yuan; and the express program processes the read messages to derive that a delivery address of a user A is No. 187, XX Street, MG District, MG City.
[00178] In summary, by applying the method according to the embodiments described above to the flash sale shopping scenario, a plurality of consumers may read messages in a message queue simultaneously, which improves the efficiency of transmission of the message queue and ensures the smoothness in message transmission in high concurrency scenarios for the server.
[00179] The following is an apparatus embodiment of the present disclosure. For details that are not described in detail in the apparatus embodiments, a reference may be made to the corresponding statements in the method embodiments described above, and these details are not repeated herein.
[00180] FIG. 12 is a block diagram of an apparatus for transmitting messages based on a message queue according to an exemplary embodiment of the present disclosure. This apparatus may be implemented as all of or a part of a terminal through software, hardware or a combination of both. The apparatus includes:
[00181] a first acquiring module 1210 configured to acquire a message file, the message file storing a message generated by a producer program in a form of message queue;
[00182] a first processing module 1220 configured to determine a reading position of a consumer program in the message file from consumer status data, the consumer status data is in one-to-one correspondence to the consumer program;
[00183] a first reading module 1230 configured to read a first message in the message file according to the reading position; and
[00184] a sending module 1240 configured to send the first message to the consumer program. [00185] In an optional embodiment, there are at least two consumer programs, and each consumer program corresponds to its respective consumer status file, which stores consumer status data of the consumer program.
[00186] In an optional embodiment, the message file includes at least two message files arranged in sequence, and the reading position includes: a first message file identifier and a first message file offset;
[00187] the first processing module 1220 is configured to determine a first target message file to be read between at least two message files according to a first message file identifier in the reading position; and
[00188] the first reading module 1230 is configured to read the first message from the first target message file according to a first message file offset in the reading position.
[00189] In an optional embodiment, the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag; wherein [00190] the first acquiring module 1210 is configured to determine a first message tag corresponding to the consumer program, and to determine, from at least two types of message files, a message file corresponding to the first message tag.
[00191] In an optional embodiment, the apparatus includes a writing module; and the message files include at least two message files arranged in sequence, with each message file having an upper limit of file size;
[00192] the first acquiring module 1210 is configured to acquire a second message generated by the producer program, and to acquire a last writing position of the producer program, the last writing position includes a second message file identifier and a second message file offset;
[00193] the first writing module 1250 is configured to write the second message into a kth message file and to update the last writing position in the case that a total size of the second message does not reach the upper limit of file size in the kth message file, wherein the kth message file is a message file corresponding to the second message file identifier, and a total size of the second message is a sum of a data volume of second message and the second message file offset, with k>2 and k being a positive integer; and
[00194] the first writing module 1250 is configured to generate a (k+l)th message file, to write the second message into the (k+l)th message file and to update the last writing position in to the case that the total size of the second message reaches the upper limit of file size in the kth message file.
[00195] In an optional embodiment, the message files further include: an upper limit n of the number of message files; and
[00196] The first writing module 1250 is configured to delete the message in the first message file, then to write the second message into the first message file and to update the last writing position in to the case that the total size of the second message reaches the upper limit of file size in the nth message file, with k<n and n being a positive integer greater than 2.
[00197] In an optional embodiment, the message file includes at least two types of message files, with each type of message file corresponding to a respective message tag; wherein [00198] the first processing module 1220 is configured to determine a second message tag corresponding to the second message, and to determine, from at least two types of message files, a message file corresponding to the second message tag.
[00199] In an optional embodiment, the apparatus includes a deleting module 1260; and it is assumed that a storage time of a message in a kth message file is greater than a time threshold, and a message file corresponding to a last writing position is an mth message file, with m< n and m being a positive integer; wherein
[00200] the first acquiring module 1210 is configured to acquire a storage time of a message in a (k-l)th message file; and
[00201] the deleting module 1260 is configured to delete messages in a second target message file in to the case that the storage time of the message in the (k-l)th message file is greater than the time threshold. The second target message file is a message file that is in a reverse sequence and is located between the kth message file and the mth message file.
[00202] FIG. 13 is a block diagram of an apparatus for consuming messages based on a message queue according to an exemplary embodiment of the present disclosure. This apparatus may be implemented as all of or a part of a terminal through software, hardware or a combination of both. The apparatus includes:
[00203] a second writing module 1310 configured to write a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer;
[00204] a second acquiring module 1320 configured to acquire a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence;
[00205] a second processing module 1330 configured to update the current reading position to a target reading position in to the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and [00206] a second reading module 1340 configured to send a message in the message file read at the target reading position to the consumer program.
[00207] In an optional embodiment, the second acquiring module 1320 is configured to acquire a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time;
[00208] the second acquiring module 1320 is configured to acquire a second timestamp when the current reading position coincides with the current writing position; and
[00209] the second processing module 1330 is configured to update the current reading position to the target reading position according to a difference between the first timestamp and the second timestamp.
[00210] In an optional embodiment, the second processing module 1330 is configured to update the current reading position to a second target reading position in to the case that a difference between the first timestamp and the second timestamp is not greater than a time threshold; a length between the history reading position and the history target reading position is a first length, a length between the current reading position and the second target reading position is a second length, and the first length is less than the second length.
[00211] In an optional embodiment, the second processing module 1330 is configured to update the current reading position to a first target reading position in the case that the difference between the first timestamp and the second timestamp is greater than the time threshold; a length between the current reading position and the first target reading position is a second length, and the second length is a predetermined value.
[00212] In an optional embodiment, the second acquiring module 1320 is configured to acquire a total length when the history reading position of the consumer program is updated in a history update process; and the second processing module 1330 is configured to update the current reading position to a third target reading position in the case that the total length reaches a predetermined length, and a length between the current reading position and the third target reading position is the predetermined length. Alternatively, the second acquiring module 1320 is configured to acquire a total number of times of when the history reading position of the consumer program is updated in the history update process; and the second processing module 1330 is configured to update the current reading position to the third target reading position in to the case that the total number of times reaches a predetermined number of times. [00213] The present disclosure further provides a computer device. As illustrated in FIG. 14, the computer device 1400 includes a processor 1401 and a memory 1402. The memory 1402 stores at least one instruction, at least one program, a code set or an instruction set, wherein the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor 1401 to implement a method for transmitting messages based on a message queue and a method for consuming messages based on a message queue, as described in the method embodiments above.
[00214] It should be understood that "a plurality of' mentioned herein refers to two or more than two. The term "and/or" describes an association relationship between associated objects, indicating that there may be three types of relationships. For example, A and/or B may indicate three types of relationships, namely, A existing alone, or both A and B existing, or B existing alone. The character "/" generally indicates an "or" relationship between the contextual associated objects.
[00215] Those of ordinary skills in the art may understand that all or part of the steps in the above embodiments may be implemented by hardware, or by a program instructing relevant hardware. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
[00216] Described above are merely optional embodiments of the present disclosure, which are not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present disclosure shall fall within the protection scope of the present disclosure.

Claims

CLAIMS What is claimed is:
1. A method for consuming messages based on a message queue, comprising: writing a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer; acquiring a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence; updating the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and sending a message in the message file read at the target reading position to the consumer program.
2. The method according to claim 1, wherein updating the current reading position to the target reading position in the case that the current writing position coincides with the current reading position comprises: acquiring a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time; acquiring a second timestamp when the current reading position coincides with the current writing position; and updating the current reading position to the taiget reading position according to a difference between the first timestamp and the second timestamp.
3. The method according to claim 2, wherein updating the current reading position to the target reading position according to the difference between the first timestamp and the second timestamp comprises: updating the current reading position to a second target reading position in the case that a difference between the first timestamp and the second timestamp is not greater than a time threshold; wherein a length between the history reading position and a history target reading position is a first length, a length between the current reading position and the second target reading position is a second length, and the first length is less than the second length.
4. The method according to claim 2, wherein updating the current reading position to the target reading position according to the difference between the first timestamp and the second timestamp comprises: updating the current reading position to a first target reading position in the case that the difference between the first timestamp and the second timestamp is greater than a time threshold; wherein a length between the current reading position and the first taiget reading position is a second length, and the second length is a predetermined value.
5. The method according to claim 4, further comprising: updating the current reading position to a third target reading position in the case that the second length reaches a predetermined length, wherein a length between the current reading position and the third target reading position is the predetermined length.
6. An apparatus for consuming messages based on a message queue, comprising: a writing module configured to write a message into a corresponding current writing position in a message file, wherein the message is generated by a producer program, and the current writing position is a writing position determined in n message files according to a cyclic writing sequence, where n is a positive integer; an acquiring module configured to acquire a corresponding current reading position of a consumer program in the message file, wherein the current reading position is a reading position determined in the n message files according to a cyclic reading sequence; a processing module configured to update the current reading position to a target reading position in the case that the current writing position coincides with the current reading position, wherein the target reading position is a reading position located behind the current reading position along a writing direction of the cyclic writing sequence; and a reading module configured to send a message in the message file read at the taiget reading position to the consumer program.
7. The apparatus according to claim 6, wherein the acquiring module is configured to acquire a first timestamp when a history reading position of the consumer program coincides with a history writing position of the producer program last time; the acquiring module is configured to acquire a second timestamp when the current reading position coincides with the current writing position; and the processing module is configured to update the current reading position to the target reading position according to a difference between the first timestamp and the second timestamp.
8. The apparatus according to claim 7, wherein the processing module is configured to update the current reading position to a second target reading position in the case that a difference between the first timestamp and the second timestamp is not greater than a time threshold; wherein a length between the history reading position and a history target reading position is a first length, a length between the current reading position and the second target reading position is a second length, and the first length is less than the second length.
9. The apparatus according to claim 6, wherein the processing module is configured to update the current reading position to a first target reading position in the case that the difference between the first timestamp and the second timestamp is greater than a time threshold; and wherein a length between the current reading position and the first target reading position is a second length, and the second length is a predetermined value.
10. The apparatus according to any one of claims 7 to 9, wherein the acquiring module is configured to acquire a total length when the history reading position of the consumer program is updated in a history update process; and the processing module is configured to update the current reading position to a third target reading position in the case that the total length reaches a predetermined length, wherein a length between the current reading position and the third trget reading position is the predetermined length; or, the acquiring module is configured to acquire a total number of times when the history reading position of the consumer program is updated in the history update process; and the processing module is configured to update the current reading position to the third target reading position in the case that the total number of times reaches a predetermined number of times.
PCT/SG2020/050799 2019-12-31 2020-12-31 Method, apparatus and device for consuming messages based on message queue WO2021137768A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911417643.5 2019-12-31
CN201911417643.5A CN111552575B (en) 2019-12-31 2019-12-31 Message consumption method, device and equipment based on message queue

Publications (1)

Publication Number Publication Date
WO2021137768A1 true WO2021137768A1 (en) 2021-07-08

Family

ID=72003749

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/SG2020/050799 WO2021137768A1 (en) 2019-12-31 2020-12-31 Method, apparatus and device for consuming messages based on message queue

Country Status (2)

Country Link
CN (1) CN111552575B (en)
WO (1) WO2021137768A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113961379A (en) * 2021-12-22 2022-01-21 零犀(北京)科技有限公司 Message processing method and device based on man-machine conversation

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113505037A (en) * 2021-06-24 2021-10-15 北京天九云电子商务有限公司 Message management monitoring system, method, readable medium and electronic device

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103209214A (en) * 2013-04-03 2013-07-17 蓝盾信息安全技术股份有限公司 Not only structured query language (NoSQL)-based method for realizing message-oriented middleware
CN103761141A (en) * 2013-12-13 2014-04-30 北京奇虎科技有限公司 Method and device for realizing message queue
CN103942259B (en) * 2014-03-21 2017-10-13 浙江大学 A kind of method that data buffer storage is realized in database synchronization
CN105138410A (en) * 2015-08-31 2015-12-09 北京锐安科技有限公司 Message queue achievement method and device based on disk buffer
CN105808363A (en) * 2016-03-11 2016-07-27 浪潮通用软件有限公司 Method for implementing asynchronous execution based on Active MQ message queue
US11005933B2 (en) * 2016-03-17 2021-05-11 International Business Machines Corporation Providing queueing in a log streaming messaging system
US10212120B2 (en) * 2016-04-21 2019-02-19 Confluent, Inc. Distributed message queue stream verification
CN107918621A (en) * 2016-10-10 2018-04-17 阿里巴巴集团控股有限公司 Daily record data processing method, device and operation system
CN106648461A (en) * 2016-11-15 2017-05-10 努比亚技术有限公司 Memory management device and method
CN106789741B (en) * 2016-12-26 2020-02-18 北京奇虎科技有限公司 Consumption method and device of message queue
CN106658050B (en) * 2016-12-30 2020-02-21 北京奇虎科技有限公司 Concurrent reading and writing method and device for stream data
CN106960054B (en) * 2017-04-01 2020-10-02 北京奇虎科技有限公司 Data file access method and device
WO2019084465A1 (en) * 2017-10-27 2019-05-02 Streamsimple, Inc. Streaming microservices for stream processing applications
CN108536544B (en) * 2018-03-21 2021-06-25 微梦创科网络科技(中国)有限公司 Consumption method, device, server and medium based on database message queue
CN108874560B (en) * 2018-06-05 2022-09-09 腾讯音乐娱乐科技(深圳)有限公司 Method and communication device for communication
CN109815028B (en) * 2018-12-27 2022-02-08 汉海信息技术(上海)有限公司 System, method, apparatus and computer storage medium for data synchronization
CN110134439B (en) * 2019-03-30 2021-09-28 北京百卓网络技术有限公司 Lock-free data structure construction method and data writing and reading methods
CN110187980B (en) * 2019-04-19 2021-11-19 北京三快在线科技有限公司 Message queue monitoring method and device, electronic equipment and readable storage medium
CN110262905A (en) * 2019-05-31 2019-09-20 四川长虹电器股份有限公司 The method for pushing of the message-oriented middleware of priority query based on building high performance and scalability

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Class KafkaConsumer<K,V>", KAFKA.APACHE.ORG, 21 December 2019 (2019-12-21), XP055839094, Retrieved from the Internet <URL:https://web.archive.org/web/20191221123200/https://kafka.apache.org/10/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html> [retrieved on 20210325] *
"Fast Message Queue (FMQ)", ANDROID OPEN SOURCE PROJECT, 1 October 2019 (2019-10-01), XP055839091, Retrieved from the Internet <URL:https://web.archive.org/web/20191001183417if_/https://source.android.com/devices/architecture/hidl/fmq> [retrieved on 20210325] *
"Kafka Consumers: Reading Data from Kafka", OREILLY.COM, 10 October 2019 (2019-10-10), XP055839095, Retrieved from the Internet <URL:https://web.archive.org/web/20191010045428/https://www.oreilly.com/library/view/kafka-the-definitive/9781491936153/ch04.html> [retrieved on 20210325] *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113961379A (en) * 2021-12-22 2022-01-21 零犀(北京)科技有限公司 Message processing method and device based on man-machine conversation

Also Published As

Publication number Publication date
CN111552575A (en) 2020-08-18
CN111552575B (en) 2023-09-12

Similar Documents

Publication Publication Date Title
CN104126192B (en) Time management formula email message
US9501512B2 (en) Optimizing storage in a publish / subscribe environment
CN105915634A (en) Data processing method, server and user terminal
CN103365882A (en) Method and system for cleaning junk files on mobile terminal
CN102413156B (en) Distributed data storage system and method
CN106462631A (en) Consistent views of partitioned data in eventually consistent systems
WO2012045154A1 (en) System and method of capturing point-of-sale data and providing real-time advertising content
CN108073429B (en) Payment mode configuration method, device, equipment and storage medium
US10310748B2 (en) Determining data locality in a distributed system using aggregation of locality summaries
CN103064637A (en) Network disk cache synchronizing method and system
WO2021137768A1 (en) Method, apparatus and device for consuming messages based on message queue
CN105556502B (en) Electronic mail network client notification is lined up
CN105530272A (en) Method and device for application data synchronization
CN110266505A (en) A kind of method and apparatus managing session group
US10031948B1 (en) Idempotence service
CN109561117A (en) Collecting method and device
CN104796322A (en) Message processing method and equipment
US20150088702A1 (en) Dynamic determination of inventory protocol
CN111400056B (en) Message transmission method, device and equipment based on message queue
CN111192070B (en) Storage service metering method and system, computer system and readable storage medium
CN109462777B (en) Video heat updating method, device, terminal and storage medium
US11650922B2 (en) Cache coherency engine
CN111782587A (en) Snapshot information recording method, device, equipment and storage medium
WO2016077225A1 (en) Managing warehouse information
US8645377B2 (en) Aggregating data from a work queue

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20909097

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: 20909097

Country of ref document: EP

Kind code of ref document: A1