CN114584508B - Rabbit MQ duplex communication-based method and application - Google Patents

Rabbit MQ duplex communication-based method and application Download PDF

Info

Publication number
CN114584508B
CN114584508B CN202210205117.8A CN202210205117A CN114584508B CN 114584508 B CN114584508 B CN 114584508B CN 202210205117 A CN202210205117 A CN 202210205117A CN 114584508 B CN114584508 B CN 114584508B
Authority
CN
China
Prior art keywords
queue
message
receiving end
rabbit
routing rule
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
CN202210205117.8A
Other languages
Chinese (zh)
Other versions
CN114584508A (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.)
Huayun Data Holding Group Co ltd
Original Assignee
Huayun Data Holding Group 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 Huayun Data Holding Group Co ltd filed Critical Huayun Data Holding Group Co ltd
Priority to CN202210205117.8A priority Critical patent/CN114584508B/en
Publication of CN114584508A publication Critical patent/CN114584508A/en
Application granted granted Critical
Publication of CN114584508B publication Critical patent/CN114584508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/16Multipoint routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/302Route determination based on requested QoS
    • H04L45/306Route determination based on the nature of the carried application
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method and application based on Rabbit MQ duplex communication, wherein the method comprises the following steps: creating a left queue and a right queue, wherein the left queue is used for at least one sending end to monitor messages sent by at least one receiving end, and the right queue is used for at least one receiving end to monitor messages sent by at least one sending end; the sending end binds the Rabbit MQ switch with a left queue according to a left routing rule, and binds the Rabbit MQ switch with a right queue according to a right routing rule; the sending end communicates with the receiving end after the left queue monitors the handshake message of the receiving end, and the handshake message is sent by the receiving end according to the right routing rule. The method can enable the sending end to receive the message by using the left queue and pass through the key: connection. Duplex. Right sends a message to the switch, and the receiving end receives the message by using the right queue and passes the key: connection. Duplex. Left sends a message to the switch, and duplex communication can be performed by only sending a handshake message from the receiving end.

Description

