A method and system for pushing transaction results of WeChat public account
By designing a method for pushing transaction results on WeChat public accounts, the judgment unit and retry mechanism are used to solve the problem of message push failure without retry due to network problems, improve the timeliness and system reliability of concurrent message push, and avoid excessive database pressure. Yamato delay failure.
Patent Information
- Application Number
- CN202011062249.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-09-30
AI Technical Summary
The existing WeChat official account transaction result push function can easily lead to messages loss or failure in network problems, lack of repeated push mechanisms, resulting in untimely message push and may cause excessive database pressure, resulting in delays or failures.
Design a WeChat public account transaction result push method, including message production, message processing module, server, consumer module, WeChat public account message interface module and storage module. The judgment unit determines whether the message is sent successfully. If it fails, the message is saved in library and push again to ensure that the message can be retried.
It solves the problem of message push failure without retry due to network problems, improves the timeliness of concurrent message push, enhances the reliability of the system and database processing capabilities, and avoids excessive database pressure and delay failures.
Smart Images

Figure CN112182466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of WeChat message sending and processing, and in particular to a method and system for pushing transaction results of a WeChat public account. Background Art
[0002] Currently, the transaction result push function of merchants’ WeChat official accounts is relatively weak. Messages are easily lost during the push process, resulting in unsuccessful push, or there is no repeated push mechanism when the push fails, resulting in a lack of message push.
[0003] The other method is to push messages and save them into the database. Another thread continuously queries and updates data in a loop. The single-threaded message processing is too slow, causing messages to pile up in the database and resulting in untimely push. The database is a single point and may have single point failures. If the message is too large during concurrent read and write processing, delays and other failures may occur, which can easily cause excessive pressure on database reading, writing and deletion. The disk io is too high, causing the entire process to take longer and messages cannot be pushed in time. Summary of the invention
[0004] In order to overcome the deficiencies of the prior art, a WeChat public account transaction result push method and system of the present invention can solve the problem that the current message push fails due to various network problems and is not pushed again.
[0005] The technical solution adopted by the present invention to solve the technical problem is: a method for pushing transaction results of a WeChat public account, the improvement of which is that it includes the following steps:
[0006] S1: Message generation and sending transaction results to the message processing module;
[0007] S2: The message processing module assembles and processes the transaction result information and pushes the processing result to the server. If the message push fails or the network is abnormal, the message is saved in the database and waits for the failed message to be pushed again;
[0008] S3: The server responds to the message and pushes it to the consumer module. The consumer module pushes the message to the WeChat public account message push interface and returns the push result to the judgment unit of the message processing module for judgment.
[0009] S4: If the message is pushed successfully, the operation ends;
[0010] S5: If the message push fails or the network is abnormal, the consumer module will respond to the server, and the server will push the message to the consumer module again based on idempotence.
[0011] As an improvement of the above technical solution, in step S1, when the transaction result is sent to the message processing module, if the judgment unit of the message processing module determines that the sending is unsuccessful, the failed message will be pushed again, and the message that failed to be pushed will be stored in the database.
[0012] As a further improvement of the above technical solution, in step S2, when the message processing module pushes the processing result to the server, if the judgment unit of the message processing module determines that the sending is unsuccessful, the failed message will be pushed again, and the message that failed to be pushed will be stored in the database.
[0013] As a further improvement of the above technical solution, in step S3, when the server pushes the message to the consumer module, if the judgment unit of the server determines that the sending is unsuccessful, the failed message is pushed again.
[0014] As a further improvement of the above technical solution, in step S4, the WeChat public account message interface module will respond to the message push result. If the judgment unit of the WeChat public account message interface module determines that the message push is successful, the operation is terminated. If it is determined that the message push fails or the network is abnormal, the server loads the failed push message and pushes it again.
[0015] As a further improvement of the above technical solution, the judgment unit of the WeChat public account message interface module, the judgment unit of the message processing module and the judgment unit of the server are all the same judgment unit.
[0016] As a further improvement of the above technical solution, the server is a RockrtMQServer server.
[0017] As a further improvement of the above technical solution, the consumer module is provided with a link channel for pulling consumption information from the server.
[0018] A WeChat public account transaction result push system, the improvement of which is that it includes a production system, a message processing module, a server, a consumer module, a WeChat public account message interface module, a storage module and a judgment unit, wherein the production system, the message processing module, the server and the WeChat public account message interface module are connected in sequence;
[0019] The production system includes multiple production units, and the multiple production units are used to produce information. The message processing module is used to assemble and process the transaction result information and push the processing results to the server. The server is used to respond to the message and push the message to the consumer module. The consumer module is used to receive the message sent by the server or to automatically pull the message from the server. The WeChat public account message interface module is used to receive the message from the consumer module and push the message to the public account interface. The judgment unit is used to judge whether the message sending of the production system, message processing module, server, consumer module and WeChat public account message interface module is successful. The storage module is used to store the message that failed to send.
[0020] The beneficial effects of the present invention are: it can solve the problem that the current message push fails due to various network problems and is not pushed again, solve the problem of a single database processing data, improve the timeliness of concurrent message push, and improve the reliability of the message production and message consumption push retry mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is the overall process framework diagram of the present invention. DETAILED DESCRIPTION
[0022] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0023] The following will clearly and completely describe the concept, specific structure and technical effects of the present invention in combination with the embodiments and drawings, so as to fully understand the purpose, characteristics and effects of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, other embodiments obtained by technicians in this field without creative work are all within the scope of protection of the present invention. In addition, all the connection / connection relationships involved in the patent do not refer to the direct connection of components, but refer to the formation of a better connection structure by adding or reducing connection accessories according to the specific implementation situation. The various technical features in the invention can be combined interchangeably without conflicting with each other.
[0024] refer to Figure 1 The present invention discloses a method for pushing transaction results of a WeChat public account, comprising the following steps:
[0025] S1: Message generation and sending transaction results to the message processing module;
[0026] S2: The message processing module assembles and processes the transaction result information and pushes the processing result to the server. If the message push fails or the network is abnormal, the message is saved in the database and waits for the failed message to be pushed again;
[0027] S3: The server responds to the message and pushes it to the consumer module. The consumer module pushes the message to the WeChat public account message push interface and returns the push result to the judgment unit of the message processing module for judgment.
[0028] S4: If the message is pushed successfully, the operation ends;
[0029] S5: If the message push fails or the network is abnormal, the consumer module will respond to the server, and the server will push the message to the consumer module again based on idempotence.
[0030] In the above embodiment, in step S1, when the transaction result is sent to the message processing module, if the judgment unit of the message processing module determines that the sending is unsuccessful, the failed message will be pushed again, and the message that failed to be pushed will be stored in the library; in step S2, when the message processing module pushes the processing result to the server, if the judgment unit of the message processing module determines that the sending is unsuccessful, the failed message will be pushed again, and the message that failed to be pushed will be stored in the library; in step S3, when the server pushes the message to the consumer module, if the judgment unit of the server determines that the message sending is unsuccessful, the failed message will be pushed again; in step S4, the WeChat public account message interface module will respond to the message push result. If the judgment unit of the WeChat public account message interface module determines that the message push is successful, the operation is terminated. If it is determined that the message push fails or the network is abnormal, the server loads the message that failed to be pushed and pushes it again. The judgment unit of the WeChat public account message interface module, the judgment unit of the message processing module, and the judgment unit of the server are all the same judgment unit.
[0031] The message processing module of the present invention includes multiple message processing units. When the consumption result messages are collected into the message processing module, each message processing unit assembles and processes the transaction result information and pushes the processing results to the server, so as to avoid the system crash when the data is too large when all message data are concentrated in a large environment for processing.
[0032] The consumer module of the present invention includes multiple consumer units, and the messages sent by the server are stored in the consumer units for processing, so as to avoid the system crash when the data is too large when all message data are concentrated in a large environment for processing. The messages are divided into each consumer unit for separate processing, so that even if an error occurs, the message processing process of other consumer units will not be affected, and the maintenance personnel are prevented from finding the wrong consumer unit like looking for a needle in a haystack, which can save time and avoid causing the whole system to crash. The consumer unit is used to automatically pull messages from the server. The problem of processing data in a single database is solved, and the timeliness of concurrent message push is improved.
[0033] Each production unit system of the present invention produces a message and sends the transaction result to the message processing module. The message processing module assembles and processes the message and pushes the processed message to the server. The server responds to the message and sends the processed message to the consumer module, or the consumer module actively pulls the message from the server. The consumer module returns the push result to the server to determine whether the message is sent successfully, and pushes it to the WeChat public account message interface module on the other hand:
[0034] When the consumer module returns the push result to the RocketMQ Server, the judgment unit judges the message push result. If the message push fails or the network is abnormal, the message is saved to the storage module. The RocketMQ Server loads the failed push message and pushes it again. If successful, it ends.
[0035] When the consumer module pushes to the WeChat public account message interface module, the WeChat public account message interface module responds to the push result and judges the message push result through the judgment unit. If the response to the consumer message is successful, it ends, or if the response to the consumer message fails, it responds to the consumer message again according to idempotence. This can solve the problem that the current message push fails due to various network problems and is not pushed again.
[0036] Furthermore, the server is a RockrtMQServer server. RocketMQ is a distributed messaging platform with low latency, high performance and reliability, trillion-level capacity and flexible scalability, and a message failure retry mechanism to meet the needs of message resending in this system.
[0037] Furthermore, the consumer module is provided with a link channel for pulling consumption information from the server. The consumer module can push the consumption information to the WeChat public account message interface module. The WeChat public account message module displays advertising content to users from time to time to meet the needs of merchants using the system to push advertisements and promote consumption. Moreover, pushing advertisements to users through the WeChat public account message interface module can allow users to understand currently popular products and improve the user experience.
[0038] A WeChat public account transaction result push system includes a production system, a message processing module, a server, a consumer module, a WeChat public account message interface module, a storage module and a judgment unit. The production system, the message processing module, the server and the WeChat public account message interface module are connected in sequence. The production system includes multiple production units, and the multiple production units are used to produce information. The message processing module is used to assemble and process the transaction result information and push the processing result to the server. The server is used to respond to the message and push the message to the consumer module. The consumer module is used to receive the message sent by the server or to automatically pull the message from the server. The WeChat public account message interface module is used to receive the message of the consumer module and push the message to the public account interface. The judgment unit is used to judge whether the message sending of the production system, the message processing module, the server, the consumer module and the WeChat public account message interface module is successful. The storage module is used to store the message that failed to send.
[0039] The message processing module of the present invention includes multiple message processing units. When the consumption result messages are collected into the message processing module, each message processing unit assembles and processes the transaction result information and pushes the processing results to the server, so as to avoid the system crash when the data is too large when all message data are concentrated in a large environment for processing.
[0040] The consumer module of the present invention includes multiple consumer units, and the messages sent by the server are stored in the consumer units for processing, so as to avoid the system crash when the data is too large when all message data are concentrated in a large environment for processing. The messages are divided into each consumer unit for separate processing, so that even if an error occurs, the message processing process of other consumer units will not be affected, and the maintenance personnel are prevented from finding the wrong consumer unit like looking for a needle in a haystack, which can save time and avoid causing the whole system to crash. The consumer unit is used to automatically pull messages from the server. The problem of processing data in a single database is solved, and the timeliness of concurrent message push is improved.
[0041] In the above embodiment, each production unit system produces a message and sends the transaction result to the message processing module. The message processing module assembles and processes the message and pushes the processed message to the RocketMQ Server. The RocketMQ Server responds to the message and sends the processed message to the consumer module, or the consumer module actively pulls the message from the RocketMQ Server. The consumer module returns the push result to the RocketMQ Server and pushes it to the WeChat public account message interface module:
[0042] When the consumer module returns the push result to the RocketMQ Server, the judgment unit judges the message push result. If the message push fails or the network is abnormal, the message is saved to the storage module. The RocketMQ Server loads the failed push message and pushes it again. If successful, it ends.
[0043] When the consumer module pushes to the WeChat public account message interface module, the WeChat public account message interface module responds to the push result and judges the message push result through the judgment unit. If the response to the consumer message is successful, it ends, or if the response to the consumer message fails, it responds to the consumer message again according to idempotence. This can solve the problem that the current message push fails due to various network problems and is not pushed again.
[0044] When a message is sent to RocketMQ Server, if a failure occurs, it will be automatically resent. The default retry is three times. For the retry of the consumer module, if the message is not consumed successfully for various reasons, generally due to network problems, it will be automatically added to the retry queue.
[0045] The beneficial effects of the present invention are: it can solve the problem that the current message push fails due to various network problems and is not pushed again, solve the problem of a single database processing data, improve the timeliness of concurrent message push, and improve the reliability of the message production and message consumption push retry mechanism.
[0046] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for pushing transaction results of a WeChat public account, characterized in that: The method is applied to a WeChat public account transaction result push system, which includes a production system, a message processing module, a server, a consumer module, a WeChat public account message interface module, a storage module and a judgment unit, wherein the production system, the message processing module, the server and the WeChat public account message interface module are connected in sequence; The production system includes multiple production units, and the multiple production units are used to produce information. The message processing module is used to assemble and process the transaction result information and push the processing result to the server. The server is used to respond to the message and push the message to the consumer module. The consumer module is used to receive the message sent by the server or to automatically pull the message from the server. The WeChat public account message interface module is used to receive the message of the consumer module and push the message to the public account interface. The judgment unit is used to judge whether the message sending of the production system, the message processing module, the server, the consumer module and the WeChat public account message interface module is successful. The storage module is used to store the message that failed to be sent; The method comprises the following steps: S1: Message generation and sending transaction results to the message processing module; In step S1, when the transaction result is sent to the message processing module, if the judgment unit of the message processing module judges that the sending is unsuccessful, the failed message is pushed again, and the message that failed to be pushed is stored in the database; S2: The message processing module assembles and processes the transaction result information and pushes the processing result to the server. If the message push fails or the network is abnormal, the message is saved in the database and waits for the failed message to be pushed again; In step S2, when the message processing module pushes the processing result to the server, if the judgment unit of the message processing module judges that the sending is unsuccessful, the failed message will be pushed again, and the message that failed to be pushed will be stored in the database; S3: The server responds to the message and pushes it to the consumer module. The consumer module pushes the message to the WeChat public account message push interface and returns the push result to the judgment unit of the message processing module for judgment. S4: If the message is pushed successfully, the operation ends; S5: If the message push fails or the network is abnormal, the consumer module will respond to the server, and the server will push the message to the consumer module again with idempotence. The judgment unit of the WeChat public account message interface module, the judgment unit of the message processing module and the judgment unit of the server are all the same judgment unit.
2. A WeChat public account transaction result push method according to claim 1, characterized in that: In step S4, the WeChat public account message interface module will respond to the message push result. If the judgment unit of the WeChat public account message interface module determines that the message push is successful, the operation is terminated. If it is determined that the message push fails or the network is abnormal, the server loads the failed push message and pushes it again.
3. A WeChat public account transaction result push method according to claim 1, characterized in that: In step S3, when the server pushes the message to the consumer module, if the judgment unit of the server determines that the sending is unsuccessful, the failed message is pushed again.
4. A WeChat public account transaction result push method according to claim 1, characterized in that: The server is a RockrtMQServer server.
5. A WeChat public account transaction result push method according to claim 1, characterized in that: The consumer module is provided with a link channel that can pull consumption information from the server.
Citation Information
Patent Citations
Distributed high-concurrent message queue pushing system
CN108874562A