CN115051963B - Message processing method and device, message queue system and electronic equipment - Google Patents

Message processing method and device, message queue system and electronic equipment Download PDF

Info

Publication number
CN115051963B
CN115051963B CN202210630929.7A CN202210630929A CN115051963B CN 115051963 B CN115051963 B CN 115051963B CN 202210630929 A CN202210630929 A CN 202210630929A CN 115051963 B CN115051963 B CN 115051963B
Authority
CN
China
Prior art keywords
consumption
consumed
messages
client
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210630929.7A
Other languages
Chinese (zh)
Other versions
CN115051963A (en
Inventor
李凯
周新宇
林清山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China 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 Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210630929.7A priority Critical patent/CN115051963B/en
Publication of CN115051963A publication Critical patent/CN115051963A/en
Application granted granted Critical
Publication of CN115051963B publication Critical patent/CN115051963B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • H04L51/046Interoperability with other network applications or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Databases & Information Systems (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the specification provides a message processing method and device, a message queue system and electronic equipment, and relates to the field of data communication. The message processing method comprises the following steps: responding to the pulling operation of the consumption client, and setting M messages to be consumed corresponding to the pulling operation into an invisible state; and within the maximum consumption time of the consumption client, continuing to wait for consumption success information corresponding to the M messages to be consumed according to the invisible state of the M messages to be consumed of the preset time delay time, wherein the preset time delay time is smaller than the maximum consumption time. By setting the preset delay time length, the automatic renewal is carried out on the M messages to be consumed, and the invisible state of the M messages to be consumed can be adaptively controlled. Compared with the scheme that the maximum consumption time length configured by the consumption client is directly used as the delay time length of the invisible state in the traditional technology, the consumption delay condition can be effectively prevented by the embodiment of the specification, and therefore the consumption progress of the message is guaranteed.

Description

Message processing method and device, message queue system and electronic equipment
Technical Field
The embodiment of the specification relates to the field of data communication, in particular to a message processing method and device, a message queue system and electronic equipment.
Background
Because the POP consumption mode has the advantages of light weight, no queue monopolization and the like, the POP consumption mode is very friendly to scenes such as message backlog, streaming media consumption and the like. In the POP consumption mode, the consumption client pulls and caches the message to be consumed in advance, and correspondingly, the server directly sets the message to be consumed pulled by the consumption client into an invisible state within the maximum consumption time (also called maximum consumption time) preconfigured by the consumption client. Therefore, in the traditional technology, the flexibility of the consumption information is poor, the consumption delay is easy to occur, and the consumption progress is affected.
Disclosure of Invention
In view of this, the embodiments of the present disclosure are directed to providing a message processing method and apparatus, a message queuing system, and an electronic device, so as to solve the technical problem that in the conventional technology, consumption delay is likely to occur in consuming a message.
In a first aspect, an embodiment of the present disclosure provides a message processing method, which is applied to a server. The message processing method comprises the following steps: responding to a pulling operation of a consumption client, and setting M messages to be consumed corresponding to the pulling operation into an invisible state, wherein M is a positive integer; and within the maximum consumption time of the consumption client, continuing to wait for consumption success information corresponding to the M messages to be consumed according to the invisible state of the M messages to be consumed of the preset time delay time, wherein the preset time delay time is smaller than the maximum consumption time.
In a second aspect, embodiments of the present disclosure provide a message processing method applied to a consuming client. The message processing method comprises the following steps: and pulling the M messages to be consumed based on the server side so that the server side sets the M messages to be consumed in an invisible state, and in the maximum consumption time of the consumption client side, the server side continues the invisible state of the M messages to be consumed according to the preset time delay time to wait for the consumption success information corresponding to the M messages to be consumed, wherein the preset time delay time is smaller than the maximum consumption time, and M is a positive integer.
In a third aspect, an embodiment of the present disclosure provides a message processing apparatus, which is applied to a server. The message processing apparatus includes: the setting module is used for responding to the pulling operation of the consumption client, and setting M messages to be consumed corresponding to the pulling operation into an invisible state, wherein M is a positive integer; and the renewal module is used for renewing the invisible state of the M messages to be consumed according to the preset delay time within the maximum consumption time of the consumption client so as to wait for the consumption success information corresponding to the M messages to be consumed, wherein the preset delay time is smaller than the maximum consumption time.
In a fourth aspect, embodiments of the present disclosure provide a message processing apparatus for use with a consuming client. The message processing apparatus includes: the pulling module is used for pulling the M messages to be consumed based on the server side so that the server side sets the M messages to be consumed in an invisible state, and in the maximum consumption time of the consumption client side, the server side continues the invisible state of the M messages to be consumed according to the preset delay time so as to wait for successful consumption information of the M messages to be consumed, wherein the preset delay time is smaller than the maximum consumption time, and M is a positive integer.
In a fifth aspect, embodiments of the present disclosure provide a message queuing system, including a server and a consuming client, where the server is configured to perform the method steps in the embodiments mentioned in the first aspect, and the client is configured to perform the method steps in the embodiments mentioned in the second aspect.
In a sixth aspect, embodiments of the present disclosure provide an electronic device, including: a processor and a memory for storing processor-executable instructions; the processor is adapted to perform the method steps in the embodiments mentioned in the first and/or second aspect above.
In a seventh aspect, the present description provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method steps of the above embodiments.
In an eighth aspect, the present description provides a computer program product comprising instructions which, when executed by a processor of a computer device, enable the computer device to perform the method steps of the above embodiments.
According to the message processing method provided by the embodiment of the specification, after the consumption client pulls the M messages to be consumed, the server automatically renews the invisible states of the M messages to be consumed based on the preset delay time within the maximum consumption time configured by the consumption client, so that the visible states of the M messages to be consumed can be controlled in a more flexible and self-adaptive mode. Compared with the scheme that the maximum consumption time length configured by the consumption client is directly used as the delay time length of the invisible state in the traditional technology, the consumption delay problem caused by regulation and control according to the maximum consumption time length can be avoided, and the consumption progress of the message is further guaranteed.
Drawings
Fig. 1a is a schematic system architecture diagram of a message processing method in an example scenario provided in an embodiment.
Fig. 1b is a schematic application scenario diagram of a message processing method in a scenario example provided in an embodiment.
Fig. 2 is a flow chart of a message processing method according to an embodiment.
Fig. 3 is a flow chart of a message processing method according to another embodiment.
Fig. 4 is a flow chart of a message processing method according to another embodiment.
Fig. 5 is a flow chart of a message processing method according to still another embodiment.
Fig. 6 is a flow chart of a message processing method according to still another embodiment.
Fig. 7 is a flow chart of a message processing method according to still another embodiment.
Fig. 8 is a flow chart of a message processing method according to still another embodiment.
Fig. 9 is a schematic structural diagram of a message processing apparatus according to an embodiment.
Fig. 10 is a schematic structural diagram of a message processing apparatus according to another embodiment.
Fig. 11 is a schematic diagram of a message queue system according to an embodiment.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments, and it is apparent that the described embodiments are only some of the embodiments of the present disclosure, but not all of the embodiments.
An example of an application scenario is described below in connection with fig. 1a and 1 b.
Fig. 1a is a schematic system architecture diagram of a message processing method in an example scenario provided in an embodiment. As shown in fig. 1a, the application scenario mentioned in this embodiment includes a server 110, and a production client 120 (also referred to as a producer client) and a consumption client 130 (also referred to as a consumer client) respectively connected to the server 110. Wherein the server 110 may act as a container-bearing node for message middleware.
Illustratively, during the actual application process, the production client 120 publishes a message (i.e., an order) to the server 110, and the server 110 pushes the message to the consumption client 130 that subscribes to the message, so that the consumption client 130 consumes the message. Or, the consuming client 130 directly pulls the message from the server 110, and correspondingly, the server 110 responds to the pulling operation of the consuming client 130, and delays and renews the message pulled by the consuming client 130 within the maximum consumption duration configured by the consuming client 130 according to the preset delay duration to wait for the successful consumption information of the consuming client 130 for the message, wherein the preset delay duration is smaller than the maximum consumption duration.
Further refinement, the application scenario shown in fig. 1a may be an application scenario of a shopping transaction platform, or the like.
Fig. 1b is a schematic application scenario diagram of a message processing method in a scenario example provided in an embodiment. As shown in fig. 1b, the application scenario mentioned in this embodiment is a communication scenario, specifically, a communication scenario implemented based on RTC (Real-Time Communication) technology. More specifically, the method can be applied to communication scenes such as live broadcast, video on demand, video conference, online class, online chat room, game interaction and the like realized based on the RTC.
With continued reference to fig. 1b, the application scenario mentioned in this embodiment relates to a server 140, and two production clients 150 and one consumption client 160 respectively connected to the server 140. It will be appreciated that the number of production clients 150 and consumption clients 160 may be set according to practical situations, and this embodiment is not limited in a unified way.
Illustratively, during the actual application process, the production client 150 publishes the data stream to the server 140, and the server 140 pushes the data stream to the consumption client 160 that subscribes to the data stream. The data stream may be, for example, media data such as an audio stream, a video stream, etc. For example, in a live broadcast application scenario, a host acquires media data in real time through the production client 150 and sends the media data to the server 140, different host media data are distinguished through a live broadcast room, and the server 140 can push the host media data to a viewing user entering the live broadcast room corresponding to the host user. In another example, in the conference application scenario, the participant collects media data in real time through the production client 150 and sends the media data to the server 140, and the server 140 can push the media data sent by the production client 150 to clients of other participants, where the clients of the other participants mentioned herein may be production clients or consumption clients, as long as the clients have consumption requirements. It will be appreciated that the production client 150 may also be a consumer client based on the subscription and publication relationships of messages, and correspondingly, the consumer client 160 may also be a production client.
Taking the consumption client 160 shown in fig. 1b as an example, the consumption client 160 may be a browser, APP (Application program) or a web Application such as H5 (HyperText Markup Language, hypertext markup language5 th edition) Application or a light Application (also called applet, a lightweight Application program) or cloud Application, etc., and the consumption client 160 may be based on the SDK (Software Development Kit ) of the corresponding service provided by the server 140, such as being obtained based on RTC SDK development, etc. The consumer client 160 may be deployed in an electronic device, need to run depending on the device or some app in the device, etc. The electronic device may for example have a display screen and support information browsing etc. as may be a personal mobile terminal such as a mobile phone, tablet computer, personal computer etc. Various other types of applications are also commonly deployed in electronic devices, such as human-machine conversation type applications, model training type applications, text processing type applications, web browser applications, shopping type applications, search type applications, instant messaging tools, mailbox clients, social platform software, and the like.
The server 140 may include a server that provides various services, such as a server that provides communication services for multiple clients, a server for background training that provides support for a model used on a client, a server that processes data sent by a client, and so on.
It should be noted that, the server 140 may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. The server may also be a server of a distributed system or a server that incorporates a blockchain. The server may also be a cloud server for cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.
The message processing method of the present specification is described in detail below with reference to fig. 2 to 8.
Fig. 2 is a flow chart of a message processing method according to an embodiment. As shown in fig. 2, the present embodiment relates to a consuming client and a server.
The server is deployed with message middleware. In some embodiments, the service end may be a Web system service end, a cloud service system service end, a cloud storage service end, and the like. In addition, the server may be a single server, a server cluster including a plurality of servers, or other types of processing devices or terminals that are not servers.
Correspondingly, the consumption client can acquire the message from the server and consume the message based on the message middleware deployed by the server. In some embodiments, the consumption client may be various computer terminals connected to the server, or may be an application program loaded in a user device such as a mobile phone, a tablet computer, a notebook computer, or the like. It should be appreciated that the application of the consumer client may be downloaded and installed to the user device from an official website or application center, or may be in the form of a web page. The present embodiment does not specifically limit the existence form of the consumer client, as long as the consumer client can establish communication connection with the server and realize information interaction.
The message processing method provided by the embodiment comprises the following steps aiming at the consumption client.
In step S210, the server pulls the M messages to be consumed based on the server, so that the server sets the M messages to be consumed in an invisible state. Wherein M is a positive integer.
By way of example, the M messages to be consumed may be order messages, trade messages, cancel order messages, and so forth.
Setting the M messages to be consumed to an invisible state characterizes a state in which the M messages to be consumed are invisible to the consuming client. When the M messages to be consumed are in an invisible state, the consumption client cannot pull the M messages to be consumed again.
The pull operation of the consuming client may be implemented based on a pull mode in the POP consumption mode, specifically, the consuming client actively pulls and caches M messages to be consumed to the server.
Aiming at the server side, the message processing method provided by the embodiment comprises the following steps.
In step S220, in response to the pull operation of the consuming client, M messages to be consumed corresponding to the pull operation are set to be in an invisible state.
Step S230, in the maximum consumption time configured by the consumption client, the invisible state of the M messages to be consumed is continued according to the preset delay time so as to wait for the consumption success information corresponding to the M messages to be consumed.
In this embodiment, the preset delay time is less than the maximum consumption time. That is, the configuration time length of the preset delay time length and the maximum consumption time length can be determined according to the actual situation, as long as the preset delay time length is smaller than the maximum consumption time length. Specifically, the maximum consumption duration refers to the maximum waiting time of message consumption, and is configured by the consumption client (for example, the consumption client performs configuration for the maximum consumption duration when pulling M messages to be consumed according to actual situations). For example, the consumption client configures the maximum consumption time period to be 15 minutes. The preset delay time length refers to delay time length for carrying out delay time duration aiming at the invisible state of the message to be consumed, and is configured by the server side. For example, the preset time delay period is configured to be 1min.
The consumption success information corresponding to the M messages to be consumed means that the consumption client successfully consumes the M messages to be consumed. Wherein the sign of successful consumption comprises: the consuming client consumes and completes and returns consumption success information (such as Ack information) to the server.
In an actual application process, the consumption client pulls the M messages to be consumed from the server, correspondingly, the server sets the pulled M messages to be consumed in an invisible state, and sequentially continues the invisible state of the M messages to be consumed according to a preset delay time within a maximum consumption time configured by the consumption client until receiving consumption success information fed back by the consumption client, at which time the life cycle of the M messages to be consumed is ended.
The message processing method mentioned in the above embodiment achieves the purpose of adaptively controlling the invisible states of the M messages to be consumed more flexibly by continuing the invisible states of the M messages to be consumed based on the preset delay time. Compared with the scheme that the maximum consumption time length configured by the consumption client is directly used as the delay time length of the invisible state in the traditional technology, the consumption delay problem caused by regulation and control according to the maximum consumption time length can be avoided, and the consumption progress of the message is further guaranteed.
Taking a scenario in which the consuming client is disconnected from the server as an example, a further embodiment is illustrated in connection with fig. 3.
Fig. 3 is a flow chart of a message processing method according to another embodiment. Specifically, the embodiment shown in fig. 3 is extended from the embodiment shown in fig. 2, and differences between the embodiment shown in fig. 3 and the embodiment shown in fig. 2 are mainly described below, and the details of the differences are not repeated.
As shown in fig. 3, for the server, in the message processing method provided in this embodiment, after the duration of maximum consumption of the consuming client continues for the invisible state of M messages to be consumed according to the preset delay duration (step S230), the method further includes the following steps.
Step S310, if it is determined that the consuming client is disconnected from the server, stopping the invisible state of the M messages to be consumed in the duration.
Step S320, after determining that the consuming client is reconnected to the server, sets the M messages to be consumed to a visible state, so that the consuming client can re-pull the M messages to be consumed.
In some embodiments, disconnection of the consuming client from the server refers to disconnection of the consuming client from the server, such as downtime or a very heavy start of the consuming client. Correspondingly, reconnecting the consuming client with the server refers to reestablishing the communication connection between the consuming client and the server.
Setting the M messages to be consumed to the visible state mentioned in step S320 means setting the M messages to be consumed to a state visible to the consuming client so that the consuming client can re-pull the M messages to be consumed.
For the consuming client, the message processing method mentioned in this embodiment further includes the following steps.
Step S330, the M messages to be consumed are pulled again.
In this embodiment, after the consuming client is disconnected from the server, the invisible state of the message to be consumed is stopped, and after the consuming client is reconnected to the server, the M messages to be consumed are set to the visible state, so that the consuming client can timely re-pull the M messages to be consumed, and the consuming client can only review the M messages to be consumed when the consuming client does not need to wait for the starting node of the next maximum consuming duration. Therefore, aiming at the scene that the consumption client is disconnected (such as downtime), the embodiment can convert the longer maximum consumption time length into the relatively shorter preset delay time length for delay and duration, thereby not only meeting the premise that the user needs to complete consumption within the maximum consumption time length, but also effectively preventing the situation that the consumption of the message is delayed after reconnection of the client and ensuring the consumption progress of the message.
The meaning of the invisible state of M messages to be consumed (exemplified by the downtime of the consuming client) is continued based on a preset time delay period is exemplified below in connection with fig. 4.
Fig. 4 is a flow chart of a message processing method according to another embodiment. As shown in fig. 4, the maximum consumption duration configured by the consumption client is 15min, and the preset delay duration set by the server is 1min. And in the maximum consumption time, the consumption client pulls the message Msg1 out, the message Msg1 enters the invisible time of 1min (namely the first time period), in the first time period, the consumption client does not carry out the successful consumption confirmation operation on the message Msg1, the message Msg1 is automatically subjected to the second time period with the time length of 1min, and in the third time period, the time period of the message Msg1 is stopped under the condition that the consumption client is down. When the consuming client is restarted, the message Msg1 is visible again (can be immediately visible again), so that the purpose that the consuming client timely redraws the message Msg1 is achieved.
Therefore, in this embodiment, if the consuming client is down, the invisible state of the M messages to be consumed in the period of time is stopped, and after the reconnection between the consuming client and the server is determined, the M messages to be consumed are switched to the visible state, so that the messages can be effectively and rapidly pulled again by the consuming client to be consumed, and the situation of message consumption delay caused by the down of the consuming client is avoided.
A practical implementation of the message success information is illustrated below in connection with fig. 5.
Fig. 5 is a flow chart of a message processing method according to still another embodiment. Specifically, the embodiment shown in fig. 5 is extended from the embodiment shown in fig. 2, and differences between the embodiment shown in fig. 5 and the embodiment shown in fig. 2 are mainly described below, and the details of the differences are not repeated.
As shown in fig. 5, for the server, in the message processing method provided in this embodiment, in the maximum consumption duration of the consumption client, the invisible state of M messages to be consumed is continued according to the preset delay duration (step S230), including the following steps.
Step S510, in the maximum consumption duration, before receiving the consumption success information, successively renewing the invisible states of the M messages to be consumed according to the preset delay duration, and successively generating renewal message handles corresponding to the M messages to be consumed, so that the consumption client side sends the consumption success information based on the latest renewal message handle.
The message handle is a unique identification of the message. When a consuming client obtains a message, it gets a handle to the message, through which it can also be located. The consumption client can carry out the operation of confirming the consumption information by transmitting the information handle, can also use the information handle to adjust the invisible time, and can also adjust the next visible time of the information into the current time plus the new invisible time through the information handle.
Specifically, if the server side does not receive the consumption success information fed back by the consumption client side all the time within the maximum consumption time of the consumption client side, the invisible state of the M messages to be consumed is renewed once every other preset delay time. At each time of delayed renewal, the old message handle is updated, the new renewal message handle is generated, and the latest renewal message handle is generated until the renewal is stopped, so that the consuming client can perform the consuming message confirmation operation based on the latest renewal message handle.
Correspondingly, for the consumption client, the message processing method provided in the embodiment may further include: and sending the consumption success information based on the latest renewal message handle.
The message processing method mentioned in the above embodiment can utilize the updated message handle to realize adjustment of the invisible states of the M messages to be consumed, so as to ensure the normal consumption progress of the messages. In addition, the latest renewal message handle transmitted by the consumption client can be utilized to confirm successful message consumption, so that the problem of repeated consumption caused by the fact that the server re-delivers the message to the consumption client is avoided.
The following illustrates various modifications of the server to the states of the M messages to be consumed with reference to fig. 6.
Fig. 6 is a flow chart of a message processing method according to still another embodiment. Specifically, the embodiment shown in fig. 6 is extended from the embodiment shown in fig. 2, and differences between the embodiment shown in fig. 6 and the embodiment shown in fig. 2 are mainly described below, and the details of the differences are not repeated.
As shown in fig. 6, for the server, the message processing method provided in this embodiment further includes the following steps after continuing the invisible state of M messages to be consumed according to the preset delay time duration within the maximum consumption time duration of the consuming client (step S230).
Step S610, judging whether the consumption success information is received within the maximum consumption time.
For example, in the actual application process, if the determination result of step S610 is yes (i.e., the consumption success information is received within the maximum consumption period), step S620 is executed, and if the determination result of step S610 is no (i.e., the consumption success information is not received within the maximum consumption period), step S630 is executed.
In step S620, the M messages to be consumed are switched from the invisible state to the deleted state.
In some embodiments, the M messages to be consumed correspond to three states: visible state, invisible state, and deleted state. Wherein the deleted state characterizes that the message has been successfully consumed by the consuming client and, correspondingly, the lifecycle of the message has ended. Specifically, in the maximum consumption duration, the consumption client pulls M messages to be consumed from the server, the server sets the M messages to be consumed in an invisible state, and in the message preset delay duration, the consumption client completes consumption of the M messages to be consumed, then deletes the messages by using handles, updates the consumption progress and marks that the M messages to be consumed are successfully consumed.
In step S630, the M messages to be consumed are set to a visible state.
It will be appreciated that the purpose of setting the M messages to be consumed to a visible state is that the consuming client can re-pull the M messages to be consumed. If the M messages to be consumed are not deleted due to network abnormality, consumption client abnormality and the like, the M messages to be consumed are not consumed, and after the preset delay time is exceeded, the M messages to be consumed are visible again, and the server side delivers the M messages to be consumed to the consumption client side again.
In the practical application process, if the consumption success information is received within the maximum consumption time, the M messages to be consumed are confirmed to be successfully consumed, so that the M messages to be consumed are switched from the invisible state to the deletion state. The server side does not deliver the M messages to be consumed to the consumption client side again, and the M messages to be consumed can be deleted later according to a preset rule, and corresponding disk space is recovered. When the M messages to be consumed are not consumed successfully, the M messages to be consumed are switched from the invisible state to the visible state, and the M messages to be consumed are ensured to be pulled again by the consumption client and consumed again.
According to the message processing method, when the consumption is successful in the maximum consumption time, the M messages to be consumed can be deleted, so that the space occupied by the M messages to be consumed is reduced, the problem of repeated consumption of the messages is avoided, and the accuracy of message consumption is ensured. In addition, when the consumption is unsuccessful within the maximum consumption duration, the M messages to be consumed can be visible again after the invisible time is exceeded, so that the consumption client can quickly consume again.
How the consumption client consumes M messages to be consumed is illustrated below in connection with fig. 7.
Fig. 7 is a flow chart of a message processing method according to still another embodiment. Specifically, the embodiment shown in fig. 7 is extended from the embodiment shown in fig. 2, and differences between the embodiment shown in fig. 7 and the embodiment shown in fig. 2 are mainly described below, and the details of the differences are not repeated.
As shown in fig. 7, for the consuming client, the message processing method provided in this embodiment further includes the following steps after pulling M messages to be consumed based on the server (step S210).
In step S710, M messages to be consumed are consumed.
Step S720, after the M messages to be consumed are successfully consumed, the consumption success information is sent to the server.
In some embodiments, the consumption success information includes a latest renewal message handle of the consuming client when consuming the M messages to be consumed.
The consumption success information is equivalent to a consumption confirmation signal fed back by the consumption client to the server, so that the server deletes the message from the memory or the disk after receiving the consumption success information. That is, to ensure that messages reliably arrive at the consuming client from the server, the present embodiment provides a message confirmation mechanism. When the consumption client pulls M messages to be consumed from the server and completes consumption, the consumption client sends consumption success information to the server, and after the server receives the consumption success information, the server switches the M messages to be consumed from an invisible state to a deletion state, so that the server can not deliver the M messages to be consumed to the consumption client again. Therefore, the embodiment ensures the reliability delivery of the message by utilizing the message confirmation mechanism, and can also solve the problem that the message is lost after the consumption client is disconnected in the process of processing the message.
A specific implementation of the consumer client to confirm the success of the consumption (also known as the consumption success feedback) is illustrated below in connection with fig. 8.
Fig. 8 is a flow chart of a message processing method according to still another embodiment. As shown in fig. 8, the message processing method provided in this embodiment includes the following steps for a consuming client.
Step S810, submit a message handle.
Step S820, determining whether there is a latest renewal message handle.
Illustratively, in the actual application process, if the determination result of step S820 is yes (i.e., there is a latest renewal message handle), step S840 is performed, and if the determination result of step S820 is no (i.e., there is no latest renewal message handle), step S830 is performed.
In step S830, the consumption confirmation handle is set as the message handle.
In step S840, the consumption confirmation handle is set as the latest renewal message handle.
Step S850, using the consumption confirmation handle, the consumption success confirmation is performed.
The above-mentioned consumption confirmation handle refers to a message handle used for confirmation of successful consumption.
Therefore, after the consumption of the consumption client is completed, the consumption client submits the consumption client to the server message handle, and the consumption success is confirmed. Because the server side can carry out timed renewal on the message handle, when the consumption client side carries out successful consumption confirmation, whether the latest renewal message handle exists or not needs to be judged, and if so, the latest renewal message handle is used for carrying out successful consumption confirmation. If the message handle does not exist, the server side is not subjected to continuous delay period on the message, and the message handle is directly used for successful confirmation of consumption.
The method embodiments of the present specification are described in detail above with reference to fig. 1 to 8, and the apparatus embodiments of the present specification are described in detail below with reference to fig. 9 to 12. It is to be understood that the description of the method embodiments corresponds to the description of the device embodiments, and that parts not described in detail can therefore be seen in the preceding method embodiments.
Fig. 9 is a schematic structural diagram of a message processing apparatus according to an embodiment. As shown in fig. 9, the message processing apparatus 900 provided in this embodiment includes a setting module 910 and a renewal module 920. Specifically, the setting module 910 is configured to respond to a pull operation of the consuming client, and set M messages to be consumed corresponding to the pull operation to an invisible state, where M is a positive integer. The renewal module 920 is configured to renew, within a maximum consumption duration of the consumption client, the invisible state of the M messages to be consumed according to a preset delay duration, so as to wait for consumption success information corresponding to the M messages to be consumed, where the preset delay duration is less than the maximum consumption duration.
In some embodiments, the renewal module 920 is further configured to, if it is determined that the consuming client is disconnected from the server, stop renewing the invisible state of the M messages to be consumed, and after it is determined that the consuming client is reconnected to the server, set the M messages to be consumed to the visible state, so that the consuming client can re-pull the M messages to be consumed.
In some embodiments, the renewal module 920 is further configured to, before receiving the consumption success information, successively renew the invisible states of the M messages to be consumed according to the preset delay time duration within the maximum consumption time duration, and successively generate renewal message handles corresponding to the M messages to be consumed, so that the consumption client sends the consumption success information based on the latest renewal message handle.
In some embodiments, the renewal module 920 is further configured to switch the M messages to be consumed from the invisible state to the deleted state if the consumption success information is received within the maximum consumption period; if the consumption success information is not received within the maximum consumption time, the M messages to be consumed are set to be in a visible state, so that the consumption client can re-pull the M messages to be consumed.
Fig. 10 is a schematic structural diagram of a message processing apparatus according to another embodiment. As shown in fig. 10, the message processing apparatus 1000 provided in this embodiment includes a pull module 1010. Specifically, the pulling module 1010 is configured to pull M messages to be consumed based on the server, so that the server sets the M messages to be consumed in an invisible state, and in a maximum consumption duration of the consumption client, the server continues the invisible state of the M messages to be consumed according to a preset delay duration to wait for consumption success information corresponding to the M messages to be consumed, where the preset delay duration is less than the maximum consumption duration, and M is a positive integer.
In some embodiments, the pulling module 1010 is further configured to, in a case where the consumption client is reconnected to the server, re-pull the M messages to be consumed. Under the condition that the consumption client and the server are disconnected, the server stops renewing the invisible states of the M messages to be consumed, and after the consumption client and the server are reconnected, the server sets the M messages to be consumed to the visible states.
In some embodiments, the pulling module 1010 is further configured to, before receiving the consumption success information, successively renew the invisible states of the M messages to be consumed according to the preset delay time duration within the maximum consumption time duration, and successively generate renewal message handles corresponding to the M messages to be consumed, so that the consumption client sends the consumption success information based on the latest renewal message handle.
In some embodiments, the pulling module 1010 is further configured to consume M messages to be consumed, and send consumption success information to the server after the M messages to be consumed are successfully consumed, where the consumption success information includes a latest renewal message handle of the consumption client when the M messages to be consumed are consumed.
Fig. 11 is a schematic diagram of a message queue system according to an embodiment. As shown in fig. 11, the message queue system 1100 provided in this embodiment includes a server 1110 and a consuming client 1120. The server 1301 is configured to perform the steps of the message processing method to be performed at the server mentioned in any of the above embodiments, and the consuming client 1302 is configured to perform the steps of the message processing method to be performed at the consuming client mentioned in any of the above embodiments.
Next, an electronic device provided by an embodiment will be described with reference to fig. 12.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment. As shown in fig. 12, the electronic device 1200 includes one or more processors 1210 and memory 1220.
Processor 1210 may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities and may control other components in electronic device 1200 to perform desired functions.
Memory 1220 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory can include, for example, random Access Memory (RAM) and/or cache memory (cache) and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on a computer readable storage medium and the processor 1210 may execute the program instructions to implement the message processing methods and/or other desired functions of the various embodiments of the present description as mentioned above. Various contents such as M messages to be consumed may also be stored in the computer-readable storage medium.
In one implementation, the electronic device 1200 may further include: an input device 1230 and an output device 1240, which are interconnected by a bus system and/or other forms of connection mechanisms (not shown).
The input device 1230 may include, for example, a keyboard, a mouse, and the like.
The output device 1240 may output various information to the outside, including M messages to be consumed, etc. The output device 1240 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, etc.
Of course, only some of the components of the electronic device 1200 relevant to the present specification are shown in fig. 12 for simplicity, components such as buses, input/output interfaces, and the like are omitted. In addition, the electronic device 1200 may include any other suitable components, depending on the particular application.
In addition to the above-described methods and apparatus, embodiments of the present description may also be a computer program product comprising computer program instructions comprising instructions that, when executed by a processor of a computer apparatus, enable the computer apparatus to perform the method steps of the above-described embodiments.
The computer program product may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present description may also be a computer-readable storage medium, on which computer program instructions are stored, which, when being executed by a processor, cause the processor to perform the steps in the message processing method according to the various embodiments of the present description described above.
A computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
An embodiment of the present disclosure also provides a computer program product, which includes instructions that, when executed by a processor of a computer device, enable the computer device to perform the method steps of the message processing method mentioned in the above embodiment.
The basic principles of the present specification have been described above in connection with specific embodiments, however, it should be noted that the advantages, benefits, effects, etc. mentioned in the present specification are merely examples and not limiting, and these advantages, benefits, effects, etc. are not to be considered as necessarily possessed by the various embodiments of the present specification. Furthermore, the specific details disclosed herein are for purposes of illustration and understanding only, and are not intended to be limiting, since the description is not intended to be limited to the specific details set forth.
The block diagrams of the devices, apparatuses, devices, systems referred to in this specification are provided merely as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be made in the manner shown in the block diagrams. As will be appreciated by one of skill in the art, the devices, apparatuses, devices, systems may be connected, arranged, configured in any manner. Words such as "including," "comprising," "having," and the like are words of openness and mean "including but not limited to," and are used interchangeably therewith. The terms "or" and "as used herein refer to and are used interchangeably with the term" and/or "unless the context clearly indicates otherwise. The term "such as" as used herein refers to, and is used interchangeably with, the phrase "such as, but not limited to.
It should also be noted that in the apparatus, devices and methods of the present description, the components or steps may be separated and/or recombined. Such decomposition and/or recombination should be considered as equivalents of the present description.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present description. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the description is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the specification to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.

Claims (10)

1. A message processing method, applied to a server, the method comprising:
Responding to a pulling operation of a consumption client, and setting M messages to be consumed corresponding to the pulling operation into an invisible state, wherein M is a positive integer;
in the maximum consumption time of the consumption client, continuing to wait for consumption success information corresponding to the M messages to be consumed according to the invisible state of the M messages to be consumed in a preset time delay time, wherein the preset time delay time is smaller than the maximum consumption time;
if the consumption client is determined to be disconnected with the server, stopping renewing the invisible state of the M messages to be consumed, and setting the M messages to be consumed to be visible after the consumption client is determined to be reconnected with the server, so that the consumption client can pull the M messages to be consumed again.
2. The message processing method according to claim 1, wherein the duration of the invisible state of the M messages to be consumed within the maximum consumption duration of the consumption client according to a preset delay duration includes:
and in the maximum consumption duration, before receiving the consumption success information, successively renewing the invisible states of the M messages to be consumed according to the preset delay duration, and successively generating renewal message handles corresponding to the M messages to be consumed, so that the consumption client side sends the consumption success information based on the latest renewal message handles.
3. The message processing method according to claim 1, wherein after the duration of the invisible state of the M messages to be consumed is continued according to a preset delay duration within the maximum consumption duration of the consumption client, the method further comprises:
if the consumption success information is received within the maximum consumption time, switching the M messages to be consumed from an invisible state to a deletion state;
if the consumption success information is not received within the maximum consumption duration, the M messages to be consumed are set to be in a visible state, so that the consumption client can re-pull the M messages to be consumed.
4. A message processing method, for application to a consuming client, the method comprising:
pulling M messages to be consumed based on a server side, so that the server side sets the M messages to be consumed in an invisible state, and in the maximum consumption time of the consumption client side, the server side continues to prolong the invisible state of the M messages to be consumed according to a preset delay time so as to wait for consumption success information corresponding to the M messages to be consumed, wherein the preset delay time is smaller than the maximum consumption time, and M is a positive integer;
And re-pulling the M messages to be consumed under the condition that the consumption client is reconnected with the service end, wherein the service end stops renewing the invisible state of the M messages to be consumed under the condition that the consumption client is disconnected with the service end, and the service end sets the M messages to be consumed as the visible state after the consumption client is reconnected with the service end.
5. The method for processing messages according to claim 4, wherein said service end continues to persist the invisible states of the M messages to be consumed according to a preset delay time within a maximum consumption time configured by the consumption client, comprising:
and in the maximum consumption duration, before receiving the consumption success information, the server-side sequentially renews the invisible states of the M messages to be consumed according to the preset delay duration, and sequentially generates renewal message handles corresponding to the M messages to be consumed, so that the consumption client-side can send the consumption success information based on the latest renewal message handles.
6. The message processing method according to claim 4, further comprising, after the server-side-based pulling of M messages to be consumed:
Consuming the M messages to be consumed;
and after the M messages to be consumed are successfully consumed, sending the consumption success information to the server, wherein the consumption success information comprises the latest continuous message handle of the consumption client when the M messages to be consumed are consumed.
7. A message processing apparatus for use with a server, the apparatus comprising:
the system comprises a setting module, a message processing module and a message processing module, wherein the setting module is used for responding to the pulling operation of a consumption client and setting M messages to be consumed corresponding to the pulling operation into an invisible state, wherein M is a positive integer;
the renewal module is used for renewing the invisible states of the M messages to be consumed according to a preset delay time in the maximum consumption time of the consumption client so as to wait for the consumption success information corresponding to the M messages to be consumed, wherein the preset delay time is smaller than the maximum consumption time; if the consumption client is determined to be disconnected with the server, stopping renewing the invisible state of the M messages to be consumed, and setting the M messages to be consumed to be visible after the consumption client is determined to be reconnected with the server, so that the consumption client can pull the M messages to be consumed again.
8. A message processing apparatus for use with a consuming client, the apparatus comprising:
the pulling module is used for pulling M messages to be consumed based on a server side, so that the server side sets the M messages to be consumed in an invisible state, and in the maximum consumption time length of the consumption client side, the server side continues the invisible state of the M messages to be consumed according to a preset delay time length to wait for consumption success information corresponding to the M messages to be consumed, wherein the preset delay time length is smaller than the maximum consumption time length, and M is a positive integer; and re-pulling the M messages to be consumed under the condition that the consumption client is reconnected with the service end, wherein the service end stops renewing the invisible state of the M messages to be consumed under the condition that the consumption client is disconnected with the service end, and the service end sets the M messages to be consumed as the visible state after the consumption client is reconnected with the service end.
9. A message queuing system comprising a server for performing the message processing method of any of claims 1 to 3 and a consumer client for performing the message processing method of any of claims 4 to 6.
10. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor being configured to perform the message processing method of any of the preceding claims 1 to 6.
CN202210630929.7A 2022-06-06 2022-06-06 Message processing method and device, message queue system and electronic equipment Active CN115051963B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210630929.7A CN115051963B (en) 2022-06-06 2022-06-06 Message processing method and device, message queue system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210630929.7A CN115051963B (en) 2022-06-06 2022-06-06 Message processing method and device, message queue system and electronic equipment

Publications (2)

Publication Number Publication Date
CN115051963A CN115051963A (en) 2022-09-13
CN115051963B true CN115051963B (en) 2024-01-26

Family

ID=83160052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210630929.7A Active CN115051963B (en) 2022-06-06 2022-06-06 Message processing method and device, message queue system and electronic equipment

Country Status (1)

Country Link
CN (1) CN115051963B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040047646A (en) * 2002-11-27 2004-06-05 (주)이크레더블 System for Managing Order and Transaction Information Between Companies and Method for Making a Prospective Credit of Sale and Managing Electronic Settlement Thereof
CN106095463A (en) * 2016-06-22 2016-11-09 北京金山安全软件有限公司 Notification bar message processing method and device and terminal equipment
CN109412821A (en) * 2017-08-16 2019-03-01 阿里巴巴集团控股有限公司 Message treatment method and device and electronic equipment
CN109726024A (en) * 2018-12-28 2019-05-07 北京爱奇艺科技有限公司 A kind of message delay delivering method, device and equipment
CN111984429A (en) * 2019-05-21 2020-11-24 阿里巴巴集团控股有限公司 Communication method and device based on message queue
CN113872888A (en) * 2021-09-27 2021-12-31 南威软件股份有限公司 Method, system and medium for Kafka backlog queue pursuit
CN113986962A (en) * 2021-11-19 2022-01-28 百果园技术(新加坡)有限公司 Ranking list generation method, device, equipment and storage medium
CN114443313A (en) * 2022-02-08 2022-05-06 浪潮云信息技术股份公司 Method and system for realizing delay queue by multiple strategies
CN114500416A (en) * 2021-12-14 2022-05-13 阿里巴巴(中国)有限公司 Delivery method and delivery system for at most one message delivery

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10291572B2 (en) * 2014-12-02 2019-05-14 International Business Machines Corporation Selectively delaying social media messages
US11144895B2 (en) * 2015-05-01 2021-10-12 Pay2Day Solutions, Inc. Methods and systems for message-based bill payment
US11005933B2 (en) * 2016-03-17 2021-05-11 International Business Machines Corporation Providing queueing in a log streaming messaging system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040047646A (en) * 2002-11-27 2004-06-05 (주)이크레더블 System for Managing Order and Transaction Information Between Companies and Method for Making a Prospective Credit of Sale and Managing Electronic Settlement Thereof
CN106095463A (en) * 2016-06-22 2016-11-09 北京金山安全软件有限公司 Notification bar message processing method and device and terminal equipment
CN109412821A (en) * 2017-08-16 2019-03-01 阿里巴巴集团控股有限公司 Message treatment method and device and electronic equipment
CN109726024A (en) * 2018-12-28 2019-05-07 北京爱奇艺科技有限公司 A kind of message delay delivering method, device and equipment
CN111984429A (en) * 2019-05-21 2020-11-24 阿里巴巴集团控股有限公司 Communication method and device based on message queue
CN113872888A (en) * 2021-09-27 2021-12-31 南威软件股份有限公司 Method, system and medium for Kafka backlog queue pursuit
CN113986962A (en) * 2021-11-19 2022-01-28 百果园技术(新加坡)有限公司 Ranking list generation method, device, equipment and storage medium
CN114500416A (en) * 2021-12-14 2022-05-13 阿里巴巴(中国)有限公司 Delivery method and delivery system for at most one message delivery
CN114443313A (en) * 2022-02-08 2022-05-06 浪潮云信息技术股份公司 Method and system for realizing delay queue by multiple strategies

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于kafka消息队列的文本处理技术研究;王仲生;;软件导刊(教育技术)(12);全文 *

Also Published As

Publication number Publication date
CN115051963A (en) 2022-09-13

Similar Documents

Publication Publication Date Title
US20200280591A1 (en) System and Method for Efficient Port and Bandwidth Utilization in Setting up Communication Sessions
KR101859235B1 (en) System and method of multi-media conferencing between universal plug and play (upnp) enabled telephony devices and wireless area network (wan) devices
WO2021237433A1 (en) Message pushing method and apparatus, and electronic device and computer-readable medium
CN108540515B (en) Data processing method and server
US10187435B2 (en) Queued sharing of content in online conferencing
CN111935536B (en) Live broadcast room request response method, device, equipment and storage medium
CN112235594B (en) Live broadcast and microphone connecting method and device, computer readable medium and electronic equipment
US10708320B2 (en) Selective internal forwarding in conferences with distributed media servers
EP2533544A1 (en) Method and system for implementing message service in interactive iptv
US20150189008A1 (en) Data communication system and method
CN108683653A (en) A kind of active message push system based on WebSocket
US11323405B2 (en) Host state-sensing for message interruption
CN106411713B (en) State notification method and server
CN115051963B (en) Message processing method and device, message queue system and electronic equipment
CN116308671A (en) Online bidding method based on MQTT protocol, electronic equipment and storage medium
CN112532534B (en) Data transmission method, device and computer readable storage medium
US20190098351A1 (en) Method for managing the access right to an item of digital content
US20210297710A1 (en) Uniform packet streaming
CN111669716B (en) Communication method and communication system of network interphone
CN111479137B (en) Method and device for providing line address, server and storage medium
CN110740337B (en) Live broadcast method and device, electronic equipment and storage medium
CN112511884B (en) Mixed flow control method, system and storage medium for audio and video flow
CN114079828A (en) Method and device for processing streaming media data
JP5975998B2 (en) Conference messaging system and method between universal plug and play telephony device and wide area network (WAN) device
KR100972477B1 (en) Method and Server for Providing Realtime Two-Way Service based HTTP and Maintaining Two-Way Connection

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant