Meteorological data transmission fault tolerance method and device based on RabbitMQ
Through the use of random request numbers in Rabbitmq for verification, the reliability problem of meteorological data transmission when connecting between the ship and the shore -based network is solved, and the reliable transmission and confirmation of the data is achieved to ensure the accuracy of the weather display.
Patent Information
- Application Number
- CN202411660203.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-01-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When the network connection between the ship base and the shore base is disconnected, messages may be lost, messages are duplicated, messages are unreliable, or messages are not acknowledged during RabbitMQ message transmission, which may affect the reliable transmission of meteorological data.
By generating a random request number on the ship base, and using the request number in Rabbitmq for verification, ensure that the meteorological data is not lost during the transmission and avoid repeated processing.
With the interruption of network connection, the reliable transmission and confirmation of meteorological data is avoided, avoiding data loss and repeated processing, and providing accurate and reliable input data for meteorological display.
Smart Images

Figure CN119383216A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a meteorological data transmission fault-tolerant method and device based on RabbitMQ. Background Art
[0002] Shore-based refers to various facilities, systems and technologies located on shore. Ship-based refers to various equipment, systems and technologies located on ships. The communication between shore-based and ship-based faces problems in signal connectivity and coverage: In the sea area far away from shore-based facilities, the coverage of communication signals may be limited, resulting in communication interruption or instability. Signal dead zones may be encountered during sea voyages, which will affect the connectivity of communications.
[0003] RabbitMQ is an open source message middleware used to implement message delivery in distributed systems. It can solve the problems of signal connectivity and multi-device intercommunication to a certain extent.
[0004] 1. Signal connectivity and coverage issues: In the shipping industry, the signal coverage between shore-based facilities and equipment on ships is limited. RabbitMQ can be used for message transmission. Equipment on the ship can send messages to the RabbitMQ server, and applications on shore-based facilities can receive messages from RabbitMQ, enabling communication between remote devices, thereby alleviating the limitation of signal coverage.
[0005] 2. Multi-device intercommunication problem: RabbitMQ supports multiple producers and consumers connected to the message queue at the same time. Different devices on the ship can act as producers to send messages to the queue, while other devices can act as consumers to receive messages from the queue. This method allows multiple devices on the ship and shore to communicate with each other and realize intercommunication between multiple devices.
[0006] Although RabbitMQ provides the ability to deliver messages, in actual applications, factors such as the stability of network connections and the reliability of message delivery also need to be considered.
[0007] The RabbitMQ message confirmation mechanism is used to ensure that messages are confirmed after being processed by consumers, avoiding message loss or duplicate processing.
[0008] In RabbitMQ, when a message is sent to a switch, a message confirmation mechanism is usually used, which ensures that after the message is received and persisted by RabbitMQ, a confirmation signal is returned to the producer. This confirmation signal indicates that the message has been successfully received, RabbitMQ has saved the message to the queue, or has routed the message to the bound queue.
[0009] Acknowledgements are sent asynchronously, meaning that the producer can continue to send the next message without waiting for an acknowledgement for the previous message.
[0010] Although the use of RabbitMQ's message confirmation mechanism can alleviate the limitations of signal connectivity and coverage, when the network connection between the ship base and the shore base is disconnected in the following four situations, messages will be lost, messages will be processed repeatedly, messages will be unreliable, or messages will not be confirmed.
[0011] Message loss: If the connection is disconnected before the message is sent to RabbitMQ, the message may be lost because the message has not yet reached the RabbitMQ server. This means that the message is lost in the transmission process and will not be saved to any queue.
[0012] Duplicate message processing: If the connection is broken after a message is sent to RabbitMQ, but reestablished before the message is acknowledged, the message may be sent to the queue repeatedly, causing the consumer to process the same message multiple times.
[0013] Messages are unreliable: If the connection is disconnected after the message is sent to RabbitMQ, but the message has not been confirmed to be received by RabbitMQ, the reliability of the message will be threatened. In this case, the message may be lost during transmission, so the producer cannot be sure whether the message has been successfully received.
[0014] Messages are not confirmed: If the connection is disconnected before the message is processed and the confirmation signal is sent, RabbitMQ will not receive the confirmation signal. In this case, the message will not be removed from the queue, so it may cause the message to be processed twice. If the confirmation mechanism of the message is manual, the message will always wait for the confirmation signal and will not be processed.
[0015] The existing technology has the above-mentioned deficiencies, which need to be solved with appropriate technical solutions. Summary of the invention
[0016] The technical problem to be solved by the present invention is to overcome the above-mentioned defects in the prior art and provide a meteorological data transmission fault-tolerant method and device based on RabbitMQ.
[0017] The present invention solves the above technical problems through the following technical solutions:
[0018] A meteorological data transmission fault-tolerant method based on RabbitMQ, the method comprising:
[0019] The ship base reads regional meteorological data from the database; determines whether the weather is out of date, whether the weather area is abnormal, and whether the meteorological data is abnormal;
[0020] If yes, load the weather area, generate a random request number, and request the weather data of the specified area from the shore-based RabbitMQ server;
[0021] After receiving the meteorological data, determine whether the shore base returns the meteorological data normally;
[0022] If the shore-based meteorological data is returned normally, check whether the returned request number is consistent with the sent request number;
[0023] If the returned request number is consistent with the sent request number, the meteorological data is entered into the database.
[0024] Furthermore, the step of requesting meteorological data of a specified area from a shore-based RabbitMQ server includes: sending the generated request number and meteorological area data to the shore-based RabbitMQ server, and requesting meteorological data of a specified area from the shore-based RabbitMQ server.
[0025] Furthermore, if yes, the steps of loading the meteorological area, generating a random request number, and requesting the meteorological data of the designated area from the shore-based RabbitMQ server also include: entering the generated request number into the database.
[0026] Furthermore, the method also includes: if the shore-based system does not return the meteorological data normally, once again requesting the meteorological data of the designated area from the shore-based RabbitMQ server.
[0027] Furthermore, if the shore-based meteorological data is not returned normally, the step of requesting the shore-based RabbitMQ server for meteorological data of the designated area again also includes: entering the meteorological data returned abnormally into the database.
[0028] Furthermore, if the returned request number is consistent with the sent request number, the step of entering the meteorological data into the database further includes: performing meteorological display.
[0029] Furthermore, the method also includes: if the returned request number is inconsistent with the sent request number, requesting the designated area meteorological data from the shore-based RabbitMQ server again.
[0030] Furthermore, if the returned request number is inconsistent with the sent request number, the step of again requesting the designated area meteorological data from the shore-based RabbitMQ server also includes: entering information inconsistent with the sent request number into the database.
[0031] Furthermore, the method also includes: if the weather is not expired, the weather area is not abnormal, and the weather data is not abnormal, displaying the weather.
[0032] A meteorological data transmission fault-tolerant device based on RabbitMQ, comprising:
[0033] The data reading and judgment module is used for the ship to read regional meteorological data from the database; to judge whether the weather is expired, whether the weather area is abnormal, and whether the meteorological data is abnormal;
[0034] The request module is used to load the meteorological area when the weather is out of date, the meteorological area is abnormal, or the meteorological data is abnormal, generate a random request number, enter the generated request number into the database, and request the meteorological data of the specified area from the shore-based RabbitMQ server;
[0035] The returned data judgment module is used to judge whether the shore base returns the meteorological data normally after receiving the meteorological data;
[0036] The request number verification module is used to verify whether the returned request number is consistent with the sent request number when the shore-based meteorological data is returned normally;
[0037] The entry module is used to enter the meteorological data into the database when the returned request number is consistent with the sent request number.
[0038] The beneficial effects of the present invention are as follows: the present invention is based on RabbitMQ middleware, uses a request number to verify meteorological data, ensures that the meteorological data loaded in the specified area is reliable, confirmed and not lost, and avoids repeated processing of meteorological data; completes a fault-tolerant method for transmitting meteorological data through multiple judgments, provides accurate and reliable input data for meteorological display, and further ensures the reliability of meteorological data. The present invention can ensure that the received meteorological data is free of abnormalities, and can provide accurate and reliable input data for meteorological display. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of the steps of a RabbitMQ-based meteorological data transmission fault-tolerant method provided in an embodiment of the present invention.
[0040] Figure 2 A flowchart of a RabbitMQ-based fault-tolerant method for meteorological data transmission provided in an embodiment of the present invention.
[0041] Figure 3 A schematic diagram of a device for implementing a RabbitMQ-based fault-tolerant method for meteorological data transmission provided by an embodiment of the present invention.
[0042] Figure 4 A schematic diagram of the structure of a meteorological data transmission fault-tolerant device based on RabbitMQ provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The embodiments of the present invention will be described more clearly and completely below with reference to the accompanying drawings.
[0044] In view of the shortcomings of the prior art, the present invention proposes a meteorological data transmission fault-tolerant method and device based on RabbitMQ. The main purposes of the present invention are as follows:
[0045] When the ship-based client requests the shore-based RabbitMQ server for meteorological data of a specified area, in the event of an unexpected disconnection, it is necessary to prevent message loss, repeated processing, unreliable or unconfirmed messages, thereby affecting the transmission of meteorological data.
[0046] Firstly, an embodiment of the present invention provides a meteorological data transmission fault-tolerant method based on RabbitMQ.
[0047] like Figure 1 As shown, a meteorological data transmission fault-tolerant method based on RabbitMQ includes steps S1, S2, S3, S4 and S5:
[0048] Step S1, the ship base reads regional meteorological data from the database; determines whether the weather is expired, whether the meteorological area is abnormal, and whether the meteorological data is abnormal.
[0049] Step S2: If yes, load the meteorological area, generate a random request number, and request the meteorological data of the specified area from the shore-based RabbitMQ server.
[0050] Step S3, after receiving the meteorological data, determine whether the shore base returns the meteorological data normally.
[0051] Step S4: If the shore base returns the meteorological data normally, check whether the returned request number is consistent with the sent request number.
[0052] Step S5: If the returned request number is consistent with the sent request number, the meteorological data is entered into the database.
[0053] In step S2, the step of requesting meteorological data of a specified area from the shore-based RabbitMQ server includes: sending the generated request number and meteorological area data to the shore-based RabbitMQ server, and requesting meteorological data of the specified area from the shore-based RabbitMQ server.
[0054] Step S2 also includes: entering the generated request number into a database.
[0055] The RabbitMQ-based meteorological data transmission fault-tolerant method further includes: if the shore-based server does not return meteorological data normally, requesting the shore-based server for meteorological data of the designated area again. This step also includes: entering the meteorological data returned abnormally into the database.
[0056] Step S5 also includes: performing weather display.
[0057] The RabbitMQ-based meteorological data transmission fault-tolerant method further includes: if the returned request number is inconsistent with the sent request number, requesting the designated area meteorological data from the shore-based RabbitMQ server again. This step also includes: entering the information inconsistent with the sent request number into the database.
[0058] The meteorological data transmission fault-tolerant method based on RabbitMQ also includes: if the meteorological information is not expired, the meteorological area is not abnormal, and the meteorological data is not abnormal, the meteorological information is displayed.
[0059] The flowchart of the method of this embodiment is as follows Figure 2 shown.
[0060] The method of the embodiment of the present invention realizes the following functions:
[0061] 1. Based on the RabbitMQ message queue, weather loading is initiated through a randomly generated request number. The request number field in the received weather data is used to determine whether it is consistent with the sent request number, ensuring the confirmation and reliability of the message.
[0062] The request number method is used instead of the message confirmation mechanism. If the connection is disconnected after the message is sent to RabbitMQ, but the connection is reestablished before the message is confirmed, the producer will not send the message to the queue repeatedly, avoiding the problem of duplicate message processing.
[0063] If the message is not received, wait and request again until the request number is consistent with the request number of the received message to ensure that the message is not lost.
[0064] 2. Determine whether the display can be performed based on the prompt information field in the specified regional meteorological data entered into the database. If the prompt information is abnormal, re-initiate the regional meteorological loading, otherwise display the meteorological data, further ensuring the reliability of the message.
[0065] In the present invention, the shore-based system is mainly equipped with a shore-based satellite communication device, a RabbitMQ server and a weather clipping algorithm, which are used to receive navigation information sent by the ship-based system and return the weather data of the designated area.
[0066] In the present invention, the ship base is mainly equipped with a ship base satellite communication device and a weather display client, which is used to load and display weather data to assist the crew in making driving decisions.
[0067] The method of the present invention can be implemented by a device. Figure 3 As shown, the device includes a ship-based device 71, a shore-based device 72 and a ship-shore communication module.
[0068] The ship-based device 71 receives and sends the meteorological data of the designated area and performs data visualization through the ship-based meteorological loading client 76. The ship-based device 71 includes a ship-based satellite communication device 74 and a ship-based meteorological loading client 76.
[0069] The shore-based device 72 performs weather tailoring based on the received regional data and returns the weather data of the designated area. The shore-based device includes a shore-based satellite communication device 75, a shore-based RabbitMQ server 77, and a shore-based weather tailoring module 78.
[0070] The ship-shore communication module is used to realize information transmission between the ship-based device and the shore-based device. In this embodiment, it is a maritime communication satellite 73, which forms a complete satellite data transmission route with the ship-based satellite communication device 74 and the shore-based satellite communication device 75.
[0071] The method of the embodiment of the present invention ensures that the meteorological data loaded in the specified area is reliable, confirmed and not lost through the request number, thereby avoiding repeated processing of meteorological data.
[0072] The method of the embodiment of the present invention performs multiple judgments and checks on the meteorological data to further ensure the reliability of the meteorological data.
[0073] The method of the embodiment of the present invention is based on RabbitMQ middleware and uses the request number to verify the meteorological data; a fault-tolerant method for transmitting meteorological data is completed through multiple judgments, providing accurate and reliable input data for meteorological display.
[0074] In view of the shortcomings of the prior art, the present invention proposes a fault-tolerant method for meteorological data transmission based on RabbitMQ. Compared with the existing RabbitMQ message confirmation mechanism, in the event of an unexpected disconnection, it is impossible to ensure that meteorological data will not be lost, reliable, confirmable, and avoid repeated processing. The present invention can ensure that the received meteorological data is free of abnormalities and can provide accurate and reliable input data for meteorological display.
[0075] On the basis of the above-mentioned meteorological data transmission fault-tolerant method based on RabbitMQ, an embodiment of the present invention provides a meteorological data transmission fault-tolerant device based on RabbitMQ.
[0076] like Figure 4 As shown, a meteorological data transmission fault-tolerant device based on RabbitMQ comprises:
[0077] The data reading and judging module 10 is used for the ship to read regional meteorological data from the database; to judge whether the weather is expired, whether the weather area is abnormal, and whether the meteorological data is abnormal;
[0078] The request module 20 is used to load the meteorological area when the meteorological data is out of date, the meteorological area is abnormal, or the meteorological data is abnormal, generate a random request number, enter the generated request number into the database, and request the meteorological data of the specified area from the shore-based RabbitMQ server;
[0079] The returned data judgment module 30 is used to judge whether the shore base returns the meteorological data normally after receiving the meteorological data;
[0080] The request number verification module 40 is used to verify whether the returned request number is consistent with the sent request number when the shore base returns meteorological data normally;
[0081] The input module 50 is used to input the meteorological data into the database when the returned request number is consistent with the sent request number.
[0082] The request module 20 is also used to send the generated request number and the meteorological area data to the shore-based RabbitMQ server, and request the shore-based RabbitMQ server for the meteorological data of the specified area.
[0083] The request module 20 is further configured to enter the generated request number into a database.
[0084] The meteorological data transmission fault-tolerant device based on RabbitMQ also includes: a data re-request module, which is used to request the meteorological data of the specified area from the RabbitMQ server on the shore again when the shore-based meteorological data is not returned normally. The data re-request module is also used to enter the meteorological data returned abnormally into the database.
[0085] The input module 50 is also used for displaying weather information.
[0086] The meteorological data transmission fault-tolerant device based on RabbitMQ also includes a data re-request module, which is used to request the meteorological data of the specified area from the shore-based RabbitMQ server again when the returned request number is inconsistent with the sent request number. The data re-request module is also used to enter the information inconsistent with the sent request number into the database.
[0087] The meteorological data transmission fault-tolerant device based on RabbitMQ also includes: a normal data processing module, which is used to display the meteorological information when the meteorological information is not expired, the meteorological area is not abnormal, and the meteorological data is not abnormal.
[0088] The meteorological data transmission fault-tolerant device based on RabbitMQ provided in the embodiment of the present invention has the same technical features as the meteorological data transmission fault-tolerant method based on RabbitMQ provided in the embodiment of the present invention, and can solve the same technical problems and achieve the same technical effects. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0089] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A meteorological data transmission fault-tolerant method based on RabbitMQ, characterized in that: The method comprises: The ship base reads regional meteorological data from the database; determines whether the weather is out of date, whether the weather area is abnormal, and whether the meteorological data is abnormal; If yes, load the weather area, generate a random request number, and request the weather data of the specified area from the shore-based RabbitMQ server; After receiving the meteorological data, determine whether the shore base returns the meteorological data normally; If the shore-based meteorological data is returned normally, check whether the returned request number is consistent with the sent request number; If the returned request number is the same as the sent request number, the meteorological data is entered into the database.
2. The meteorological data transmission fault-tolerant method based on RabbitMQ as claimed in claim 1, characterized in that: The steps to request weather data for a specified area from the shore-based RabbitMQ server include: The generated request number and weather area data are sent to the shore-based RabbitMQ server, and the shore-based RabbitMQ server is requested to obtain weather data for the specified area.
3. The meteorological data transmission fault-tolerant method based on RabbitMQ as claimed in claim 1, characterized in that: If yes, the steps of loading the meteorological area, generating a random request number, and requesting the meteorological data of the specified area from the shore-based RabbitMQ server also include: Enter the generated request number into the database.
4. The meteorological data transmission fault-tolerant method based on RabbitMQ as claimed in claim 1, characterized in that: The method further comprises: If the shore-based server does not return weather data normally, the shore-based server will be requested to send weather data for the specified area again.
5. The RabbitMQ-based meteorological data transmission fault-tolerant method according to claim 4, characterized in that: If the shore-based meteorological data is not returned normally, the step of requesting the meteorological data of the designated area from the shore-based RabbitMQ server again also includes: entering the meteorological data returned abnormally into the database.
6. The meteorological data transmission fault-tolerant method based on RabbitMQ as claimed in claim 1, characterized in that: If the returned request number is consistent with the sent request number, the step of entering the meteorological data into the database also includes: performing meteorological display.
7. The RabbitMQ-based meteorological data transmission fault-tolerant method according to claim 1, characterized in that: The method further comprises: If the returned request number is inconsistent with the sent request number, the weather data for the specified area is requested again from the shore-based RabbitMQ server.
8. The RabbitMQ-based meteorological data transmission fault-tolerant method according to claim 7, characterized in that: If the returned request number is inconsistent with the sent request number, the step of requesting the shore-based RabbitMQ server for the specified area weather data again includes: Information inconsistent with the request number sent is entered into the database.
9. The RabbitMQ-based meteorological data transmission fault-tolerant method according to claim 1, characterized in that: The method further comprises: if the weather is not expired, the weather area is not abnormal, and the weather data is not abnormal, performing weather display.
10. A meteorological data transmission fault-tolerant device based on RabbitMQ, characterized in that: It includes: Data reading and judgment module, used for ship-based reading of regional meteorological data from the database; Determine whether the weather is out of date, whether the weather area is abnormal, and whether the weather data is abnormal; The request module is used to load the meteorological area when the weather is out of date, the meteorological area is abnormal, or the meteorological data is abnormal, generate a random request number, enter the generated request number into the database, and request the meteorological data of the specified area from the shore-based RabbitMQ server; The returned data judgment module is used to judge whether the shore base returns the meteorological data normally after receiving the meteorological data; The request number verification module is used to verify whether the returned request number is consistent with the sent request number when the shore-based meteorological data is returned normally; The entry module is used to enter the meteorological data into the database when the returned request number is consistent with the sent request number.
Citation Information
Patent Citations
Weather report system
CN105119959A
Ship route planning method and system, terminal and storage medium
CN111089591A
WEB service distributed intelligent monitoring method and device, computer equipment and storage medium
CN111385123A
Serialization processing result returning system and method based on http request
CN117591308A