CN111741041B - Message processing method and device, electronic equipment and computer readable medium - Google Patents

Message processing method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN111741041B
CN111741041B CN201910622611.2A CN201910622611A CN111741041B CN 111741041 B CN111741041 B CN 111741041B CN 201910622611 A CN201910622611 A CN 201910622611A CN 111741041 B CN111741041 B CN 111741041B
Authority
CN
China
Prior art keywords
message
sequence number
partition
detection result
partitions
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
CN201910622611.2A
Other languages
Chinese (zh)
Other versions
CN111741041A (en
Inventor
林德强
何小锋
刘海锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910622611.2A priority Critical patent/CN111741041B/en
Publication of CN111741041A publication Critical patent/CN111741041A/en
Application granted granted Critical
Publication of CN111741041B publication Critical patent/CN111741041B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/2871Implementation details of single intermediate entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The disclosure provides a message processing method, which is applied to a message sending end and comprises the following steps: in response to a sending request for sending a message to be sent to a designated middleware, acquiring a plurality of message partitions of the designated middleware, wherein the designated middleware comprises a plurality of message agents, and each message agent comprises at least one message partition; detecting whether a message sequence number interval exists for a plurality of message partitions to obtain a first detection result; and selecting a first target message partition from the plurality of message partitions based on the first detection result to send the message to be sent to the designated middleware. In addition, the disclosure also provides a message processing device, an electronic device and a computer readable medium.

Description

Message processing method and device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of databases, and more particularly, to a message processing method and apparatus, an electronic device, and a computer readable medium thereof.
Background
And the message middleware is introduced, so that the data synchronization of heterogeneous databases among machine rooms can be realized. Specifically, the producer of the message may be deployed in machine room a and the consumer of the message may be deployed in machine room B. The producer stores the message in a message Broker (e.g., broker) or Broker group of message middleware from which the consumer retrieves the message to execute the corresponding business logic. The log messages of the database have a sequence, and the sequence cannot be disordered, namely the log messages are required to be sent and consumed strictly according to the sequence, otherwise, the final results are inconsistent.
The related art provides some message middleware that can implement the function of strictly sequential messages. For example, the open source message middleware Kafka of a message Partition (hereinafter referred to as Partition) of a single message subject is adopted, and the messages in the message Partition are consumed in a first-in first-out manner, so that the execution sequence of the messages is ensured. A message middleware JMQ in a Master-Slave (Master-Slave) structure mode is adopted, more than two groups of broadker groups are distributed in a message queue, each broadker group consists of a Master-Slave, a producer and a consumer of the message respectively have independent linked list data to dynamically record the respective broadker groups, when the broadker groups crash, the broadker groups are removed from a transmission linked list, and if the consumption of the messages of the abnormal broadker groups is completed, the messages are deleted from the head of the consumption linked list.
However, in implementing the concepts of the present disclosure, the inventors found that there are at least the following problems in the related art: the switching of the Broker is only performed when the Broker is in a down state, so that the high availability of the producer of the message is realized, and other conditions affecting the high availability, such as the death of the Broker, the reduced Broker performance and the partitioning of the Broker and the sender network, cannot be realized.
For the above-mentioned problems in the related art, no effective solution has been proposed yet.
Disclosure of Invention
In view of this, the present disclosure provides a message processing method and apparatus, a computer system and a computer readable medium.
One aspect of the present disclosure provides a message processing method, applied to a message sending end, including: in response to a transmission request for transmitting a message to be transmitted to a designated middleware, acquiring a plurality of message partitions of the designated middleware, wherein the designated middleware comprises a plurality of message agents, each message agent comprises at least one message partition, detecting whether a message sequence number interval exists for the plurality of message partitions to obtain a first detection result, and selecting a first target message partition from the plurality of message partitions based on the first detection result to transmit the message to be transmitted to the designated middleware.
According to an embodiment of the present disclosure, the selecting a first target message partition from the plurality of message partitions based on the first detection result includes: selecting a first proposed message partition from the plurality of message partitions based on the first detection result, transmitting the message to be transmitted to the first proposed message partition to obtain a first transmission result, and selecting the first target message partition from the plurality of message partitions based on the first transmission result.
According to an embodiment of the present disclosure, the selecting the first target message partition from the plurality of message partitions based on the first transmission result includes: and determining a first message agent of the first proposed message partition when the first transmission result indicates that the message to be transmitted is not successfully transmitted to the first proposed message partition, selecting a second proposed message partition except the first proposed message partition from the plurality of message partitions until a second transmission result indicates that the message to be transmitted is successfully transmitted to the second proposed message partition, wherein the second proposed message partition corresponds to a second message agent, and the second message agent is different from the first message agent, and using the selected second proposed message partition as the first target message partition.
According to an embodiment of the present disclosure, the selecting a first proposed message partition from the plurality of message partitions based on the first detection result includes: and randomly selecting the first proposed message partition from the plurality of message partitions when the first detection result indicates that the message sequence number interval does not exist.
According to an embodiment of the present disclosure, the selecting a first proposed message partition from the plurality of message partitions based on the first detection result includes: and searching a maximum message sequence number in the message sequence number intervals when the first detection result indicates that the message sequence number intervals exist, and taking a message partition corresponding to the maximum message sequence number as the first proposed message partition.
According to an embodiment of the present disclosure, the above method further includes: and based on the first target message partition, determining a message sequence number corresponding to the message to be sent, and sending the message sequence numbers of the first target message partition and the message to be sent to a registry so that the registry updates a message sequence number interval corresponding to the first target message partition.
Another aspect of the present disclosure provides a message processing method, applied to a message consumer, including: in response to receiving a request to receive a message to be consumed from a designated middleware, obtaining a plurality of message partitions of the designated middleware, wherein the designated middleware comprises a plurality of message proxies, each message proxy comprises at least one message partition, detecting whether a message sequence number interval exists for the plurality of message partitions to obtain a second detection result, and selecting a second target message partition from the plurality of message partitions based on the second detection result to receive the message to be consumed from the designated middleware.
According to an embodiment of the present disclosure, the selecting a second target message partition from the plurality of message partitions based on the second detection result includes: the method comprises the steps of obtaining a first message sequence number corresponding to a message to be consumed in the previous time, selecting a third proposed message partition from the message partitions based on the second detection result to obtain a second message sequence number corresponding to the third proposed message partition, detecting whether the second message sequence number is continuous with the first message sequence number to obtain a third detection result, and selecting the second target message partition from the message partitions based on the third detection result.
According to an embodiment of the present disclosure, the selecting the second target message partition from the plurality of message partitions based on the third detection result includes: and searching a third message sequence number which is continuous with the first message sequence number from the plurality of message partitions and selecting a message partition corresponding to the third message sequence number from the plurality of message partitions as the second target message partition when the third detection result indicates that the second message sequence number is discontinuous with the first message sequence number.
According to an embodiment of the present disclosure, the selecting a third proposed message partition from the plurality of message partitions based on the second detection result includes: and searching a minimum message sequence number in the message sequence number intervals when the second detection result indicates that the message sequence number intervals exist, and selecting a message partition corresponding to the minimum message sequence number from the message partitions as the third proposed message partition.
Another aspect of the present disclosure provides a message processing apparatus, applied to a message transmitting end, including: the information processing device comprises a first acquisition module configured to acquire a plurality of message partitions of a designated middleware in response to a transmission request for transmitting a message to be transmitted to the designated middleware, wherein the designated middleware comprises a plurality of message agents, each message agent comprises at least one message partition, a second acquisition module configured to detect whether a message sequence number interval exists for the plurality of message partitions to acquire a first detection result, and a first selection module configured to select a first target message partition from the plurality of message partitions based on the first detection result so as to transmit the message to be transmitted to the designated middleware.
According to an embodiment of the present disclosure, the first selecting module includes: the first selecting sub-module is configured to select a first proposed message partition from the plurality of message partitions based on the first detection result, the transmitting sub-module is configured to transmit the message to be transmitted to the first proposed message partition to obtain a first transmission result, and the second selecting sub-module is configured to select the first target message partition from the plurality of message partitions based on the first transmission result.
According to an embodiment of the present disclosure, the second selecting submodule includes: a determining unit configured to determine a first message agent of the first proposed message partition in case that the first transmission result indicates that the message to be transmitted is not successfully transmitted to the first proposed message partition, a first selecting unit configured to select a second proposed message partition other than the first proposed message partition from the plurality of message partitions until a second transmission result indicates that the message to be transmitted is successfully transmitted to the second proposed message partition, wherein the second proposed message partition corresponds to a second message agent, and the second message agent is different from the first message agent, and a first processing unit configured to regard the selected second proposed message partition as the first target message partition.
According to an embodiment of the present disclosure, the first selecting submodule includes a second selecting unit configured to randomly select the first proposed message partition from the plurality of message partitions if the first detection result indicates that the message sequence number interval does not exist.
According to an embodiment of the present disclosure, the first selecting submodule includes a first searching unit configured to search, when the first detection result indicates that there are a plurality of the message sequence number intervals, a maximum message sequence number among the plurality of the message sequence number intervals, and a second processing unit configured to use a message partition corresponding to the maximum message sequence number as the first proposed message partition.
According to an embodiment of the disclosure, the apparatus includes, in addition to the first obtaining module, the second obtaining module, and the first selecting module, a determining module configured to determine a message sequence number corresponding to the message to be sent based on the first target message partition, and a sending module configured to send the first target message partition and the message sequence number of the message to be sent to a registry, so that the registry updates a message sequence number interval corresponding to the first target message partition.
Another aspect of the present disclosure provides a message processing apparatus, applied to a message receiving end, including: the system comprises a third acquisition module configured to acquire a plurality of message partitions of a designated middleware in response to a receiving request of a message to be consumed from the designated middleware, wherein the designated middleware comprises a plurality of message agents, each message agent comprises at least one message partition, a fourth acquisition module configured to detect whether a message sequence number interval exists for the plurality of message partitions to acquire a second detection result, and a second selection module configured to select a second target message partition from the plurality of message partitions based on the second detection result so as to receive the message to be consumed from the designated middleware.
According to an embodiment of the present disclosure, the second selecting module includes: the system comprises an acquisition sub-module, a third selection sub-module and a fourth selection sub-module, wherein the acquisition sub-module is configured to acquire a first message sequence number corresponding to a message to be consumed in the last time, the third selection sub-module is configured to select a third proposed message partition from the message partitions based on the second detection result so as to acquire a second message sequence number corresponding to the third proposed message partition, the detection sub-module is configured to detect whether the second message sequence number is continuous with the first message sequence number so as to acquire a third detection result, and the fourth selection sub-module is configured to select the second target message partition from the message partitions based on the third detection result.
According to an embodiment of the present disclosure, the fourth selection submodule includes: a second search unit configured to search for a third message sequence number that is consecutive to the first message sequence number from the plurality of message partitions, and a third selection unit configured to select a message partition corresponding to the third message sequence number from the plurality of message partitions as the second target message partition, when the third detection result indicates that the second message sequence number is not consecutive to the first message sequence number.
According to an embodiment of the present disclosure, the third selecting submodule includes: and a third search unit configured to search a minimum message sequence number among the plurality of message sequence number sections when the second detection result indicates that the plurality of message sequence number sections exist, and a third processing unit configured to select a message partition corresponding to the minimum message sequence number from the plurality of message partitions as the third proposed message partition.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are configured to implement a method as described above.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of the above.
According to the embodiment of the disclosure, at a message sending end, for a plurality of message partitions included in a designated middleware, whether a message sequence number interval exists or not is detected to obtain a first detection result, and a first target message partition is selected from the plurality of message partitions based on the first detection result to send a message to be sent to the designated middleware, which message partition of the designated middleware is sent to can be determined based on the global message sequence layer of the message sequence number interval corresponding to all the message partitions, switching of the message agent is not performed only under the condition that the message agent is in a downtime state, fault tolerance can be achieved when the message agent is downtime, death, performance degradation, network partition and the like, strict order of message sending can be ensured, and high availability of the message sending end is realized. Correspondingly, at the message receiving end, aiming at a plurality of message partitions included in the designated middleware, detecting whether a message sequence number interval exists to obtain a second detection result, and selecting a second target message partition from the plurality of message partitions based on the second detection result to receive the message to be consumed from the designated middleware, so that high availability of the message receiving end is realized.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
fig. 1 schematically illustrates an application scenario of a message processing method according to an embodiment of the present disclosure;
fig. 2 schematically illustrates a flow chart of a message processing method applied to a message sender according to an embodiment of the present disclosure;
FIG. 3A schematically illustrates a flow chart of a message processing method applied to a message sender according to another embodiment of the present disclosure;
FIG. 3B schematically illustrates a flow chart of a message processing method applied to a message sender according to another embodiment of the present disclosure;
FIG. 3C schematically illustrates a flow chart of a message processing method applied to a message sender according to another embodiment of the present disclosure;
fig. 3D schematically illustrates a flow chart of a message processing method applied to a message receiving end according to an embodiment of the present disclosure;
fig. 3E schematically illustrates a flow chart of a message processing method applied to a message receiving end according to another embodiment of the present disclosure;
fig. 3F schematically illustrates a flow chart of a message processing method applied to a message receiving end according to another embodiment of the present disclosure;
FIG. 3G schematically illustrates a general flow chart of a related art message processing method;
FIG. 3H schematically illustrates a general flow diagram of a message processing method of an embodiment of the present disclosure;
fig. 4 schematically illustrates a block diagram of a message processing apparatus applied to a message sender according to an embodiment of the present disclosure;
fig. 5 schematically illustrates a block diagram of a message processing apparatus applied to a message receiving end according to an embodiment of the present disclosure; and
fig. 6 schematically illustrates a block diagram of a computer system suitable for implementing the message processing methods and apparatus according to embodiments of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a formulation similar to at least one of "A, B or C, etc." is used, in general such a formulation should be interpreted in accordance with the ordinary understanding of one skilled in the art (e.g. "a system with at least one of A, B or C" would include but not be limited to systems with a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Terms referred to in the context of the present disclosure are briefly described herein.
Message middleware: and the transfer station is used as a transfer station between the message sending end and the message receiving end and is responsible for storing the message sent by the message sending end and storing the message to wait for the message receiving end to draw out the message from the message receiving end for consumption.
Message broker: the proxy end used for message processing is an application, such as a Broker, for receiving, storing and distributing messages. In this disclosure, each message broker uses a Master-Slave (abbreviated as Master-Slave) mode to write messages synchronously (message allow repetition), and messages in the Master-Slave remain logically consistent. In the Master-Slave mode, after a Master providing service for a receiving end of a message is down, the Master is only backed up, and the Slave in the Master-Slave mode not providing service for the receiving end of the message can change roles to become a new Master and provide service for the receiving end of the message.
Message identification: for identifying the type of message, which may include, but is not limited to, message Topic (Topic), is a core concept in a message middleware system. The message sending end sends the message to the message identifier, and the message receiving end receives the message from the message identifier. The message mark can be created according to the service scene, in order to distinguish different services, the message middleware organizes and manages the message marks corresponding to different services by taking the message mark as a basic unit, so that messages among different message marks are mutually independent, and the message marks can be represented by a string of English characters. For example, in a business scenario, two message topics, "order" for an order message and "logic" for a logistics message are created respectively, and a message sending end sends the order message to "order" and the logistics message to "logic". The message receiving end consumes from the order and/or logic according to the own requirement so as to execute corresponding business logic.
Message Partition (Partition): for implementing distributed management of message identifications, the message identifications may be physically split into one or more portions, each portion physically corresponding to a folder, where an index message and an index file of the portion are stored. Each partition is an ordered, unalterable recording sequence. Parallel between the message partitions identified by each message. The number of parts may be specified when the message identity is created, or the number of parts may be modified after the message identity is created.
The disclosure provides a message processing method, which is applied to a message sending end and comprises the following steps: in response to a transmission request for transmitting a message to be transmitted to a specified middleware, first, a plurality of message partitions of the specified middleware including a plurality of message proxies each including at least one message partition are acquired. Then, for a plurality of message partitions, detecting whether a message sequence number interval exists to obtain a first detection result. Finally, based on the first detection result, a first target message partition is selected from the plurality of message partitions to send the message to be sent to the designated middleware. In the present disclosure, based on the detection result of the message sequence number interval, one target message partition is selected from a plurality of message partitions, so that the service of the message middleware can be always in a high available state.
By applying the message processing method provided by the invention, the synchronization of heterogeneous database data among a plurality of machine rooms can be realized. Fig. 1 schematically illustrates an application scenario 100 of a message processing method according to an embodiment of the present disclosure. It should be noted that fig. 1 illustrates only an example of an application scenario in which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments, or scenarios.
As shown in fig. 1, the application scenario 100 includes a message sender 101, a message middleware 102, a message receiver 103, and a registry 104.
The message middleware 102 includes 2 message brokers, broker 1 and Broker 2, respectively. Wherein, the Broker 1 comprises the Partition 1, and the Broker 2 comprises the Partition 2.
The registry 104 is responsible for maintaining routing information between message topics and broaders, information of message topics and partitions, and information of partitions and message sequence number intervals. The message sending end 101 and the message receiving end 103 are connected to the registry 104, and can obtain the route information between the message theme and the Broker, the information between the message theme and the Partition, and the information between the Partition and the message sequence number.
It should be noted that, in the application scenario shown in fig. 2, the number of message middleware, the number of message agents included in the message middleware, and the number of message partitions included in the message agent are merely exemplary, and are not limitations on the number of message middleware, the number of message agents included in the message middleware, and the number of message partitions included in the message agent. The present disclosure may be applied in a business scenario that includes any number of message middleware, message brokers, and message partitions.
First, from the message sender side, the technology implementation procedure of the present disclosure is explained.
Fig. 2 schematically illustrates a flow chart of a message processing method applied to a message sender according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S210 to S230.
In operation S210, a plurality of message partitions of the designated middleware are acquired in response to a transmission request for transmitting a message to be transmitted to the designated middleware.
In operation S220, for a plurality of message partitions, it is detected whether a message sequence number interval exists to obtain a first detection result.
In operation S230, a first target message partition is selected from a plurality of message partitions based on the first detection result to transmit a message to be transmitted to a designated middleware.
According to an embodiment of the present disclosure, a message middleware maintains a distributed message partition for each topic, including at least a message middleware for a message topic of a message to be sent as a designated message middleware. For example, if the message middleware includes a theme "order" for the order message and a theme "logics" for the logistics message, the message middleware is a designated message middleware, and the message sender may send the order message to be sent to "order" and the logistics message to be sent to "logics".
Therefore, after the message sender starts, before sending the message to be sent to the designated message middleware, it is required to designate, for the message to be sent, which message partition corresponding to which message agent to send the message to be sent, that is, select a target message partition from a plurality of message partitions, and send the message to be sent to the target message partition of the designated middleware.
It will be appreciated that since the designated message middleware includes any number of message partitions, each message partition is an ordered, unchangeable sequence of records. Each message in the message partition can be allocated to a corresponding monotonically increasing sequence number, namely a message sequence number, according to the time sequence, the message sequence number can uniquely locate one message in the message partition, and along with continuous sending of the message, a message sequence number interval of the message partition can be obtained according to the message sequence number. Thus, the message sequence number interval of each message partition is obtained, and the message sending condition corresponding to each message partition, such as the starting sequence number and the current sequence number of the sending sequence number, can be determined. And further, based on the message sequence number interval of each message partition, the distribution condition of the messages in the designated message middleware is mastered on the global level.
The present disclosure determines a target message partition for a message to be sent from the message sequence number level of the message partition for sending to the target message partition. Specifically, the message sending end may be connected to the registry first, and then obtain the route information between the topic of the message to be sent and each message agent, and the information of the topic and the multiple message partitions. Then, whether a message sequence number interval exists or not is detected, and a first target message partition is selected from a plurality of message partitions based on a first detection result.
According to the embodiment of the disclosure, based on the message sequence number intervals corresponding to all message partitions, which message partition of the designated middleware is sent with the message to be sent is determined, so that switching of the message agent is prevented only when the message agent is in a downtime state based on monitoring of the running state of each message agent in the message middleware, fault tolerance can be achieved when the message agent is downtime, death, performance degradation, network partition and the like occur, strict order of message sending can be ensured on the overall sequence of message sending, high availability of a message sending end is realized, and healthy and ordered operation of a message processing flow is maintained. Fig. 3A schematically illustrates a flow chart of a message processing method applied to a message sender according to another embodiment of the present disclosure.
As shown in fig. 3A, the method may include operations S210 to S230 as shown in fig. 2, wherein the aforementioned operation S230 (selecting a first target message partition from a plurality of message partitions based on a first detection result) may include operations S311 to S313.
First, in operation S311, a first proposed message partition is selected from a plurality of message partitions based on a first detection result.
Specifically, for the plurality of message partitions, the following three types of first detection results may be used for the message sequence number interval.
First detection result: the first detection result indicates that there is no message sequence number interval.
Second detection result: the first detection result indicates the presence of a message sequence number interval.
Third detection result: the first detection result indicates that a plurality of message sequence number intervals exist.
As an alternative embodiment, for the first detection result, when the first detection result indicates that the message sequence number interval does not exist, indicating that the current transmission is the first transmission, the foregoing operation S311 (selecting the first proposed message partition from the plurality of message partitions based on the first detection result) may include: a proposed message partition is randomly selected from a plurality of message partitions.
As an alternative embodiment, for the second detection result, when the first detection result indicates that there is a message sequence number interval, indicating that the present transmission is not the first transmission, the foregoing operation S311 (selecting the first proposed message partition from the plurality of message partitions based on the first detection result) may include: and taking the message partition corresponding to the message sequence number interval as a first formulated message partition.
As an alternative embodiment, for the third detection result, when the first detection result indicates that there are a plurality of message sequence number intervals, indicating that the present transmission is not the first transmission, the foregoing operation S311 (selecting the first proposed message partition from the plurality of message partitions based on the first detection result) may include: searching the maximum message sequence number in the multiple message sequence number intervals, and taking the message partition corresponding to the maximum message sequence number as a first formulated message partition.
For example, if it is detected that there are 3 message sequence number intervals, respectively [0,2], [2,4] and [4,6], the maximum message sequence number is 6. If message partition 1 corresponds to message sequence number interval [0,2], message partition 2 corresponds to message sequence number interval [2,4], message partition 3 corresponds to message sequence number interval [4,6], message partition 3 corresponding to maximum message sequence number 6 can be used as the first proposed message partition.
After the first proposed message partition is selected from the plurality of message partitions, it may also be detected whether the message to be sent can be sent to the first proposed message partition.
Next, in operation S312, the message to be transmitted is transmitted to the first proposed message partition to obtain a first transmission result. Finally, in operation S313, a first target message partition is selected from the plurality of message partitions based on the first transmission result.
Specifically, the message to be sent is sent to the first proposed message partition, and the following two first sending results can be obtained.
The first type of transmission results: the message to be sent is not successfully sent to the first proposed message partition.
The second type of transmission results: the message to be sent has been successfully sent to the first proposed message partition.
For the first transmission result, fig. 3B schematically shows a flowchart of a message processing method applied to a message transmitting end according to another embodiment of the present disclosure.
As shown in fig. 3B, in case the first transmission result indicates that the message to be transmitted is not successfully transmitted to the first proposed message partition, the aforementioned operation S313 may include operations S321 to S323.
First, in operation S321, a first message broker for a first proposed message partition is determined.
Next, in operation S322, a second proposed message partition other than the first proposed message partition is selected from the plurality of message partitions until the second transmission result indicates successful transmission of the message to be transmitted to the second proposed message partition. Wherein the second proposed message partition corresponds to a second message broker, and the second message broker is different from the first message broker.
Finally, in operation S323, the selected second proposed message partition is taken as the first target message partition.
It will be appreciated that if the transmission of the message to be transmitted to the first proposed message partition fails, it is not available to indicate that the first message broker in which the first proposed message partition is located is in an abnormal state. To maintain high availability of the message sender, the message partition may be selected from other message agents in a normally available state, the present disclosure provides the following two options.
The first option is: the first proposed message partition and the last message sequence number may be reported directly to the registry upon failure of the transmission. And selecting a second proposed message partition from a second message broker different from the first message broker corresponding to the first proposed message partition based on the information of the message topic and the message partition retrieved from the registry, and attempting to establish a connection with the second message broker in which the reselected second proposed message partition is located. If the connection is unsuccessful, other proposed message partitions may be selected among other message proxies than the first message proxy and the second message proxy. And trying to establish connection with other proposed message partitions again, detecting whether the message to be sent can be successfully sent when the connection establishment is successful, and taking the other proposed message partitions as target message partitions if the message to be sent is successful. If not, continuing to select until a message partition which can successfully send the message to be sent is selected.
The second option is: first, an attempt is made to retransmit a message to be transmitted once or repeatedly transmitted a plurality of times, and if the number of times of repeated transmission exceeds the upper limit of the retry number, or if transmission fails, the first selection method is performed. It should be noted that, in the case that the message to be sent is not sent successfully, a person skilled in the art may select the first selection mode or the second selection mode according to the actual requirement of the service scenario.
It should be noted that, the reasons for the failure in sending the message to be sent may include, but are not limited to, downtime of the message proxy, false death of the message proxy, performance degradation of the message proxy, and sending timeout caused by the situations of network partition between the message proxy and the message sender.
For the second transmission result, if the first transmission result indicates that the message to be transmitted has been successfully transmitted to the first proposed message partition, the first proposed message partition may be used as the target message partition.
By means of the embodiment of the disclosure, in the case that the message to be sent is not successfully sent to the first proposed message partition, two selection modes are provided, a second message partition except the first proposed message partition is selected from the multiple message partitions until the message to be sent is successfully sent to the second proposed message partition, and a second message agent corresponding to the second proposed message partition is used as a target message partition, so that the message service is facilitated to be in a high-availability state.
It should be noted that, after selecting the target message partition to be sent by the message to be sent, in order to maintain the global sequence of sending the message, the message sequence number may also be set for the message sent at this time. Specifically, the value of the message sequence number corresponding to the target message partition can be temporarily stored as the message sequence number of the current message, and the message sequence number of the current message is automatically increased under the condition of having a message sending task, so that the message sequence number corresponding to the current message sending task can be obtained.
According to the embodiment of the disclosure, in the sending stage of the message to be sent, the message sending end establishes connection with the message agent where the target message partition is located, and the message sequence number of the current message is self-increased under the condition that the connection is successful, so that the message sequence number corresponding to the current message sending task can be obtained, and the message to be sent is sent to the message agent where the target message partition is located.
Fig. 3C schematically illustrates a flow chart of a message processing method applied to a message sender according to another embodiment of the present disclosure.
As shown in fig. 3C, the method may include operations S331 and S332 in addition to the aforementioned operations S210 to S230.
In operation S331, a message sequence number corresponding to a message to be transmitted is determined based on the first target message partition.
In operation S332, the first target message partition and the message sequence number of the message to be sent are sent to the registry, so that the registry updates the message sequence number interval corresponding to the first target message partition.
For the first detection result, as an optional embodiment, when the first detection result indicates that the message sequence number interval does not exist, the message is indicated to be sent for the first time, and when a proposed message partition is randomly selected from a plurality of message partitions, the message sequence number of the message to be sent is set to 0, and the message sequence number is immediately reported to the registry.
For the second detection result, as an optional embodiment, when the first detection result indicates that there is a message sequence number section, the message partition with the message sequence number section is used as a first proposed message partition, a maximum message sequence number in the message sequence number section is obtained, the maximum message sequence number is increased, and a corresponding message sequence number is set for the message to be sent.
For example, if 1 message sequence number interval [0,2] is detected, the maximum message sequence number is obtained as 2, the message sequence number corresponding to the message to be sent is obtained as 3 by self-increment, and the message sequence number is immediately reported to the registry.
For the third detection result, as an optional embodiment, if the first detection result indicates that there are multiple message sequence number intervals, it indicates that the message is not sent for the first time, and if the message partition corresponding to the maximum message sequence number is used as the first proposed message partition, the maximum message sequence number is increased automatically, and a corresponding message sequence number is set for the message to be sent.
For example, if 3 message sequence number intervals [0,2], [2,4] and [4,6] are detected, the maximum message sequence number of 6 can be obtained, the message sequence number of 7 corresponding to the message to be sent can be obtained by self-increasing, and the message sequence number can be immediately reported to the registry.
According to the embodiment of the disclosure, when the message sending task exists, the message serial number corresponding to the message sending task is sent to the registration center, the maintenance information of the registration center is updated in real time, accurate data support is provided for the message sending end, the global sequence of the message is maintained, and the global sequence message implementation scheme supporting fault tolerance is facilitated.
Next, from the message receiving side, the technology implementation procedure of the present disclosure is explained.
Fig. 3D schematically illustrates a flow chart of a message processing method applied to a message receiving end according to an embodiment of the present disclosure.
As shown in fig. 3D, the method may include operations S341 to S343.
In operation S341, in response to a reception request for receiving a message to be consumed from a specified middleware, a plurality of message partitions of the specified middleware are acquired.
The message receiving end can be connected to the registry first, and then obtains the route information between the topic of the message and each message agent, the information of the topic and a plurality of message partitions, and the information of each message partition and a message sequence number interval.
In operation S342, for a plurality of message partitions, it is detected whether a message sequence number interval exists to obtain a second detection result.
In operation S343, a second target message partition is selected from the plurality of message partitions based on the second detection result to receive the message to be consumed from the designated middleware.
Specifically, at the message receiving end, for a plurality of message partitions, the following three types of second detection results of the message sequence number interval may be used.
First detection result: the second detection result indicates that there is no message sequence number interval.
Second detection result: the second detection result indicates the presence of a message sequence number interval.
Third detection result: the second detection result indicates that a plurality of message sequence number intervals exist.
For the first detection result, as an optional embodiment, if the second detection result indicates that the message sequence number interval does not exist, it indicates that no consumable message exists in the specified message middleware, and the consumable message cannot be consumed, which results in the failure of this consumption.
For the second detection result, as an optional embodiment, if the second detection result indicates that there is a message sequence number interval, it indicates that the designated message middleware has a message that can be consumed, and the message partition corresponding to the message sequence number interval is selected as the second target message partition, and the message in the second target message partition is pulled to receive the message to be consumed from the designated middleware.
With respect to the third detection result, as an alternative embodiment, in a case where the second detection result indicates that there are a plurality of message sequence number intervals, it is indicated that the specified message middleware has a plurality of consumable messages, and the following manner is provided to select the second target message partition from the plurality of message partitions.
According to the embodiment of the disclosure, at a message receiving end side, aiming at a plurality of message partitions included in the designated middleware, whether a message sequence number interval exists or not is detected to obtain a second detection result, and a second target message partition is selected from the plurality of message partitions based on the second detection result so as to receive the message to be consumed from the designated middleware, so that the order of message consumption can be realized in a global sequence.
Fig. 3E schematically illustrates a flow chart of a message processing method applied to a message receiving end according to another embodiment of the present disclosure.
As shown in fig. 3E, the aforementioned operation S343 (selecting the second target message partition from the plurality of message partitions based on the second detection result) may include operations S351 to S354.
In operation S351, a first message sequence number corresponding to a message to be consumed received last time is acquired.
In operation S352, a third proposed message partition is selected from the plurality of message partitions based on the second detection result to obtain a second message sequence number corresponding to the third proposed message partition.
As an alternative embodiment, the foregoing operation S352 (selecting the third proposed message partition from the plurality of message partitions based on the second detection result) may include: and if the second detection result indicates that a plurality of message sequence number intervals exist, searching the minimum message sequence number in the plurality of message sequence number intervals, and selecting a message partition corresponding to the minimum message sequence number from the plurality of message partitions as a third proposed message partition.
To ensure global sequentiality of message consumption, it may be detected whether the second message sequence number is consecutive to the first message sequence number to obtain a third detection result in operation S353. In operation S354, a second target message partition is selected from the plurality of message partitions based on the third detection result.
Specifically, at the message receiving end, the following two types of third detection results may be used for determining whether the first message sequence number and the second message sequence number are consecutive.
First detection result: both are continuous.
Second detection result: both are discontinuous.
It will be appreciated that the second message sequence number is normally contiguous with the first message sequence number. Therefore, aiming at the first detection result, the message is pulled from the third formulated message partition corresponding to the second message sequence number, the pulled message is distributed to the consumption thread for consumption, if the consumption is successful, the confirmation information is sent to the message middleware, and if the consumption is failed, the message is attempted to be consumed until the consumption is successful.
For the second detection result, fig. 3F schematically shows a flowchart of a message processing method applied to a message receiving end according to another embodiment of the present disclosure.
As shown in fig. 3F, in the case where the third detection result indicates that the second message sequence number is not consecutive to the first message sequence number, the aforementioned operation S354 (selecting the second target message partition from the plurality of message partitions based on the third detection result) may include operation S361 and operation S362.
In operation S361, a third message sequence number consecutive to the first message sequence number is searched for from the plurality of message partitions.
In operation S362, a message partition corresponding to the third message sequence number is selected from the plurality of message partitions as the second target message partition.
It will be appreciated that in an abnormal situation, the second message sequence number is discontinuous from the first message sequence number. Therefore, aiming at the second detection result, the connection between the message agent where the current message partition and the third proposed message partition are located is disconnected, the message agent is connected to a registration center, the information of the message partition and the message sequence number interval is obtained, a third message sequence number which is continuous with the first message sequence number is searched from a plurality of message partitions, the message partition corresponding to the third message sequence number is connected as a second target message partition, the message is pulled from the message agent corresponding to the second target message partition, the pulled message is distributed to a consumption thread for consumption, and if the consumption is successful, confirmation information is sent to the message middleware, and the consumption operation of pulling the message partition from the message agent is continuously executed circularly until the message receiving end stops consumption.
According to the embodiment of the disclosure, on the message receiving end side, under the condition that consumption is abnormal (the obtained minimum message sequence number and the last message sequence number are detected to be discontinuous), a third message sequence number continuous with the first message sequence number is searched from a plurality of message partitions, and a message agent where the message partition corresponding to the third message sequence number is connected to consume the message, so that the order of message consumption can be realized on the global order, and the healthy and ordered operation of the message processing system is maintained.
Fig. 3G schematically shows a general flowchart of a related-art message processing method.
As shown in fig. 3G, the related art message processing method adopts a Master-Slave structure mode, and writes messages synchronously (the messages are allowed to be repeated), so that the messages on the Master-Slave remain logically consistent. The Slave does not accept the sending request after the Master is down, but can consume; more than two groups of broaders (one of the broaders is composed of a Master-Slave) are distributed to a message queue, cluster information of the broaders is stored as a unidirectional linked list on a coordinator, and a consumer and a sender respectively have independent linked list data. Storing the Broker group with the messages on a linked list corresponding to a consumer according to the sequence of accepting the sending request, wherein the consumer can only consume the messages from the Broker group at the head of the linked list, and removing the messages from the message linked list when the messages on the Broker group are completely consumed and are not the Broker group currently accepting the sending request; the Broker group without backlog information can be added to the table tail of the transmission linked list, when the Broker group fails, the removed Broker group is removed from the Broker group, and the removed Broker group can be added back to the linked list after the removal of the Broker group is ensured that no backlog information exists; only the Broker group at the head of the transmit chain table can accept the transmit request, and the Broker group newly switched to accept the transmit request is added to the tail of the consume chain table.
The removal and addition of the various Broker groups in the message chain table follow the following rules: when the broadker group has a machine downtime, the downed broadker group is removed from the transmission linked list. When a new Broker group is selected as the current sender, the group Broker is added to the end of the consumption linked list. When the message consumption of the abnormal Broker group is completed, the abnormal Broker group is removed from the consumption linked list header. When the Broker group machines are all restored to normal, and no message which can be consumed is added to the tail of the transmission linked list.
Fig. 3H schematically illustrates a general flow diagram of a message processing method of an embodiment of the present disclosure.
As shown in fig. 3H, in combination with the corresponding relationship between the message Partition configured by the message theme in fig. 1 and the Broker deployed in the message middleware, it can be known that the Broker 1 is configured with Partition 1, the Broker 2 is configured with Partition2, and the message sending end performs sending of the messages strictly according to the sequence of the first Partition 1 and then Partition2.
At the message sending end, sending the Partition 1 to the Broker 1 fails, which indicates that the Broker 1 is in an abnormal state and is unavailable, the above operation S312 will be executed, and the message sending end will select Partition2 except for the Partition 1 and send the Partition2 to the Broker 2. And simultaneously, informing the registration center to update the sequence number interval of the Partition 1 and newly increasing the sequence number interval of the Partition2. The message sending end continuously sends the Partition 1 to the Broker 1 or to other brokers until all message partitions of the message theme are successfully sent.
At the message receiving end, the consumption of the message is executed strictly according to the sequence of the first Partition 1 and the second Partition 2. After the Partition 1 is consumed, informing the registry of the consumption of the Partition 1 interval and switching to the Partition2 to realize the consumption of the Partition 2.
According to the embodiment of the disclosure, when determining the content of a transmitted message and the message sequence number of a current message at the message transmitting end side, the method is not based on monitoring of the running state of each message agent end in the message middleware, so that when a certain message agent end is down, the method is switched to other message agent ends, but based on each message partition related to a message theme, the current transmitted message content is set from the global message layer of the transmitting state corresponding to all the message partitions, and the message sequence number of the current message is set from the global message sequence layer of the message sequence number interval corresponding to all the message partitions, thereby realizing the order of message transmission in the global sequence, simultaneously realizing high availability of the message transmitting end and maintaining the healthy ordered running of the message processing flow.
And on the side of the message receiving end, under the condition that a plurality of message sequence number intervals exist, acquiring a minimum message sequence number and a third message partition corresponding to the minimum message sequence number, establishing connection with a third message proxy end to which the third message partition belongs, pulling the third message partition from the third message proxy end, and determining the pulled message content from the global message sequence layer which is the sequence number of all the messages, thereby realizing the order of message consumption on the global sequence.
Fig. 4 schematically shows a block diagram of a message processing apparatus applied to a message sender according to an embodiment of the present disclosure.
As shown in fig. 4, the message processing apparatus 400 includes a first acquisition module 410, a second acquisition module 420, and a first selection module 430. Wherein:
the first obtaining module 410 is configured to perform the aforementioned operation S210, and obtain a plurality of message partitions of the designated middleware in response to a transmission request for transmitting a message to be transmitted to the designated middleware.
The second obtaining module 420 is configured to perform the aforementioned operation S220, and detect, for a plurality of message partitions, whether a message sequence number interval exists to obtain a first detection result.
The first selection module 430 is configured to perform, for example, the foregoing operation S230, and select, based on the first detection result, a first target message partition from the plurality of message partitions, so as to send the message to be sent to the designated middleware.
According to an embodiment of the present disclosure, the first selecting module includes: the first selecting sub-module is configured to select a first proposed message partition from the plurality of message partitions based on the first detection result, the transmitting sub-module is configured to transmit the message to be transmitted to the first proposed message partition to obtain a first transmission result, and the second selecting sub-module is configured to select the first target message partition from the plurality of message partitions based on the first transmission result.
According to an embodiment of the present disclosure, the second selecting submodule includes: a determining unit configured to determine a first message agent of the first proposed message partition in case that the first transmission result indicates that the message to be transmitted is not successfully transmitted to the first proposed message partition, a first selecting unit configured to select a second proposed message partition other than the first proposed message partition from the plurality of message partitions until a second transmission result indicates that the message to be transmitted is successfully transmitted to the second proposed message partition, wherein the second proposed message partition corresponds to a second message agent, and the second message agent is different from the first message agent, and a first processing unit configured to regard the selected second proposed message partition as the first target message partition.
According to an embodiment of the present disclosure, the first selecting submodule includes a second selecting unit configured to randomly select the first proposed message partition from the plurality of message partitions if the first detection result indicates that the message sequence number interval does not exist.
According to an embodiment of the present disclosure, the first selecting submodule includes a first searching unit configured to search, when the first detection result indicates that there are a plurality of the message sequence number intervals, a maximum message sequence number among the plurality of the message sequence number intervals, and a second processing unit configured to use a message partition corresponding to the maximum message sequence number as the first proposed message partition.
According to an embodiment of the disclosure, the apparatus includes, in addition to the first obtaining module, the second obtaining module, and the first selecting module, a determining module configured to determine a message sequence number corresponding to the message to be sent based on the first target message partition, and a sending module configured to send the first target message partition and the message sequence number of the message to be sent to a registry, so that the registry updates a message sequence number interval corresponding to the first target message partition.
Fig. 5 schematically illustrates a block diagram of a message processing apparatus applied to a message receiving end according to an embodiment of the present disclosure.
As shown in fig. 5, the message processing apparatus 500 includes a third acquisition module 510, a fourth acquisition module 520, and a second selection module 530. Wherein:
the third obtaining module 510 is configured to perform the aforementioned operation S341, and obtain the plurality of message partitions of the specified middleware in response to the reception request for receiving the message to be consumed from the specified middleware.
The fourth obtaining module 520 is configured to perform the aforementioned operation S342, and detect whether there is a message sequence number interval for a plurality of message partitions to obtain a second detection result.
The second selection module 530 is configured to perform, for example, the aforementioned operation S343, and select, based on the second detection result, a second target message partition from the plurality of message partitions to receive the message to be consumed from the designated middleware.
According to an embodiment of the present disclosure, the second selecting module includes: the system comprises an acquisition sub-module, a third selection sub-module and a fourth selection sub-module, wherein the acquisition sub-module is configured to acquire a first message sequence number corresponding to a message to be consumed in the last time, the third selection sub-module is configured to select a third proposed message partition from the message partitions based on the second detection result so as to acquire a second message sequence number corresponding to the third proposed message partition, the detection sub-module is configured to detect whether the second message sequence number is continuous with the first message sequence number so as to acquire a third detection result, and the fourth selection sub-module is configured to select the second target message partition from the message partitions based on the third detection result.
According to an embodiment of the present disclosure, the fourth selection submodule includes: a second search unit configured to search for a third message sequence number that is consecutive to the first message sequence number from the plurality of message partitions, and a third selection unit configured to select a message partition corresponding to the third message sequence number from the plurality of message partitions as the second target message partition, when the third detection result indicates that the second message sequence number is not consecutive to the first message sequence number.
According to an embodiment of the present disclosure, the third selecting submodule includes: and a third search unit configured to search a minimum message sequence number among the plurality of message sequence number sections when the second detection result indicates that the plurality of message sequence number sections exist, and a third processing unit configured to select a message partition corresponding to the minimum message sequence number from the plurality of message partitions as the third proposed message partition.
Any number of the modules, sub-modules, units, or at least some of the functionality of any number of the modules, sub-modules, units, may be implemented in one module in accordance with embodiments of the present disclosure. Any one or more of the modules, sub-modules, units according to embodiments of the present disclosure may be implemented as a split into multiple modules. Any one or more of the modules, sub-modules, units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or in any suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units according to embodiments of the present disclosure may be at least partially implemented as computer program modules, which when executed, may perform the corresponding functions.
For example, any plurality of the first acquisition module 410, the second acquisition module 420, the first selection module 430, the determination module, the transmission module, the first selection sub-module, the transmission sub-module, the second selection sub-module, the determination unit, the first selection unit, the first processing unit, the second selection unit, the first search unit, and the second processing unit may be combined in one module to be implemented, or any one of the modules may be split into a plurality of modules. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module. According to embodiments of the present disclosure, at least one of the first acquisition module 410, the second acquisition module 420, the first selection module 430, the determination module, the transmission module, the first selection sub-module, the transmission sub-module, the second selection sub-module, the determination unit, the first selection unit, the first processing unit, the second selection unit, the first lookup unit, the second processing unit may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or a suitable combination of three of software, hardware and firmware implementations. Alternatively, at least one of the first acquisition module 410, the second acquisition module 420, the first selection module 430, the determination module, the transmission module, the first selection sub-module, the transmission sub-module, the second selection sub-module, the determination unit, the first selection unit, the first processing unit, the second selection unit, the first search unit, the second processing unit may be at least partially implemented as a computer program module, which may perform the corresponding functions when being executed.
Fig. 6 schematically illustrates a block diagram of a computer system suitable for implementing a path planning method in accordance with an embodiment of the present disclosure. The computer system illustrated in fig. 6 is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 6, a computer system 600 according to an embodiment of the present disclosure includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. The processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 601 may also include on-board memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 603, various programs and data required for the operation of the system 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or the RAM 603. Note that the program may be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the system 600 may further include an input/output (I/O) interface 605, the input/output (I/O) interface 605 also being connected to the bus 604. The system 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 602 and/or RAM 603 and/or one or more memories other than ROM 602 and RAM 603 described above.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (14)

1. A message processing method is applied to a message sending end and comprises the following steps:
acquiring a plurality of message partitions of a designated middleware in response to a transmission request for transmitting a message to be transmitted to the designated middleware, wherein the designated middleware comprises a plurality of message agents, and each message agent comprises at least one message partition;
detecting whether a message sequence number interval exists for the plurality of message partitions to obtain a first detection result, wherein the message sequence number interval is obtained according to a message sequence number, the message sequence number comprises a monotonically increasing sequence number, and the first detection result comprises one of the following steps: the absence of said message sequence number interval, the presence of one said message sequence number interval and the presence of a plurality of said message sequence number intervals; and
And selecting a first target message partition from the message partitions based on the first detection result so as to send the message to be sent to the designated middleware.
2. The method of claim 1, wherein said selecting a first target message partition from said plurality of message partitions based on said first detection result comprises:
selecting a first proposed message partition from the plurality of message partitions based on the first detection result;
transmitting the message to be transmitted to the first proposed message partition to obtain a first transmission result; and
the first target message partition is selected from the plurality of message partitions based on the first transmission result.
3. The method of claim 2, wherein said selecting said first target message partition from said plurality of message partitions based on said first transmission result comprises:
determining a first message proxy of the first proposed message partition if the first sending result indicates that the message to be sent is not successfully sent to the first proposed message partition;
selecting a second proposed message partition other than the first proposed message partition from the plurality of message partitions until a second transmission result indicates successful transmission of the message to be transmitted to the second proposed message partition, wherein the second proposed message partition corresponds to a second message agent, and the second message agent is different from the first message agent; and
And taking the selected second proposed message partition as the first target message partition.
4. The method of claim 2, wherein said selecting a first proposed message partition from said plurality of message partitions based on said first detection result comprises:
and randomly selecting the first proposed message partition from the plurality of message partitions if the first detection result indicates that the message sequence number interval does not exist.
5. The method of claim 2, wherein said selecting a first proposed message partition from said plurality of message partitions based on said first detection result comprises:
searching a maximum message sequence number in a plurality of message sequence number intervals when the first detection result indicates that the plurality of message sequence number intervals exist; and
and taking the message partition corresponding to the maximum message sequence number as the first proposed message partition.
6. The method of claim 1, wherein the method further comprises:
determining a message sequence number corresponding to the message to be sent based on the first target message partition; and
and sending the first target message partition and the message sequence number of the message to be sent to a registry, so that the registry updates the message sequence number interval corresponding to the first target message partition.
7. A message processing method is applied to a message receiving end and comprises the following steps:
in response to receiving a request to receive a message to be consumed from a designated middleware, obtaining a plurality of message partitions of the designated middleware, wherein the designated middleware comprises a plurality of message proxies, each message proxy comprising at least one message partition;
detecting whether a message sequence number interval exists for the plurality of message partitions to obtain a second detection result, wherein the message sequence number interval is obtained according to a message sequence number, the message sequence number comprises a monotonically increasing sequence number, and the second detection result comprises one of the following steps: the absence of said message sequence number interval, the presence of one said message sequence number interval and the presence of a plurality of said message sequence number intervals; and
and selecting a second target message partition from the message partitions based on the second detection result to receive the message to be consumed from the designated middleware.
8. The method of claim 7, wherein said selecting a second target message partition from said plurality of message partitions based on said second detection result comprises:
acquiring a first message sequence number corresponding to a message to be consumed received in the previous time;
Selecting a third proposed message partition from the plurality of message partitions based on the second detection result to obtain a second message sequence number corresponding to the third proposed message partition;
detecting whether the second message sequence number is continuous with the first message sequence number to obtain a third detection result; and
and selecting the second target message partition from the plurality of message partitions based on the third detection result.
9. The method of claim 8, wherein said selecting the second target message partition from the plurality of message partitions based on the third detection result comprises:
searching a third message sequence number which is continuous with the first message sequence number from the message partitions under the condition that the third detection result indicates that the second message sequence number is discontinuous with the first message sequence number; and
and selecting a message partition corresponding to the third message sequence number from the plurality of message partitions as the second target message partition.
10. The method of claim 8, wherein said selecting a third proposed message partition from said plurality of message partitions based on said second detection result comprises:
Searching a minimum message sequence number in a plurality of message sequence number intervals when the second detection result indicates that the plurality of message sequence number intervals exist; and
and selecting a message partition corresponding to the minimum message sequence number from the message partitions as the third proposed message partition.
11. A message processing apparatus, applied to a message transmitting end, comprising:
a first acquisition module configured to acquire a plurality of message partitions of a designated middleware in response to a transmission request for transmitting a message to be transmitted to the designated middleware, wherein the designated middleware includes a plurality of message proxies each including at least one message partition;
a first detection module configured to detect, for the plurality of message partitions, whether a message sequence number interval exists to obtain a first detection result, where the message sequence number interval is obtained according to a message sequence number, the message sequence number includes a monotonically increasing sequential sequence number, and the first detection result includes one of: the absence of said message sequence number interval, the presence of one said message sequence number interval and the presence of a plurality of said message sequence number intervals; and
And a first selection module configured to select a first target message partition from the plurality of message partitions based on the first detection result, so as to send the message to be sent to the designated middleware.
12. A message processing apparatus, applied to a message receiving end, comprising:
a second acquisition module configured to acquire a plurality of message partitions of a designated middleware in response to a reception request for receiving a message to be consumed from the designated middleware, wherein the designated middleware includes a plurality of message proxies each including at least one message partition;
a second detection module configured to detect, for the plurality of message partitions, whether a message sequence number interval exists to obtain a second detection result, where the message sequence number interval is obtained according to a message sequence number, the message sequence number includes a monotonically increasing sequential sequence number, and the second detection result includes one of: the absence of said message sequence number interval, the presence of one said message sequence number interval and the presence of a plurality of said message sequence number intervals; and
and a second selection module configured to select a second target message partition from the plurality of message partitions based on the second detection result to receive the message to be consumed from the specified middleware.
13. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1 to 10.
14. A computer readable storage medium storing computer executable instructions which when executed are adapted to implement the method of any one of claims 1 to 10.
CN201910622611.2A 2019-07-10 2019-07-10 Message processing method and device, electronic equipment and computer readable medium Active CN111741041B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910622611.2A CN111741041B (en) 2019-07-10 2019-07-10 Message processing method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910622611.2A CN111741041B (en) 2019-07-10 2019-07-10 Message processing method and device, electronic equipment and computer readable medium

Publications (2)

Publication Number Publication Date
CN111741041A CN111741041A (en) 2020-10-02
CN111741041B true CN111741041B (en) 2023-05-12

Family

ID=72645838

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910622611.2A Active CN111741041B (en) 2019-07-10 2019-07-10 Message processing method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN111741041B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637044A (en) * 2020-12-11 2021-04-09 国电南瑞科技股份有限公司 Message cross-region forwarding system and method based on remote service
CN112804298B (en) * 2020-12-29 2023-05-02 杭州涂鸦信息技术有限公司 Method, apparatus, computer device and readable storage medium for reducing cross-zone traffic

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143198A (en) * 2010-09-30 2011-08-03 华为技术有限公司 Method, device and system for transferring messages
CN102955717A (en) * 2012-11-05 2013-03-06 北京奇虎科技有限公司 Message management equipment and method in distributed message processing system
CN103034541A (en) * 2012-11-16 2013-04-10 北京奇虎科技有限公司 Distributing type information system and equipment and method thereof
CN103841206A (en) * 2014-03-17 2014-06-04 北京京东尚科信息技术有限公司 Thematic message subscripting and releasing method
CN104932941A (en) * 2012-11-05 2015-09-23 北京奇虎科技有限公司 Distributed message processing system and device and method thereof
CN105306559A (en) * 2015-10-12 2016-02-03 国电南瑞科技股份有限公司 Multi-partition message control system without central partition for regional power grid regulation and control system
CN106131175A (en) * 2016-07-01 2016-11-16 微梦创科网络科技(中国)有限公司 A kind of acquisition of information, information-pushing method and equipment
CN107332787A (en) * 2017-06-29 2017-11-07 北京奇艺世纪科技有限公司 A kind of message distributing method and device
CN107637132A (en) * 2015-04-08 2018-01-26 瑞典爱立信有限公司 Method and apparatus for selecting network partition
CN107766463A (en) * 2017-09-28 2018-03-06 北京北信源软件股份有限公司 A kind of storage processing method and device of the middleware system of multi-service driving
CN108628688A (en) * 2018-03-30 2018-10-09 阿里巴巴集团控股有限公司 A kind of message treatment method, device and equipment
CN108874562A (en) * 2018-06-21 2018-11-23 北京顺丰同城科技有限公司 Distributed high concurrent message queue supplying system
CN109388509A (en) * 2018-10-22 2019-02-26 上海朔羡网络科技有限公司 Message handling system, method, computer equipment and readable storage medium storing program for executing
CN109684099A (en) * 2018-11-23 2019-04-26 新华三大数据技术有限公司 Message treatment method and device
CN109788026A (en) * 2018-12-13 2019-05-21 新华三大数据技术有限公司 Message treatment method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3966711B2 (en) * 2001-11-06 2007-08-29 富士通株式会社 Proxy response method

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143198A (en) * 2010-09-30 2011-08-03 华为技术有限公司 Method, device and system for transferring messages
CN102955717A (en) * 2012-11-05 2013-03-06 北京奇虎科技有限公司 Message management equipment and method in distributed message processing system
CN104932941A (en) * 2012-11-05 2015-09-23 北京奇虎科技有限公司 Distributed message processing system and device and method thereof
CN103034541A (en) * 2012-11-16 2013-04-10 北京奇虎科技有限公司 Distributing type information system and equipment and method thereof
CN103841206A (en) * 2014-03-17 2014-06-04 北京京东尚科信息技术有限公司 Thematic message subscripting and releasing method
CN107637132A (en) * 2015-04-08 2018-01-26 瑞典爱立信有限公司 Method and apparatus for selecting network partition
CN105306559A (en) * 2015-10-12 2016-02-03 国电南瑞科技股份有限公司 Multi-partition message control system without central partition for regional power grid regulation and control system
CN106131175A (en) * 2016-07-01 2016-11-16 微梦创科网络科技(中国)有限公司 A kind of acquisition of information, information-pushing method and equipment
CN107332787A (en) * 2017-06-29 2017-11-07 北京奇艺世纪科技有限公司 A kind of message distributing method and device
CN107766463A (en) * 2017-09-28 2018-03-06 北京北信源软件股份有限公司 A kind of storage processing method and device of the middleware system of multi-service driving
CN108628688A (en) * 2018-03-30 2018-10-09 阿里巴巴集团控股有限公司 A kind of message treatment method, device and equipment
CN108874562A (en) * 2018-06-21 2018-11-23 北京顺丰同城科技有限公司 Distributed high concurrent message queue supplying system
CN109388509A (en) * 2018-10-22 2019-02-26 上海朔羡网络科技有限公司 Message handling system, method, computer equipment and readable storage medium storing program for executing
CN109684099A (en) * 2018-11-23 2019-04-26 新华三大数据技术有限公司 Message treatment method and device
CN109788026A (en) * 2018-12-13 2019-05-21 新华三大数据技术有限公司 Message treatment method and device

Also Published As

Publication number Publication date
CN111741041A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
US20150339261A1 (en) System and method for data transfer among the devices
US20100138687A1 (en) Recording medium storing failure isolation processing program, failure node isolation method, and storage system
CN111741041B (en) Message processing method and device, electronic equipment and computer readable medium
CN107391156B (en) Method, management node and service node for distributed system transmission service
CN110750393B (en) Method, device, medium and equipment for avoiding network service double-machine hot standby brain cracking
US8266301B2 (en) Deployment of asynchronous agentless agent functionality in clustered environments
CN109150662B (en) Message transmission method, distributed system, device, medium, and unmanned vehicle
CN104092719A (en) File transmission method, device and distributed cluster file system
CN108683528B (en) Data transmission method, central server, server and data transmission system
CN107645386B (en) Method and device for acquiring data resources
CN110913026B (en) Message transmission method, device, electronic equipment and medium
JP4698653B2 (en) Content distribution system and content distribution method for content distribution system
CN112291082B (en) Disaster recovery processing method, terminal and storage medium for machine room
JP2018515850A (en) Data copy method and device
JP5395517B2 (en) Distributed data management system, data management apparatus, data management method, and program
CN110740145A (en) Message consumption method, device, storage medium and electronic equipment
EP3427157B1 (en) Cross-regional data transmission
CN109088830B (en) Port state synchronization method and device
CN110764838B (en) Service model loading method and system, electronic equipment and storage medium
CN110597808B (en) Distributed database table connection method, device, system, server and medium
CN112363980A (en) Data processing method and device for distributed system
EP2928105A2 (en) Content delivery architecture
CN114598593B (en) Message processing method, system, computing device and computer storage medium
US20200280512A1 (en) Optimized reconciliation in a controller-switch network
CN112306755B (en) High-availability implementation method and system based on micro front-end architecture

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