Rabbit MQ duplex communication-based method and application
Technical Field
The invention relates to the field of computers, in particular to a method and application based on Rabbit MQ duplex communication.
Background
The prior art application methods for message distribution or broadcasting through the rabit MQ are all operated through consumer mode. The consumer model is characterized by the fact that the message publisher is not known to the number of consumers and does not care whether the consumers are online, as long as the message is produced and pushed onto the message bus. In this mode, the consumer and the message publisher are unaware of each other's existence, and thus cannot communicate conventionally.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person of ordinary skill in the art.
Disclosure of Invention
The invention aims to provide a method and application based on Rabbit MQ duplex communication, which solve the problem that point-to-point connection can only be performed when communication with an opposite terminal is needed and communication cannot be performed under the condition that the position of the opposite terminal is unknown.
In order to achieve the above purpose, the embodiment of the invention provides a method based on Rabbit MQ duplex communication.
In one or more embodiments of the invention, the method comprises: creating a left queue and a right queue, wherein the left queue is used for at least one sending end to monitor messages sent by at least one receiving end, and the right queue is used for at least one receiving end to monitor messages sent by at least one sending end; the sending end binds the Rabbit MQ switch with a left queue according to a left routing rule, and binds the Rabbit MQ switch with a right queue according to a right routing rule; and the sending end communicates with the receiving end after monitoring a handshake message of the receiving end in a left queue, wherein the handshake message is sent by the receiving end according to the right routing rule.
In one or more embodiments of the present invention, the sending end communicates with the receiving end after the left queue monitors the handshake message of the receiving end, including: when the queue manager of the transmitting end monitors that a message arrives in a left queue, the arriving message is written into a reading interface of the transmitting end; and when the queue manager of the transmitting end monitors that the writing interface of the transmitting end has message writing, the written message is transmitted to the RabbitMQ switch according to the left routing rule.
In one or more embodiments of the present invention, when the transmitting end disconnects, the method further includes: and the sending end sends an end message and clears the Rabbit MQ switch, the left queue and the right queue.
In one or more embodiments of the present invention, the communication connection configuration includes: the device comprises a Rabbit MQ address, a user name, a password, a secret key, a switch, a left queue and a right queue.
To achieve the above object, an embodiment of the present invention provides a method for duplex communication based on a rabit MQ.
In one or more embodiments of the invention, the method comprises: the receiving end respectively creates a left queue and a right queue; the receiving end sends a handshake message to the sending end according to a right routing rule, and the sending end communicates with the sending end after the sending end monitors the handshake message in a left queue; the left queue is used for a sending end to monitor messages sent by a receiving end, the right queue is used for a receiving end to monitor messages sent by the sending end, the left queue is bound with the Rabbit MQ switch according to a left routing rule, and the right queue is bound with the Rabbit MQ switch according to a right routing rule.
In one or more embodiments of the invention, the method further comprises: when the queue manager of the receiving end monitors that a message arrives in a right queue, the arriving message is written into a reading interface of the receiving end; and when the queue manager of the receiving end monitors that the writing interface of the receiving end has message writing, the written message is sent to the Rabbit MQ switch according to a right routing rule.
In another aspect of the present invention, there is provided an apparatus for duplex communication based on a rabit MQ, which includes a creation module, a routing module, and a communication module.
The system comprises a creation module, a receiving module and a transmission module, wherein the creation module is used for creating a left queue and a right queue, the left queue is used for at least one transmitting end to monitor messages transmitted by at least one receiving end, and the right queue is used for at least one receiving end to monitor messages transmitted by at least one transmitting end.
And the routing module is used for binding the Rabbit MQ switch with the left queue according to the left routing rule and binding the Rabbit MQ switch with the right queue according to the right routing rule by the sending end.
The communication module is used for the sending end to communicate with the receiving end after the sending end monitors the handshake message of the receiving end in the left queue, wherein the handshake message is sent by the receiving end according to the right routing rule.
In one or more embodiments of the present invention, the communication module is further configured to: when the queue manager of the transmitting end monitors that a message arrives in a left queue, the arriving message is written into a reading interface of the transmitting end; and when the queue manager of the transmitting end monitors that the writing interface of the transmitting end has message writing, the written message is transmitted to the RabbitMQ switch according to the left routing rule.
In one or more embodiments of the present invention, the communication module is further configured to: when the transmitting end is disconnected, the transmitting end transmits an end message and clears the exchanger, the left queue and the right queue of the Rabbit MQ.
In another aspect of the present invention, there is provided a device based on a rabit MQ duplex communication, which includes a communication module.
The communication module is used for the receiving end to respectively establish a left queue and a right queue; the receiving end sends a handshake message to the sending end according to a right routing rule, and the sending end communicates with the sending end after the sending end monitors the handshake message in a left queue; the left queue is used for a sending end to monitor messages sent by a receiving end, the right queue is used for a receiving end to monitor messages sent by the sending end, the left queue is bound with the Rabbit MQ switch according to a left routing rule, and the right queue is bound with the Rabbit MQ switch according to a right routing rule.
In one or more embodiments of the present invention, the communication module is further configured to: when the queue manager of the receiving end monitors that a message arrives in a right queue, the arriving message is written into a reading interface of the receiving end; and when the queue manager of the receiving end monitors that the writing interface of the receiving end has message writing, the written message is sent to the RabbitMQ switch according to a right routing rule.
In another aspect of the present invention, there is provided an electronic device including: at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of rabit MQ-based duplexing as described above.
In another aspect of the invention, a computer readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, implements the steps of a method of rabit MQ duplex communication as described.
Compared with the prior art, according to the method and the application based on the Rabbit MQ duplex communication, the method and the application can be used for binding a route with a corresponding message queue by creating 2 Rabbit MQ message queues to serve as channels of bidirectional traffic and creating a special routing rule, so that a sending end receives a message by using a left-direction queue and passes through a key: connection. Duplex. Right sends a message to the switch, and the receiving end receives the message by using the right queue and passes the key: connection. Duplex. Left sends a message to the switch, and duplex communication can be performed by only sending a handshake message from the receiving end.
Drawings
Fig. 1 is a flow chart of a transmitting end of a method for duplex communication based on a rabit MQ according to an embodiment of the present invention;
FIG. 2 is a system architecture diagram of a method for Rabbit MQ-based duplex communication in accordance with an embodiment of the invention;
FIG. 3 is a flow diagram of a routing manager of a method for Rabbit MQ-based duplex communication according to one embodiment of the invention;
FIG. 4 is a flow diagram of a sender queue manager for a method of Rabbit MQ-based duplex communication according to one embodiment of the invention;
fig. 5 is a flow chart of transmitting-side packet transmission of a method based on a rabit MQ duplex communication according to an embodiment of the present invention;
fig. 6 is a flow chart of a receiving end of a method for a rabit MQ-based duplex communication according to an embodiment of the present invention;
FIG. 7 is a flow diagram of a receive side queue manager for a method of Rabbit MQ-based duplex communication according to one embodiment of the invention;
fig. 8 is a flow chart of a receiving end packet transmission of a method based on a rabit MQ duplex communication according to an embodiment of the present invention;
fig. 9 is a diagram of a transmitting end of a device for duplex communication based on a rabit MQ according to an embodiment of the present invention;
fig. 10 is a diagram of a receiver end structure of a device based on a rabit MQ duplex communication according to an embodiment of the present invention;
fig. 11 is a hardware configuration diagram of a computing device based on a rabitmq duplex communication according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the invention is, therefore, to be taken in conjunction with the accompanying drawings, and it is to be understood that the scope of the invention is not limited to the specific embodiments.
Throughout the specification and claims, unless explicitly stated otherwise, the term "comprise" or variations thereof such as "comprises" or "comprising", etc. will be understood to include the stated element or component without excluding other elements or components.
The following describes in detail the technical solutions provided by the embodiments of the present invention with reference to the accompanying drawings.
Example 1
As shown in fig. 1 to 5, a method for duplex communication based on a rabit MQ in an embodiment of the present invention is described, and the method includes the following steps.
In step S101, the transmitting end creates a left-hand queue and a right-hand queue, respectively.
The working principle of the RabbitMQ is that a message publisher sends a message to a Rabbit MQ proxy server, a switch in the proxy server receives the message, the message is transferred to a message queue bound with the switch and is stored, and a consumer establishes a connection with the message proxy server and then takes the message out of the corresponding message queue for processing.
The communication connection configuration to be used is agreed by the sending end and the receiving end, and the communication connection configuration comprises the following steps: the device comprises a Rabbit MQ address, a user name, a password, a secret key, a switch to be used in communication, a left queue and a right queue. The switch is used to receive messages sent by message publishers and route those messages to queues in the server. The left and right queues are used to hold messages until sent to the consumer. It is the container of the message and also the end of the message. A message may be placed into one or more queues. Messages remain in the queue waiting for the consumer to connect to the queue to take them away.
The transmitting end uses the agreed communication connection to configure a read-write engine of the transmitting end, and the read-write engine comprises a read interface, a write interface, a route manager and a queue manager. The queue manager of the read-write engine creates 2 Rabbit MQ message queues to serve as a channel of bidirectional traffic according to the communication connection configuration, so that a sending end and a receiving end can use the corresponding left-direction queues or right-direction queues to monitor messages sent by the other side.
In step S102, the transmitting end binds the rabit MQ switch with the left queue according to the left routing rule, and binds the rabit MQ switch with the right queue according to the right routing rule.
The read-write engine of the transmitting end actively connects with the Rabbit MQ according to the configuration information, configures the corresponding message queue name, the router and binds the corresponding queue according to the routing rule.
Specifically, the read-write engine generates a routing rule key according to the communication connection configuration: connection. Duplex. Right and key: connection. After the queue manager of the read-write engine successfully creates a left-direction queue and a right-direction queue, according to the routing rule key: connection.duplex.right binding right-hand queue, key: connection.
In step S103, the transmitting end communicates with the receiving end after monitoring the handshake message of the receiving end in the left queue.
After receiving the ready signal sent by the routing manager, the queue manager of the sending end starts to monitor the message in the left queue, and the receiving end uses the key: connection. Duplex. Left actively sends a handshake message, and communication is started after the sending end receives the handshake message sent by the receiving end.
The sending end receives the message by using the left queue and passes the key: connection. The receiving end uses the right queue to receive the message and passes the key: connection.
When the queue manager of the transmitting end monitors that the left queue has information, the information is written into the reading interface of the transmitting end. When the queue manager of the transmitting end monitors that the writing interface has information writing, the queue manager monitors that the writing interface has information writing according to the corresponding routing rule key: connection. Duplex. Right sends information to the switches of the Rabbit MQ.
When the sending end or the receiving end needs to be disconnected, an end message needs to be sent, and after the end message is received by the opposite end and disconnected, the sending end actively clears the exchanger, the left queue and the right queue of the RabbitMQ.
Example 2
As shown in fig. 6 to 8, a method for duplex communication based on a rabit MQ in one embodiment of the present invention is described, and includes the following steps.
In step S201, the receiving end creates a left-hand queue and a right-hand queue, respectively.
The invention is not only suitable for the situation of one sending end and one receiving end, but also suitable for the situation of one-to-many, many-to-one and many-to-many, namely, one sending end corresponds to a plurality of receiving ends, or a plurality of receiving ends correspond to one sending end, or a plurality of different receiving ends correspond to a plurality of different sending ends at the same time, and because the routing rules are different, the circuits are mutually independent and mutually noninterfere. In this embodiment, one transmitting end corresponds to a plurality of receiving ends.
The working principle of the RabbitMQ is that a message publisher sends a message to a Rabbit MQ proxy server, a switch in the proxy server receives the message, the message is transferred to a message queue bound with the switch and is stored, and a consumer establishes a connection with the message proxy server and then takes the message out of the corresponding message queue for processing.
The communication connection configuration to be used is agreed by the sending end and the receiving end, and the communication connection configuration comprises the following steps: the device comprises a Rabbit MQ address, a user name, a password, a secret key, a switch to be used in communication, a left queue and a right queue. The switch is used to receive messages sent by message publishers and route those messages to queues in the server. The left and right queues are used to hold messages until sent to the consumer. It is the container of the message and also the end of the message. A message may be placed into one or more queues. Messages remain in the queue waiting for the consumer to connect to the queue to take them away.
The transmitting end and the receiving end use the agreed communication connection configuration to set the read-write engine of the transmitting end and the receiving end, and the read-write engine comprises a read interface, a write interface, a route manager and a queue manager. The queue manager of the read-write engine creates 2 Rabbit MQ message queues to serve as a channel of bidirectional traffic according to the communication connection configuration, so that a sending end and a receiving end can use the corresponding left-direction queues or right-direction queues to monitor messages sent by the other side.
In step S202, the receiving end binds the rabit MQ switch with the left queue according to the left routing rule, and binds the rabit MQ switch with the right queue according to the right routing rule.
The read-write engine of the receiving end actively connects with the Rabbit MQ according to the configuration information, configures the corresponding message queue name, the router and binds the corresponding queue according to the routing rule.
In this embodiment, the communication device includes a transmitting end, a first receiving end and a second receiving end, where the left queue is used for the transmitting end to monitor messages sent by the first receiving end and the second receiving end, the first right queue is used for the first receiving end to monitor messages sent by the transmitting end, and the second right queue is used for the second receiving end to monitor messages sent by the transmitting end.
The read-write engine generates a routing rule key according to the communication connection configuration: connection.duplex.right.1, key: connection.duplex.right.2 and key: connection. After the queue manager of the read-write engine successfully creates a left-direction queue and a right-direction queue, according to the routing rule key: connection.duplex.right.1 binds the first right-hand queue according to the routing rule key: connection.duplex.right.2 binds the second right-hand queue, key: connection.
In step S203, the receiving end actively sends a handshake message according to the routing rule.
After receiving the ready signal sent by the routing manager, the queue manager of the sending end starts to monitor the messages in the left-direction queue, and the first receiving end and the second receiving end use keys respectively: connection. Duplex. Left actively sends a handshake message, and communication is started after a sending end receives the handshake message sent by a first receiving end or a second receiving end.
The sending end receives the message by using the left queue and passes the key: connection.duplex.right.1, key: connection. Duplex. Right.2 sends a message to the switch. The first receiving end and the second receiving end respectively use the first right-direction queue and the second right-direction queue to receive the message and pass through the key: connection.
When the queue manager of the transmitting end monitors that the left queue has information, the information is written into the reading interface of the transmitting end. When the queue manager of the transmitting end monitors that the writing interface has information writing, the queue manager monitors that the writing interface has information writing according to the corresponding routing rule key: connection.duplex.right.1 or key: connection.duplex.right.2 sends the information to the switches of the rabitmq.
In step S204, the receiving end listens to whether the switch of the rabitmq is on line.
The communication connection configuration to be used is agreed by the sending end and the receiving end, and the communication connection configuration comprises the following steps: the device comprises a Rabbit MQ address, a user name, a password, a secret key, a switch to be used in communication, a left queue and a right queue. The switch is used to receive messages sent by message publishers and route those messages to queues in the server. The left and right queues are used to hold messages until sent to the consumer. It is the container of the message and also the end of the message. A message may be placed into one or more queues. Messages remain in the queue waiting for the consumer to connect to the queue to take them away.
The receiving end uses the agreed communication connection configuration to set the read-write engine of the receiving end, the read-write engine of the receiving end is actively connected with the RabbitMQ according to the configuration information, and whether the switch of the RabbitMQ is on line is monitored. If the route to the exchanger of the Rabbit MQ is monitored, information is written into a writing interface representing a sending end, and the information is written into the writing interface through a corresponding routing rule key: connection.
In step S205, when the queue manager at the receiving end monitors that the right queue has information arrived, the information is written into the read interface at the receiving end.
The first receiving end and the second receiving end respectively use the first right-hand queue and the second right-hand queue to receive the information of the sending end and pass through the key: connection. Duplex. Left sends messages to the switches of the Rabbit MQ, respectively.
When information is written in a writing interface of a sending end, the information is written in through a corresponding routing rule key: connection.duplex.right.1 or key: the connection, duplex, right.2 sends the information to the switch of the Rabbit MQ, the switch sends the information to the first right-hand queue and the second right-hand queue respectively, at this time, the queue managers of the first receiving end and the second receiving end can monitor that the corresponding right-hand queues have information to arrive, and the queue managers of the first receiving end and the second receiving end write the information into the corresponding reading interfaces.
In step S206, when the queue manager at the receiving end monitors that the write interface has information write, the queue manager sends the information to the switch of the rabitmq according to the corresponding routing rule.
When information is written in a writing interface of the first receiving end or the second receiving end, the information is written in the writing interface through a corresponding routing rule key: the connection is a duplex, left sends the information to the exchanger of the Rabbit MQ, the exchanger sends the information to the left queue, at this time, the queue manager of the sending end can monitor that the left queue has information to arrive, and the queue manager of the sending end writes the information into the reading interface of the sending end.
As shown in fig. 9, an apparatus based on rabit MQ duplex communication according to an embodiment of the present invention is described.
In an embodiment of the present invention, the device based on the rabit MQ duplex communication includes a creation module 901, a routing module 902 and a communication module 903.
The creating module 901 is configured to create a left queue and a right queue, where the left queue is used for at least one sending end to monitor a message sent by at least one receiving end, and the right queue is used for at least one receiving end to monitor a message sent by at least one sending end.
And the routing module 902 is configured to enable the transmitting end to bind the rabit MQ switch with the left queue according to the left routing rule, and bind the rabit MQ switch with the right queue according to the right routing rule.
The communication module 903 is configured to enable the sending end to communicate with the receiving end after the sending end monitors a handshake packet of the receiving end in the left queue, where the handshake packet is sent by the receiving end according to a right routing rule.
The communication module 903 is further configured to: when the queue manager of the transmitting end monitors that a message arrives in the left queue, the arriving message is written into a reading interface of the transmitting end; and when the queue manager of the transmitting end monitors that the writing interface of the transmitting end has message writing, the written message is transmitted to the Rabbit MQ switch according to the left routing rule.
The communication module 903 is further configured to: when the transmitting end is disconnected, the transmitting end transmits an end message and clears the exchanger, the left queue and the right queue of the Rabbit MQ.
As shown in fig. 10, an apparatus for duplex communication based on a rabit MQ according to an embodiment of the present invention is described.
In an embodiment of the present invention, the device based on the rabit MQ duplex communication includes a communication module 1001.
The communication module 1001 is configured to allow the receiving end to create a left queue and a right queue respectively, and the receiving end sends a handshake message to the sending end according to a right routing rule, and communicates with the sending end after the sending end monitors the handshake message in the left queue; the left queue is used for the sending end to monitor messages sent by the receiving end, the right queue is used for the receiving end to monitor messages sent by the sending end, the left queue is bound with the Rabbit MQ switch according to a left routing rule, and the right queue is bound with the Rabbit MQ switch according to a right routing rule.
The communication module 1001 is further configured to: when the queue manager of the receiving end monitors that a message arrives in the right queue, the arriving message is written into a reading interface of the receiving end; and when the queue manager of the receiving end monitors that the writing interface of the receiving end has message writing, the written message is sent to the Rabbit MQ switch according to the right routing rule.
Fig. 11 shows a hardware architecture diagram of a computing device 110 for a rabit MQ-based duplex communication according to an embodiment of the disclosure. As shown in fig. 11, computing device 110 may include at least one processor 1101, a memory 1102 (e.g., a non-volatile memory), a memory 1103, and a communication interface 1104, and the at least one processor 1101, memory 1102, memory 1103, and communication interface 1104 are connected together via a bus 1105. The at least one processor 1101 executes at least one computer readable instruction stored or encoded in the memory 1102.
It should be appreciated that the computer-executable instructions stored in the memory 1102, when executed, cause the at least one processor 1101 to perform the various operations and functions described above in connection with fig. 1-11 in various embodiments of the present specification.
In embodiments of the present description, computing device 110 may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal Digital Assistants (PDAs), handsets, messaging devices, wearable computing devices, consumer electronic devices, and the like.
According to one embodiment, a program product, such as a machine-readable medium, is provided. The machine-readable medium may have instructions (i.e., elements described above implemented in software) that, when executed by a machine, cause the machine to perform the various operations and functions described above in connection with fig. 1-11 in various embodiments of the specification. In particular, a system or apparatus provided with a readable storage medium having stored thereon software program code implementing the functions of any of the above embodiments may be provided, and a computer or processor of the system or apparatus may be caused to read out and execute instructions stored in the readable storage medium.
According to the method and the application based on the Rabbit MQ duplex communication, which are disclosed by the embodiment of the invention, 2 Rabbit MQ message queues can be created to serve as channels of bidirectional traffic, and a dedicated routing rule is created to bind a route with a corresponding message queue, so that a sending end receives a message by using a left-direction queue and passes through a key: connection. Duplex. Right sends a message to the switch, and the receiving end receives the message by using the right queue and passes the key: connection. Duplex. Left sends a message to the switch, and duplex communication can be performed by only sending a handshake message from the receiving end.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing descriptions of specific exemplary embodiments of the present invention are presented for purposes of illustration and description. It is not intended to limit the invention to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teaching. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application to thereby enable one skilled in the art to make and utilize the invention in various exemplary embodiments and with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims and their equivalents.

