Methods, apparatus, storage media and electronic devices for message backflow processing
By pre-setting logic processing and message feedback strategies for business messages from home appliances, a message queue to be fed back is generated, which solves the problem of data processing failure caused by out-of-order ETL real-time stream messages, and enables continued processing and anomaly analysis of business messages from home appliances.
Patent Information
- Application Number
- CN202310281995.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-03-21
AI Technical Summary
In existing technologies, out-of-order ETL real-time stream messages from home appliances cause data processing failures, making it impossible to continue processing business messages.
Business messages are processed by pre-defined business logic, a message queue to be returned is generated, and a message return strategy is used to return messages that fail to be processed until success is achieved.
It enables continued processing of business messages from home appliances, resolves the data processing failure issue caused by out-of-order messages, and supports problem tracing and anomaly analysis.
Smart Images

Figure CN116418613B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to a message feedback processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] Currently, as the level of intelligence of home appliances in the smart home appliance field increases, the functions provided by these appliances are becoming more and more diversified. This brings with it the problem of how to process the increasing number of business messages from home appliances. In general technical solutions, due to the order dependency of messages in ETL real-time streams, if the input messages are out of order when processing messages from different ETL real-time streams of home appliances, it will cause data processing failure, which may lead to the inability to continue processing the business messages of home appliances.
[0003] Therefore, in related technologies, there is a problem of how to perform backflow processing on business messages that have failed to be processed, so as to enable the continued processing of business messages for home appliances.
[0004] There is currently no effective solution to the problem of how to reprocess failed business messages in order to continue processing business messages for home appliances. Summary of the Invention
[0005] This application provides a message reflow processing method, apparatus, storage medium, and electronic device to at least solve the problem in the related art of how to reflow failed business messages, thereby enabling continued processing of business messages for home appliances.
[0006] According to one embodiment of this application, a message reflow processing method is provided, comprising: performing business processing on a business message according to preset business logic to obtain a processing result; wherein the business message originates from the communication service of a home appliance; determining a business message whose processing result indicates processing failure as a message to be reflowed; generating a message queue to be reflowed based on the message to be reflowed, and using a message reflow strategy to reflow the message queue to be reflowed to obtain a reflowed message; and performing business processing on the reflowed message.
[0007] In an exemplary embodiment, before determining a service message whose processing result indicates processing failure as a message to be returned, the method further includes: obtaining a service flag corresponding to the service message, wherein the service flag corresponds to a flag value indicating whether the service message was successfully processed; obtaining a target flag value consistent with a first preset value from the processing result, wherein the processing result includes: flag values of service identifiers corresponding to all service messages respectively, the first preset value indicating that the service message corresponding to the first preset value failed to process; and determining the service message corresponding to the target flag value as the service message whose processing result indicates processing failure.
[0008] In an exemplary embodiment, before using a message rewinding strategy to rewind messages in the message queue to be rewinded, the method further includes: parsing the message queue to be rewinded, determining the rewinding instance corresponding to the message to be rewinded, and determining the rewinding strategy corresponding to the instance name of the rewinding instance as the message rewinding strategy.
[0009] In an exemplary embodiment, using a message reflow strategy to reflow messages in the message queue includes: obtaining a preset reflow count for the target object of the reflow instance from the message reflow strategy, and obtaining the reflow completion count corresponding to the reflow instance from the instance data of the reflow instance; and reflowing the messages in the message queue according to the preset reflow count and the reflow completion count.
[0010] In an exemplary embodiment, rewinding messages to be rewound in the rewind message queue according to the preset rewind count and the rewind completion count includes: comparing the preset rewind count and the rewind completion count; if the preset rewind count is greater than the rewind completion count, obtaining a first difference between the preset rewind count and the rewind completion count; determining the rewind interval time of the rewind instance in the next rewind based on the first difference; and rewinding the messages to be rewound corresponding to the rewind instance at the rewind start time, wherein the rewind start time of the next rewind instance is the sum of the current rewind time of the rewind instance and the rewind interval time.
[0011] In an exemplary embodiment, determining the reflow interval time of the reflow instance in the next reflow based on the first difference includes: if the first difference is less than a second preset value, obtaining a second difference between the first difference and the second preset value; obtaining a time range corresponding to the first difference; obtaining an interval time corresponding to the second difference from the time range corresponding to the first difference, and determining the interval time corresponding to the second difference as the reflow interval time of the reflow instance in the next reflow; if the first difference is greater than or equal to the second preset value, determining the largest interval time within the time range corresponding to the first difference as the reflow interval time of the reflow instance in the next reflow.
[0012] In an exemplary embodiment, after obtaining the reflow message, the method further includes: if the preset reflow count is equal to the reflow completion count, determining the query interface corresponding to the reflow message, wherein the query interface is used to query the processing result obtained after performing business processing on the reflow message; and if a query instruction is received from the target object, calling the query interface according to the query instruction, and sending the query data obtained through the query interface to the target object.
[0013] In an exemplary embodiment, generating a message queue to be reflowed based on the message to be reflowed includes: responding to an execution instruction sent by a target object, wherein the execution instruction is used to execute a timed task corresponding to the reflow instance according to a preset period; after the execution instruction is completed, determining the target reflow message obtained within the preset period, and generating a sub-message queue corresponding to the target reflow message; merging multiple sub-message queues to obtain the message queue to be reflowed.
[0014] In an exemplary embodiment, after determining the reflow instance corresponding to the message to be reflowed, the method further includes: obtaining configuration information preset by the target object for the reflow instance, wherein the configuration information includes a message transmission interface for transmitting the message to be reflowed; upon receiving a start instruction from the target object, creating a message client for the message queue corresponding to the message to be reflowed according to the start instruction, and sending the message client to the target object using the message transmission interface, so that the target object can use the message client to query the message to be reflowed; upon receiving a close instruction from the target object, closing the created message client according to the close instruction, and upon determining that the created message client has been successfully closed, sending a prompt message to the target object, wherein the prompt message is used to indicate to the target object that the created message client has been successfully closed.
[0015] In one exemplary embodiment, sending the message client to the target object using the message transmission interface includes: obtaining a first message middleware type used by the message transmission interface; and, if it is determined that the first message middleware type is a message middleware type supported by the message client, sending the message client to the target object using the message transmission interface, wherein the message client supports different message middleware types.
[0016] In an exemplary embodiment, after performing business processing on the reflowed message, the method further includes: in response to a query instruction from a target object, determining a reflow processing result for performing business processing on the reflowed message; if the reflow processing result indicates that the reflowed message processing failed, storing the failed reflowed message and establishing a correspondence between the failed reflowed message and its storage address; and sending the correspondence to the target object.
[0017] According to another embodiment of the present application, a message reflow processing apparatus is also provided, comprising: an obtaining module, configured to perform business processing on a business message according to preset business logic to obtain a processing result; wherein the business message originates from the communication service of a home appliance; a determining module, configured to determine a business message whose processing result indicates processing failure as a message to be reflowed; a reflow module, configured to generate a message queue to be reflowed based on the message to be reflowed, and use a message reflow strategy to reflow the message queue to be reflowed to obtain a reflowed message; and a processing module, configured to perform business processing on the reflowed message.
[0018] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described message reflow processing method when it is run.
[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described message reflow processing method through the computer program.
[0020] In this embodiment, business messages are processed according to preset business logic to obtain processing results; wherein, the business messages originate from the communication services of home appliances; business messages whose processing results indicate processing failure are identified as messages to be returned; a message queue to be returned is generated based on the messages to be returned, and a message return strategy is used to return the messages to be returned in the message queue to obtain returned messages; business processing is performed on the returned messages; by adopting the above technical solution, the problem of how to return failed business messages is solved, thereby realizing the continued processing of business messages of home appliances, and thus realizing the continued processing process of business messages of home appliances. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of the hardware environment for a message backflow processing method according to an embodiment of this application.
[0024] Figure 2 This is a flowchart of a message reflow processing method according to an embodiment of this application;
[0025] Figure 3 This is a schematic diagram illustrating the implementation logic of a message reflow processing method according to an embodiment of this application;
[0026] Figure 4 This is a schematic diagram illustrating the number of retries according to an embodiment of this application;
[0027] Figure 5 This is a structural block diagram of a message reflow processing apparatus according to an embodiment of this application. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] Next, some technical terms in the embodiments of this application will be explained through the following examples:
[0031] MQ stands for Message Queue, a message queue middleware used to provide functions such as message subscription, storage, and publishing, such as Kafka and RocketMQ. Some types of MQ clients only support a limited number of repeated deliveries.
[0032] Real-time computing frameworks, such as Flink and Spark, perform data ETL processing on real-time consumed messages.
[0033] ETL: Used to describe the process of extracting, transforming, and loading data from the source to the destination.
[0034] According to one aspect of the embodiments of this application, a message reflow processing method is provided. This message reflow processing method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned message reflow processing method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0035] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0036] This embodiment provides a message reflow processing method, applied to the aforementioned computer terminal. Figure 2 This is a flowchart of a message reflow processing method according to an embodiment of this application, the process including the following steps:
[0037] Step S202: Process the business message according to the preset business logic to obtain the processing result; wherein, the business message originates from the communication service of the home appliance.
[0038] It should be noted that the aforementioned preset business logic corresponds to the message type of the business message, which can be preset manually. Message types may include, for example, text, audio, and video.
[0039] The process of processing business messages according to preset business logic, as described above, can include determining whether a business message is empty. Furthermore, for text-type business messages, it can determine whether they are complete statements; for audio-type business messages, it can determine whether they play correctly; and for video-type business messages, it can determine whether the video is valid, etc.
[0040] Step S204: The business message indicating processing failure is identified as a message to be returned;
[0041] Step S206: Generate a message queue to be reflowed based on the message to be reflowed, and use a message reflow strategy to reflow the message to be reflowed in the message queue to obtain the reflowed message;
[0042] Step S208: Perform business processing on the returned message.
[0043] Through the above steps, business messages are processed according to preset business logic to obtain processing results; wherein, the business messages originate from the communication services of home appliances; business messages whose processing results indicate processing failure are identified as messages to be returned; a message queue to be returned is generated based on the messages to be returned, and a message return strategy is used to return the messages to be returned in the message queue to obtain returned messages; business processing is performed on the returned messages, thus solving the problem in related technologies of how to return failed business messages to be processed, thereby enabling the continued processing of business messages of home appliances, and thus realizing the continued processing process of business messages of home appliances.
[0044] Furthermore, after executing the above step S208, if it is determined that the processing result of the returned message after business processing is still abnormal, the abnormal result is persistently stored to trace the source of the problem and analyze the cause of the abnormality.
[0045] In an exemplary embodiment, before determining a business message whose processing result indicates processing failure as a message to be returned, a technical solution is provided, the specific steps of which include: obtaining a business flag corresponding to the business message, wherein the business flag corresponds to a flag value used to indicate whether the business message was processed successfully; obtaining a target flag value consistent with a first preset value from the processing result, wherein the processing result includes: flag values of business identifiers corresponding to all business messages respectively, the first preset value indicating that the business message corresponding to the first preset value has failed to process; and determining the business message corresponding to the target flag value as the business message whose processing result indicates processing failure.
[0046] The reasons for the failure of the above-mentioned business message processing may include, for example, program processing failure or data query failure, but are not limited thereto, and this application does not impose any restrictions on this.
[0047] In an exemplary embodiment, further, before using the message rewinding strategy to rewind the messages to be rewinded in the message rewinding queue, the following technical solution can be provided, the specific steps of which include: parsing the message rewinding information in the rewinding message queue, determining the rewinding instance corresponding to the message to be rewinded; and determining the rewinding strategy corresponding to the instance name of the rewinding instance as the message rewinding strategy.
[0048] Optionally, there can be multiple reflow instances corresponding to the message to be reflowed. Different reflow instances correspond to different MQ middlewares and have different instance names. The instance name of the required reflow instance can be determined according to the type of MQ middleware, and then the required reflow instance can be determined from the multiple reflow instances corresponding to the message to be reflowed.
[0049] In an exemplary embodiment, a technical solution is proposed for using a message reflow strategy to reflow messages in the message queue to be reflowed. The specific steps include: obtaining a preset number of reflows for the target object of the reflow instance from the message reflow strategy, and obtaining the number of reflow completions corresponding to the reflow instance from the instance data of the reflow instance; and reflowing the messages in the message queue to be reflowed according to the preset number of reflows and the number of reflow completions.
[0050] In an exemplary embodiment, the following execution steps are proposed for implementing the process of rewinding messages to be rewinded in the rewind message queue according to the preset rewind count and the rewind completion count, specifically including: comparing the preset rewind count and the rewind completion count; if the preset rewind count is greater than the rewind completion count, obtaining a first difference between the preset rewind count and the rewind completion count; determining the rewind interval time of the rewind instance in the next rewind based on the first difference; and rewinding the messages to be rewinded corresponding to the rewind instance at the rewind start time, wherein the rewind start time of the next rewind instance is the sum of the current rewind time of the rewind instance and the rewind interval time.
[0051] It should be noted that the larger the first difference mentioned above, the more times the reflow occurs and the longer the reflow interval.
[0052] In an exemplary embodiment, to better understand the technical solution of determining the reflow interval time of the reflow instance in the next reflow based on the first difference, the following technical solution is proposed, specifically including: when the first difference is less than a second preset value, obtaining a second difference between the first difference and the second preset value; obtaining the time value range corresponding to the first difference; obtaining the interval time corresponding to the second difference from the time value range corresponding to the first difference, and determining the interval time corresponding to the second difference as the reflow interval time of the reflow instance in the next reflow; when the first difference is greater than or equal to the second preset value, determining the largest interval time in the time value range corresponding to the first difference as the reflow interval time of the reflow instance in the next reflow.
[0053] In an exemplary embodiment, after receiving the reflow message, the following steps can be further implemented: when the preset reflow count is equal to the reflow completion count, a query interface corresponding to the reflow message is determined, wherein the query interface is used to query the processing result obtained after performing business processing on the reflow message; when a query instruction is received from the target object, the query interface is called according to the query instruction, and the query data obtained through the query interface is sent to the target object.
[0054] Furthermore, through the above steps, if the preset number of reflows is equal to the number of reflow completions, the reflow can be determined to be complete, and then the query interface corresponding to the reflow message after the reflow can be determined.
[0055] In an exemplary embodiment, to better understand how to implement the process of generating a backflow message queue based on the backflow message, an execution instruction sent by the target object can be responded to. The execution instruction is used to execute the timed task corresponding to the backflow instance according to a preset period. After the execution instruction is completed, the target backflow message obtained within the preset period is determined, and a sub-message queue corresponding to the target backflow message is generated. Multiple sub-message queues are merged to obtain the backflow message queue.
[0056] In an exemplary embodiment, further, after determining the reflow instance corresponding to the message to be reflowed, a technical solution is further proposed, specifically including: obtaining configuration information preset by the target object for the reflow instance, wherein the configuration information includes a message transmission interface for transmitting the message to be reflowed; upon receiving a start instruction from the target object, creating a message client for the message queue corresponding to the message to be reflowed according to the start instruction, and sending the message client to the target object using the message transmission interface, so that the target object can use the message client to query the message to be reflowed; upon receiving a close instruction from the target object, closing the created message client according to the close instruction, and upon determining that the created message client has been successfully closed, sending a prompt message to the target object, wherein the prompt message is used to prompt the target object that the created message client has been successfully closed.
[0057] In one exemplary embodiment, sending the message client to the target object using the message transmission interface includes: obtaining a first message middleware type used by the message transmission interface; and, if it is determined that the first message middleware type is a message middleware type supported by the message client, sending the message client to the target object using the message transmission interface, wherein the message client supports different message middleware types.
[0058] It should be noted that, in one embodiment, the above-mentioned message middleware type may be provided in the form of an SDK (Software Development Kit).
[0059] For example, a unified interface for sending and receiving messages in a message middleware can be defined using the following procedure:
[0060]
[0061]
[0062] Furthermore, the message middleware factory is provided as follows: it can obtain the message middleware model object based on the input message middleware type:
[0063]
[0064]
[0065] Alternatively, we can use Kafka message middleware as an example to illustrate different middleware:
[0066] ① Kafka consumers
[0067]
[0068]
[0069]
[0070] In an exemplary embodiment, after performing business processing on the reflowed message, the method further includes: in response to a query instruction from a target object, determining a reflow processing result for performing business processing on the reflowed message; if the reflow processing result indicates that the reflowed message processing failed, storing the failed reflowed message and establishing a correspondence between the failed reflowed message and its storage address; and sending the correspondence to the target object.
[0071] In the above embodiments, the storage method for the return message after the storage processing fails may include persistent storage or temporary storage. As for the storage location, it may be local or cloud server, and this application does not limit it.
[0072] To better understand the process of the above message reflow processing method, the implementation flow of the above message reflow processing method will be described below in conjunction with optional embodiments, but it is not intended to limit the technical solution of the embodiments of this application.
[0073] This embodiment provides a message reflow processing method. Figure 3 This is a schematic diagram of a message reflow processing method according to an embodiment of this application, as shown below. Figure 3 As shown, it contains 5 modules:
[0074] Module 1, reflux-config, is a message recirculation strategy configuration module used to provide message recirculation strategy query, configuration, and start / stop functions. After a recirculation instance is started or stopped: it notifies reflux-processor to create or destroy the message consumption client for that recirculation instance; and it notifies reflux-scheduler to create or destroy the message sending client for that recirculation instance.
[0075] Module 2, reflux-core, is the core module of the message reflux system. It provides a unified interface for message consumption and production, enabling different types of MQ middleware to send and receive messages. It is provided as an SDK.
[0076] Module 3, reflux-processor, is the message reflow system processing module. It listens for messages to be reflowed from business processes, determines whether the message needs to be reflowed based on the reflow strategy, calculates the time of the next reflow, and persists the data to the database. Message consumption relies on the unified message consumption interface provided by reflux-core.
[0077] Module 4, reflux-scheduler, is the reflux message sending scheduler module. It is used to continuously query messages waiting to be refluxed and push them to the message queue (MQ). Message push relies on the unified message production interface provided by reflux-core.
[0078] Module 5, reflux-search, is a problem tracing module used to support the retrieval of data that has failed to be processed properly after exceeding the number of reflow attempts, for use in problem tracing.
[0079] The specific implementation process is as follows:
[0080] Step 1: In the upstream message queue, the original upstream business message is as follows:
[0081] 1{
[0082] 2 “k1”: “v1”
[0083] 3 “k2”: “v2”
[0084] 4 “k3”: “v3”
[0085] 5}.
[0086] Step 2, business logic processing, which means starting to consume messages from the message queue in Step 1 and performing business processing.
[0087] Step 3: Confirm successful business processing.
[0088] Step 4: Determine if the business processing failed, encapsulate the original message into a return message, and then push it to the message queue in Step 5.
[0089] It should be noted that other data relied upon in step 2 may fail to process due to delays, inability to find processing results, or abnormal program processing.
[0090] In one embodiment, the procedure for encapsulating the original message into a data return message body (i.e., the message to be returned mentioned above) is as follows:
[0091] 1{
[0092] 2 “id”:“sdfsdf”
[0093] 3 “msgId”:“”
[0094] 4 "message":"[\"header\":{\"k1\":\"v1\",\"k2\":\"v2\",\""k3)\":\"v3\"},\"payload\":{}}",
[0095] 5 “timestamp”:234234234,
[0096] 6"caseName":"biz reflux"
[0097] 7}.
[0098] Step 5: Store the callback message pushed after the business processing fails.
[0099] Step 6: The message backflow system consumes the message msg to be backflowed from the message queue in Step 5.
[0100] Step 7: Parse the message to be reflowed (msg) to obtain the reflow instance name (caseName) and the original message body (message).
[0101] Step 8: Based on the reflow instance name caseName parsed in Step 7, query the reflow policy cache, obtain the reflow policy configuration of the reflow instance, and calculate the maximum number of reflows for the reflow instance.
[0102] Step 9: Calculate the number of reflows: Parse the number of times the message has been reflowed from the message body to be reflowed, i.e., reflux.times. The message body to be reflowed is shown below:
[0103] 1{
[0104] 2 “id”:“sdfsdf”
[0105] 3 “msgId”:“”
[0106] 4 "message":"[\"header\":{\"k1\":\"v1\",\"k2\":\"v2\",\""k3)\":\"v3\"},\""reflux.times\":1, payload\":{}}",
[0107] 5 “timestamp”:234234234,
[0108] 6 "caseName":"biz reflux"
[0109] 7}.
[0110] Step 10: Based on the number of reflows calculated in Step 9 and the upper limit of the number of reflows calculated in Step 8, determine whether further reflows are needed.
[0111] Step 11: If further reflow is required, calculate the next reflow time and persist it to the database: Calculate the next reflow time based on the reflow strategy obtained in Step 8, and then add 1 to the reflow count calculated in Step 9 and backfill it into the original message. The final structure persisted to the database is shown below:
[0112] 1{
[0113] 2 “id”:“sdfsdf”
[0114] 3 “msgId”:“”
[0115] 4 "message":"[\"header\":{\"k1\":\"v1\",\"k2\":\"v2\",\""k3)\":\"v3\"},\""reflux.times\":1, payload\":{}}",
[0116] 5 “timestamp”:234234234,
[0117] 6 "caseName":"biz reflux",
[0118] 7 "n extRefluxTime": 1667811256586
[0119] 8}.
[0120] Step 12: If no further reflow is needed, i.e., if the reflow is stopped, save the original message body from Step 7 to the exception data table corresponding to the reflow instance for business problem tracing and querying.
[0121] Furthermore, reflow can also be achieved through scheduled tasks, specifically:
[0122] Step 13: Trigger the scheduled task for each reflow instance.
[0123] Step 14: The scheduled task will continuously query the original messages waiting to be retransmitted in the DB.
[0124] Step 15: Call the unified message sending interface provided by reflux-core to push the queried data to be returned to the message queue in Step 16.
[0125] Step 16: The business process will continuously consume this MQ.
[0126] It should be noted that the reflow strategy can also be configured through the following steps:
[0127] Step 17: Create a reflow instance configuration.
[0128] Step 18: Query the detailed configuration information of the reflow instance.
[0129] Step 19: Enable or disable reflow instance configuration.
[0130] Step 20: When enabling reflux instances: It is necessary to notify reflux-processor and reflux-scheduler to create an MQ client, which has a unified message production and sending interface provided by reflux-core.
[0131] Step 21: When shutting down the reflux instance: It is necessary to notify reflux-processor and reflux-scheduler to destroy the MQ client, which has a unified message production and sending interface provided by reflux-core.
[0132] Furthermore, in one embodiment, such as Figure 4As shown, the message retry system supports multiple retry cycles. When configuring a retry instance, the maximum number of retries can be configured, with a default value of 16. There is no maximum limit to this parameter's value, but the default value is recommended. The interval time varies in steps based on the number of retries, ranging from 1 second to 2 hours. If the maximum number of retries is less than or equal to 16, the interval time varies in steps according to the retry interval time for unordered messages. If the maximum number of retries is greater than 16, the interval time for retries exceeding 16 is 2 hours.
[0133] Through the above embodiments, this application implements the message sending and receiving logic for different types of message queues (MQ) within the message backflow system, and realizes message backflow. This allows for the resubmission of processed abnormal messages, and the permanent persistence of messages that still fail to be processed after resubmission, based on the abnormal data persistence function. Furthermore, it provides retrieval of persisted messages for problem tracing. In addition, addressing the issue that current message backflow mechanisms do not support dynamic adjustment of backflow strategies, this application can update the configuration periodically based on the latest configuration data in the database after updating the backflow strategy, thereby achieving dynamic configuration adjustment without restarting the business ETL process.
[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0135] Figure 5 This is a structural block diagram of a message reflow processing apparatus according to an embodiment of this application; as shown below. Figure 5 As shown, it includes:
[0136] The module 52 is used to process the business message according to the preset business logic and obtain the processing result; wherein the business message originates from the communication service of the home appliance.
[0137] It should be noted that the aforementioned preset business logic corresponds to the message type of the business message, which can be preset manually. Message types may include, for example, text, audio, and video.
[0138] The process of processing business messages according to preset business logic, as described above, can include determining whether a business message is empty. Furthermore, for text-type business messages, it can determine whether they are complete statements; for audio-type business messages, it can determine whether they play correctly; and for video-type business messages, it can determine whether the video is valid, etc.
[0139] The determination module 54 is used to determine the business message whose processing result indicates a processing failure as a message to be returned;
[0140] The reflow module 56 is used to generate a message queue to be reflowed based on the message to be reflowed, and to reflow the message to be reflowed in the message queue using a message reflow strategy to obtain the reflowed message.
[0141] The processing module 58 is used to perform business processing on the returned message.
[0142] The above-described device processes business messages according to preset business logic to obtain processing results. The business messages originate from the communication services of home appliances. Business messages indicating processing failure are identified as pending backflow messages. A pending backflow message queue is generated based on these pending backflow messages, and a message backflow strategy is used to backflow the pending backflow messages in the queue, resulting in backflowed backflow messages. Business processing is then performed on these backflowed backflow messages. This solves the problem in related technologies of how to backflow failed business messages to enable continued processing of business messages from home appliances, thus achieving the continued processing of business messages from home appliances.
[0143] Furthermore, the aforementioned processing module 58 is also used to persist the abnormal result if the processing result of the returned message after business processing is determined to be abnormal, so as to realize problem tracing and analyze the cause of the abnormality.
[0144] In an exemplary embodiment, the message return processing apparatus further includes an acquisition module, configured to: acquire a service flag corresponding to the service message, wherein the service flag corresponds to a flag value indicating whether the service message was successfully processed; acquire a target flag value consistent with a first preset value from the processing result, wherein the processing result includes: flag values of service identifiers corresponding to all service messages respectively, the first preset value indicating that the service message corresponding to the first preset value failed to process; and determine the service message corresponding to the target flag value as the service message indicated by the processing result as having failed to process.
[0145] The reasons for the failure of the above-mentioned business message processing may include, for example, program processing failure or data query failure, but are not limited thereto, and this application does not impose any restrictions on this.
[0146] In an exemplary embodiment, the message reflow processing apparatus further includes a parsing module, configured to: parse the reflow information in the reflow message queue, determine the reflow instance corresponding to the message to be reflowed, and determine the reflow strategy corresponding to the instance name of the reflow instance as the message reflow strategy.
[0147] Optionally, there can be multiple reflow instances corresponding to the message to be reflowed. Different reflow instances correspond to different MQ middlewares and have different instance names. The instance name of the required reflow instance can be determined according to the type of MQ middleware, and then the required reflow instance can be determined from the multiple reflow instances corresponding to the message to be reflowed.
[0148] In an exemplary embodiment, the parsing module is further configured to: obtain a preset number of reflows for the target object as the reflow instance from the message reflow strategy, and obtain the number of reflow completions corresponding to the reflow instance from the instance data of the reflow instance; and reflow the messages to be reflowed in the reflow message queue according to the preset number of reflows and the number of reflow completions.
[0149] In an exemplary embodiment, the parsing module is further configured to: compare the preset number of backflows with the number of backflow completions; if the preset number of backflows is greater than the number of backflow completions, obtain a first difference between the preset number of backflows and the number of backflow completions; determine the backflow interval time of the backflow instance in the next backflow based on the first difference; and backflow the message to be backflowed corresponding to the backflow instance at the backflow start time, wherein the backflow start time of the next backflow instance is the sum of the current backflow time of the backflow instance and the backflow interval time.
[0150] It should be noted that the larger the first difference mentioned above, the more times the reflow occurs and the longer the reflow interval.
[0151] In an exemplary embodiment, the parsing module is further configured to: when the first difference is less than a second preset value, obtain a second difference between the first difference and the second preset value; obtain a time range corresponding to the first difference; obtain an interval time corresponding to the second difference from the time range corresponding to the first difference, and determine the interval time corresponding to the second difference as the reflow interval time of the reflow instance in the next reflow; when the first difference is greater than or equal to the second preset value, determine the largest interval time in the time range corresponding to the first difference as the reflow interval time of the reflow instance in the next reflow.
[0152] In an exemplary embodiment, the parsing module is further configured to: determine the query interface corresponding to the reflow message after reflow when the preset reflow count is equal to the reflow completion count, wherein the query interface is used to query the processing result obtained after performing business processing on the reflow message after reflow; and, upon receiving a query instruction sent by the target object, call the query interface according to the query instruction and send the query data queried through the query interface to the target object.
[0153] Furthermore, through the above steps, if the preset number of reflows is equal to the number of reflow completions, the reflow can be determined to be complete, and then the query interface corresponding to the reflow message after the reflow can be determined.
[0154] In an exemplary embodiment, the parsing module is further configured to: respond to an execution instruction sent by a target object, wherein the execution instruction is configured to execute a timed task corresponding to the reflow instance according to a preset period; after the execution instruction is completed, determine the target reflow message obtained within the preset period, and generate a sub-message queue corresponding to the target reflow message; merge multiple sub-message queues to obtain the message queue to be reflowed.
[0155] In an exemplary embodiment, the parsing module is further configured to: obtain configuration information preset by the target object for the reflow instance, wherein the configuration information includes a message transmission interface for transmitting the message to be reflowed; upon receiving a start instruction from the target object, create a message client for the message queue corresponding to the message to be reflowed according to the start instruction, and send the message client to the target object using the message transmission interface, so that the target object can use the message client to query the message to be reflowed; upon receiving a close instruction from the target object, close the created message client according to the close instruction, and upon determining that the created message client has been successfully closed, send a prompt message to the target object, wherein the prompt message is used to prompt the target object that the created message client has been successfully closed.
[0156] In an exemplary embodiment, the parsing module is further configured to: obtain a first message middleware type used by the message transmission interface; and, if it is determined that the first message middleware type is a message middleware type supported by the message client, send the message client to the target object using the message transmission interface, wherein the message client supports different message middleware types.
[0157] In an exemplary embodiment, the message reflow processing apparatus further includes a query module, configured to: in response to a query instruction from a target object, determine a reflow processing result for performing business processing on the reflowed message; if the reflow processing result indicates that the reflowed message processing has failed, store the failed reflowed message and establish a correspondence between the failed reflowed message and its storage address; and send the correspondence to the target object.
[0158] In the above embodiments, the query module is further configured to: persistently store or temporarily store the reflow message after the storage processing failed; and store the reflow message after the storage processing failed to a local or cloud server. This application does not impose any restrictions on this.
[0159] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0160] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0161] S1, perform business processing on the business message according to the preset business logic to obtain the processing result; wherein, the business message originates from the communication service of the home appliance.
[0162] S2, the business message indicating that the processing result is a processing failure is determined as a message to be returned;
[0163] S3, Generate a message queue to be reflowed based on the message to be reflowed, and use a message reflow strategy to reflow the message to be reflowed in the message queue to obtain the reflowed message;
[0164] S4, perform business processing on the returned message.
[0165] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0166] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0167] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0168] S1, perform business processing on the business message according to the preset business logic to obtain the processing result; wherein, the business message originates from the communication service of the home appliance.
[0169] S2, the business message indicating that the processing result is a processing failure is determined as a message to be returned;
[0170] S3, Generate a message queue to be reflowed based on the message to be reflowed, and use a message reflow strategy to reflow the message to be reflowed in the message queue to obtain the reflowed message;
[0171] S4, perform business processing on the returned message.
[0172] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0173] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0174] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0175] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A message feedback processing method, characterized in that, include: The business messages are processed according to the preset business logic to obtain the processing results; wherein, the business messages originate from the communication services of home appliances. The business message indicating a processing failure is identified as a message to be returned. A message queue is generated based on the message to be reflowed, and the message reflow strategy is used to reflow the message to be reflowed in the message queue to obtain the reflowed message; Perform business processing on the returned messages; Before using the message reflow strategy to reflow the messages in the message reflow queue, the method further includes: Parse the pending reflow information in the reflow message queue to determine the reflow instance corresponding to the pending reflow message; The reflow strategy corresponding to the instance name of the reflow instance is determined as the message reflow strategy; After determining the reflow instance corresponding to the message to be reflowed, the method further includes: Obtain the configuration information preset for the target object as the reflow instance, wherein the configuration information includes a message transmission interface for transmitting the message to be reflowed; Upon receiving the start instruction from the target object, a message client is created for the message queue corresponding to the message to be reflowed according to the start instruction, and the message client is sent to the target object using the message transmission interface, so that the target object can use the message client to query the message to be reflowed; Upon receiving a shutdown command from the target object, the created messaging client is shut down according to the shutdown command. If it is determined that the created messaging client has been successfully shut down, a notification message is sent to the target object, wherein the notification message is used to notify the target object that the created messaging client has been successfully shut down.
2. The message backflow processing method according to claim 1, characterized in that, Before determining the business message indicating processing failure as a message to be returned to the client, the method further includes: Obtain the business flag corresponding to the business message, wherein the business flag corresponds to a flag value used to indicate whether the business message has been successfully processed; Obtain a target flag value that is consistent with the first preset value from the processing result, wherein the processing result includes: flag values of business identifiers corresponding to all business messages respectively, and the first preset value indicates that the processing of the business message corresponding to the first preset value has failed; The business message corresponding to the target flag value is identified as the business message indicating that the processing result has failed.
3. The message backflow processing method according to claim 1, characterized in that, The message reflow strategy is used to reflow the messages in the message reflow queue, including: The preset number of reflows for the target object is obtained from the message reflow strategy, and the number of reflow completions corresponding to the reflow instance is obtained from the instance data of the reflow instance. The messages to be re-streamed in the re-stream message queue are re-streamed according to the preset number of re-streams and the number of re-stream completions.
4. The message backflow processing method according to claim 3, characterized in that, The backflow of messages to be backflowed in the backflow message queue is performed according to the preset backflow count and the backflow completion count, including: Compare the preset number of reflow attempts with the number of reflow completion attempts; If the preset number of reflows is greater than the number of reflow completions, a first difference between the preset number of reflows and the number of reflow completions is obtained; The reflow interval time for the next reflow instance is determined based on the first difference. And at the reflow start time, the message to be reflowed corresponding to the reflow instance is reflowed, and the next reflow start time of the reflow instance is the sum of the current reflow time of the reflow instance and the reflow interval time.
5. The message backflow processing method according to claim 4, characterized in that, After receiving the return message, the method further includes: When the preset number of reflows is equal to the number of reflow completions, the query interface corresponding to the reflow message after reflow is determined, wherein the query interface is used to query the processing result obtained after performing business processing on the reflow message after reflow; Upon receiving a query instruction from the target object, the query interface is invoked according to the query instruction, and the query data obtained through the query interface is sent to the target object.
6. The message backflow processing method according to claim 4, characterized in that, Determining the reflow interval time for the next reflow instance based on the first difference includes: If the first difference is less than the second preset value, obtain the second difference between the first difference and the second preset value; obtain the time range corresponding to the first difference; obtain the interval time corresponding to the second difference from the time range corresponding to the first difference, and determine the interval time corresponding to the second difference as the reflow interval time of the reflow instance in the next reflow; If the first difference is greater than or equal to the second preset value, the maximum interval time within the time range corresponding to the first difference is determined as the reflow interval time of the reflow instance in the next reflow.
7. The message backflow processing method according to claim 1, characterized in that, Generate a queue of messages to be retransmitted based on the messages to be retransmitted, including: Responding to the execution instruction sent by the target object, wherein the execution instruction is used to execute the timed task corresponding to the reflow instance according to a preset period; After the execution instruction is completed, the target backflow message obtained within the preset period is determined, and a sub-message queue corresponding to the target backflow message is generated; The multiple sub-message queues are merged to obtain the message queue to be returned.
8. The message backflow processing method according to claim 1, characterized in that, Sending the message client to the target object using the message transmission interface includes: Obtain the type of the first message middleware used by the message transmission interface; If it is determined that the first message middleware type is a message middleware type supported by the message client, the message client is sent to the target object using the message transmission interface, wherein the message client supports different message middleware types.
9. The message backflow processing method according to claim 1, characterized in that, After performing business processing on the returned message, the method further includes: In response to the query command of the target object, determine the return processing result of the return message after business processing; If it is determined that the reflow processing result indicates that the reflow message processing after reflow has failed, then the reflow message after reflow that failed is stored, and a correspondence is established between the reflow message after reflow that failed and its storage address. The correspondence is sent to the target object.
10. A message feedback processing apparatus, characterized in that, include: The module is used to process business messages according to preset business logic and obtain processing results; wherein, the business messages originate from the communication services of home appliances. The determination module is used to determine the business message whose processing result indicates a processing failure as a message to be returned; The reflow module is used to generate a message queue to be reflowed based on the message to be reflowed, and to reflow the message to be reflowed in the message queue using a message reflow strategy to obtain the reflowed message. The processing module is used to perform business processing on the returned messages; The message reflow processing device further includes a parsing module, used to parse the reflow information in the reflow message queue, determine the reflow instance corresponding to the message to be reflowed, and determine the reflow strategy corresponding to the instance name of the reflow instance as the message reflow strategy; The parsing module is further configured to obtain configuration information preset by the target object for the reflow instance, wherein the configuration information includes a message transmission interface for transmitting the message to be reflowed; upon receiving a start command from the target object, a message client is created for the message queue corresponding to the message to be reflowed according to the start command, and the message client is sent to the target object using the message transmission interface, so that the target object can use the message client to query the message to be reflowed; upon receiving a close command from the target object, the created message client is closed according to the close command, and upon confirming that the created message client has been successfully closed, a prompt message is sent to the target object, wherein the prompt message is used to indicate to the target object that the created message client has been successfully closed.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 9.
12. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 through the computer program.
Citation Information
Patent Citations
Message processing method and device, storage medium and equipment
CN110941502A
Event retry method and device, storage medium and electronic equipment
CN115333942A