Claims (10)

1. A method for duplex communication based on a rabit MQ, the method comprising:
creating a left queue and a right queue, wherein the left queue is used for at least one sending end to monitor messages sent by at least one receiving end, and the right queue is used for at least one receiving end to monitor messages sent by at least one sending end;
the sending end binds the Rabbit MQ switch with a left queue according to a left routing rule, and binds the Rabbit MQ switch with a right queue according to a right routing rule; and
the sending end communicates with the receiving end after monitoring a handshake message of the receiving end in a left queue, wherein the handshake message is sent by the receiving end according to the right routing rule.
2. The method for duplex communication based on rabit MQ according to claim 1, wherein the transmitting end communicates with the receiving end after the left queue monitors the handshake message of the receiving end, comprising:
when the queue manager of the transmitting end monitors that a message arrives in the left queue, the arriving message is written into a reading interface of the transmitting end; and
and when the queue manager of the transmitting end monitors that the writing interface of the transmitting end has message writing, the written message is transmitted to the Rabbit MQ switch according to the left routing rule.
3. The method for rabit MQ duplex communication according to claim 1, wherein when the transmitting end is disconnected, the method further comprises:
and the sending end sends an end message and clears the Rabbit MQ switch, the left queue and the right queue.
4. A method for duplex communication based on a rabit MQ, the method comprising:
the receiving end respectively creates a left queue and a right queue; and
the receiving end sends a handshake message to the sending end according to a right routing rule, and the sending end communicates with the sending end after the sending end monitors the handshake message in a left queue;
the left queue is used for a sending end to monitor messages sent by a receiving end, the right queue is used for a receiving end to monitor messages sent by the sending end, the left queue is bound with the Rabbit MQ switch according to a left routing rule, and the right queue is bound with the Rabbit MQ switch according to a right routing rule.
5. The method for rabit MQ-based duplex communication according to claim 4, wherein the method further comprises:
when the queue manager of the receiving end monitors that a message arrives in the right queue, the arriving message is written into a reading interface of the receiving end; and
and when the queue manager of the receiving end monitors that the writing interface of the receiving end has message writing, the written message is sent to the Rabbit MQ switch according to the right routing rule.
6. An apparatus for duplex communication based on a rabit MQ, the apparatus comprising:
the system comprises a creation module, a transmission module and a receiving module, wherein the creation module is used for creating a left queue and a right queue, the left queue is used for at least one transmitting end to monitor messages transmitted by at least one receiving end, and the right queue is used for at least one receiving end to monitor messages transmitted by at least one transmitting end;
the routing module is used for the transmitting end to bind the Rabbit MQ switch with the left queue according to the left routing rule and bind the Rabbit MQ switch with the right queue according to the right routing rule; and
the communication module is used for the sending end to communicate with the receiving end after the sending end monitors the handshake message of the receiving end in the left queue, wherein the handshake message is sent by the receiving end according to the right routing rule.
7. The apparatus for rabit MQ duplex communication based on claim 6, wherein the communication module is further configured to:
when the queue manager of the transmitting end monitors that a message arrives in the left queue, the arriving message is written into a reading interface of the transmitting end; and
and when the queue manager of the transmitting end monitors that the writing interface of the transmitting end has message writing, the written message is transmitted to the Rabbit MQ switch according to the left routing rule.
8. An apparatus for duplex communication based on a rabit MQ, the apparatus comprising:
the creation module is used for the receiving end to create a left queue and a right queue respectively;
the communication module is used for the receiving end to send the handshake message to the sending end according to the right routing rule, and the receiving end communicates with the sending end after the sending end monitors the handshake message in the left queue; the left queue is used for a sending end to monitor messages sent by a receiving end, the right queue is used for a receiving end to monitor messages sent by the sending end, the left queue is bound with the Rabbit MQ switch according to a left routing rule, and the right queue is bound with the Rabbit MQ switch according to a right routing rule.
9. An electronic device, comprising:
at least one processor; and
a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of rabit MQ duplex communication-based method of any of claims 1-5.
10. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the method of rabit MQ duplex communication based on any of claims 1 to 5.
CN202210205117.8A 2022-03-02 2022-03-02 Rabbit MQ duplex communication-based method and application Active CN114584508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210205117.8A CN114584508B (en) 2022-03-02 2022-03-02 Rabbit MQ duplex communication-based method and application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210205117.8A CN114584508B (en) 2022-03-02 2022-03-02 Rabbit MQ duplex communication-based method and application

Publications (2)

Publication Number Publication Date
CN114584508A CN114584508A (en) 2022-06-03
CN114584508B true CN114584508B (en) 2024-02-06

Family

ID=81777221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210205117.8A Active CN114584508B (en) 2022-03-02 2022-03-02 Rabbit MQ duplex communication-based method and application

Country Status (1)

Country Link
CN (1) CN114584508B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471718A (en) * 2015-12-22 2016-04-06 积成电子股份有限公司 Realization method of full duplex message queue
CN110661849A (en) * 2019-08-30 2020-01-07 中国人民财产保险股份有限公司 Request processing method and device, electronic equipment and storage medium
CN112231123A (en) * 2020-10-29 2021-01-15 浙江大华技术股份有限公司 Message processing method, message processing device, storage medium and electronic device
CN113703997A (en) * 2021-08-16 2021-11-26 北京图菱视频科技有限公司 Bidirectional asynchronous communication middleware system integrating multiple message agents and implementation method
CN113971098A (en) * 2021-11-01 2022-01-25 百融至信(北京)征信有限公司 RabbitMQ consumption management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471718A (en) * 2015-12-22 2016-04-06 积成电子股份有限公司 Realization method of full duplex message queue
CN110661849A (en) * 2019-08-30 2020-01-07 中国人民财产保险股份有限公司 Request processing method and device, electronic equipment and storage medium
CN112231123A (en) * 2020-10-29 2021-01-15 浙江大华技术股份有限公司 Message processing method, message processing device, storage medium and electronic device
CN113703997A (en) * 2021-08-16 2021-11-26 北京图菱视频科技有限公司 Bidirectional asynchronous communication middleware system integrating multiple message agents and implementation method
CN113971098A (en) * 2021-11-01 2022-01-25 百融至信(北京)征信有限公司 RabbitMQ consumption management method and system

Also Published As

Publication number Publication date
CN114584508A (en) 2022-06-03

Similar Documents

Publication Publication Date Title
CN113872807A (en) Intelligent role selection for dual role devices
CN111163130B (en) Network service system and data transmission method thereof
CN107133109B (en) Method and device for communication between modules and computing equipment
CN103067257A (en) Method and server and system for achieving data mutual communication in social networking service
CN105262673A (en) E-mail reminding method and terminal thereof
JP7046983B2 (en) Packet transmission method and equipment
CN115913790A (en) Data transmission method based on private computing network, electronic equipment and storage medium
US9467526B2 (en) Network communication using intermediation processor
CN110247959A (en) A kind of data transmission method and device
CN114584508B (en) Rabbit MQ duplex communication-based method and application
WO2024067529A1 (en) Rdma-based link establishment method and apparatus, and device and storage medium
CN112422485B (en) Communication method and device of transmission control protocol
CN103731424B (en) A kind of transmission method of network data, apparatus and system
CN106933646B (en) Method and device for creating virtual machine
CN102346717B (en) Intelligent platform management interface (IPMI) message transmission device, system and computer equipment
CN104572315A (en) Inter-subsystem communication method, communication entities and distributed communication system
CN114024870B (en) Network connectivity detection method and system
CN116243853A (en) Data transmission method and device, electronic equipment and nonvolatile storage medium
CN103338248B (en) A kind of method, system and device of two communication account number opening relationships
CN113014610B (en) Remote access method, device and system
CN113438083A (en) Signature adding and checking method and device based on interface automatic test
CN110659143B (en) Communication method and device between containers and electronic equipment
CN107454021B (en) Communication method and device
CN104125257A (en) Account number management method of public account number, apparatus and system thereof
CN111615150B (en) 5G data transmission method, device, equipment and storage medium based on PCIe interface

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