Abnormality processing method and device and related product

By starting the asynchronous exception processing thread in the main processing thread, obtaining the document processing information of each processor, determining and processing the pending exception, the problem of the inability to handle multiple processor exceptions in the prior art is solved, and the document processing efficiency is improved .

CN119473682APending Publication Date: 2025-02-18BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411640400.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art is difficult to uniformly handle exceptions generated by multiple processors during the processing of documents, resulting in inefficient document processing.

Method used

By starting an asynchronous exception processing thread in the main processing thread, obtaining the document processing information after the processing documents of each processor (including the main processing thread, the asynchronous processing thread and the downstream processing service) is completed, determining the pending exception and processing it.

Benefits of technology

It realizes unified processing of exceptions generated during the processing of documents by multiple processors, and improves document processing efficiency and exception processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473682A_ABST
    Figure CN119473682A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an exception handling method and device and a related product, and the method comprises the steps: obtaining a first document, and starting an exception handling thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; through the exception handling thread, acquiring document processing information reported after each processing party of the first document finishes processing the first document; each processing party comprises the main processing thread, an asynchronous processing thread of the first document and a downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread, except the exception processing thread, of the main processing thread; and determining at least one to-be-processed exception of the first document according to the document processing information through the exception processing thread, and processing the to-be-processed exception.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to an exception handling method, device and related products. Background Art

[0002] At present, the usual processing method for payment services is to obtain the user's payment operation, create a document corresponding to the payment operation, and jointly process the document through multiple processors. The multiple processors may generate processing exceptions during the process of processing the document. Therefore, it is necessary to provide a technical solution to handle the exceptions generated during the process of processing the document by multiple processors, so as to improve the efficiency of document processing. Summary of the invention

[0003] The embodiments of the present disclosure provide an exception handling method, device and related products, which can handle exceptions generated during the process of multiple processing parties processing documents, thereby improving the efficiency of document processing.

[0004] In a first aspect, an embodiment of the present disclosure provides an exception handling method, including: Obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; Obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; Through the exception processing thread, at least one unprocessed exception of the first document is determined according to the document processing information, and the unprocessed exception is processed.

[0005] In a second aspect, an embodiment of the present disclosure provides an exception handling device, including: A thread starting unit, used for acquiring a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; an information acquisition unit, configured to acquire, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document, and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; The exception handling unit is used to determine at least one unprocessed exception of the first document according to the document processing information through the exception handling thread, and to handle the unprocessed exception.

[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, enable the processor to implement the steps of the method described in the first aspect above.

[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the steps of the method described in the first aspect above.

[0008] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0009] In one or more embodiments of the present disclosure, first, a first document is obtained, and an exception processing thread is started for the first document through the main processing thread of the first document, and the exception processing thread is an asynchronous thread of the main processing thread. Then, the document processing information reported by each processor of the first document after processing the first document is completed is obtained through the exception processing thread. Each processor includes the main processing thread, the asynchronous processing thread of the first document, and the downstream processing service of the first document. The asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread. Finally, the exception processing thread determines at least one pending exception of the first document according to the document processing information, and processes each pending exception. It can be seen that through this embodiment, the document processing information reported by each processor of the first document after processing the first document is completed can be obtained, and the pending exception of the first document can be determined according to the document processing information. The method of processing the pending exception can achieve the effect of processing the exceptions generated in the process of processing the first document by multiple processors, solves the problem that the prior art cannot uniformly process the exceptions generated in the process of processing the first document by multiple processors, and improves the exception processing efficiency and document processing efficiency of the first document. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate one or more embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 A flowchart of an exception handling method provided by an embodiment of the present disclosure; Figure 2 A schematic diagram of a process for determining an exception to be processed of a first document provided in an embodiment of the present disclosure; Figure 3 A schematic diagram of the system architecture of an exception handling method provided by an embodiment of the present disclosure; Figure 4 A schematic diagram of the structure of an exception handling device provided in one embodiment of the present disclosure; Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION

[0011] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on one or more embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the present disclosure.

[0012] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0013] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0014] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0015] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0016] The disclosed embodiment provides an exception handling method, which can handle exceptions generated during the process of multiple processing parties processing documents, thereby improving the efficiency of document processing. The method can be applied to and executed by a backend server, which can be a single server or a server cluster. Figure 1 A flowchart of an exception handling method provided by an embodiment of the present disclosure is shown in FIG. Figure 1 As shown, the method includes: Step S102, obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; Step S104, obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; each processing party includes a main processing thread, an asynchronous processing thread of the first document, and a downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread other than the exception processing thread of the main processing thread; Step S106: determining, through the exception processing thread, at least one to-be-processed exception of the first document according to the document processing information, and processing the to-be-processed exception.

[0017] In this embodiment, first, the first document is obtained, and an exception processing thread is started for the first document through the main processing thread of the first document. The exception processing thread is an asynchronous thread of the main processing thread. Then, the document processing information reported by each processor of the first document after processing the first document is completed is obtained through the exception processing thread. Each processor includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document. The asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread. Finally, the exception processing thread determines at least one pending exception of the first document according to the document processing information, and processes each pending exception. It can be seen that through this embodiment, the document processing information reported by each processor of the first document after processing the first document is completed can be obtained, and the pending exception of the first document can be determined according to the document processing information. The method of processing the pending exception can achieve the effect of processing the exceptions generated in the process of processing the first document by multiple processors, solves the problem that the prior art cannot uniformly process the exceptions generated in the process of processing the first document by multiple processors, and improves the exception processing efficiency and document processing efficiency of the first document.

[0018] In the above step S102, a first document is obtained. The first document may be a document related to the payment service, such as a payment document, a refund document, a unilateral receipt document, a reversal document, etc. generated based on the user's payment-related operation. The first document may also be a document belonging to other services. In this embodiment, it is not limited to the document type, and the processing exceptions of various documents are processed.

[0019] In the above step S102, an exception processing thread is started for the first document through the main processing thread of the first document. In this embodiment, the main processing thread is a main thread pre-created in the background server for processing the first document, and the exception processing thread is an asynchronous thread created by the main processing thread for the first document, and the exception processing thread is used to handle the processing exception of the first document.

[0020] In one embodiment, starting an exception processing thread for the first document through a main processing thread of the first document includes: Through the main processing thread, a unified push context is created as the processing framework of the first document; By means of the main processing thread, determining based on the unified advancement context that the main processing thread and the downstream processing service have finished processing the first document; Through the main processing thread, after the main processing thread and the downstream processing service finish processing the first document, the exception handling thread is started based on the unified advancement context.

[0021] In this embodiment, first, a unified promotion context is created as a processing framework for the first document through the main processing thread. In this embodiment, the unified promotion context is a customized processing framework for the first document in the promotion stage, which is a collection of a series of methods, architectures and tools for promoting the processing of the first document.

[0022] In one example, the unified advancement context has the following functions: 1. A unified promotion context may be defined through generics, and the information and common methods required for document processing may be defined in the unified promotion context, so that this embodiment can be compatible with the processing of various types of documents.

[0023] 2. In the unified promotion context, standardize the content of the context, and only store the document model, document type, and document identification in the public variables.

[0024] 3. In the unified push context, define the asynchronous push executor and common methods to facilitate the opening of multiple asynchronous threads during the push phase of processing the first document, and provide the ability to summarize the processing information of each asynchronous thread after the main processing thread ends through the unified push context. This will be discussed later.

[0025] 4. In the unified promotion context, define retry tasks to distinguish pending exceptions of the forward call class and pending exceptions of the system retry class. The three concepts of retry tasks, pending exceptions of the forward call class, and pending exceptions of the system retry class will be expanded later.

[0026] 5. By unifying the promotion context and managing post-processing exceptions, it is used to execute the corresponding post-processing process such as creating a rollback document after the main processing thread ends. This will also be expanded later.

[0027] Next, in this embodiment, the main processing thread determines that the main processing thread and the downstream processing service have finished processing the first document based on the unified advancement context, and the downstream processing service refers to each downstream service that processes the first document. Finally, after the main processing thread and the downstream processing service have finished processing the first document, the exception processing thread is started based on the unified advancement context.

[0028] It can be seen that through this embodiment, a unified advancement context can be created as the processing framework of the first document, and the main processing thread and the downstream processing service can be determined to complete processing of the first document based on the unified advancement context. In addition, an exception processing thread can be started based on the unified advancement context. By defining the unified advancement context, the processing flow of the first document can be standardized and the processing efficiency of the first document can be improved.

[0029] In one embodiment, determining, by the main processing thread, based on the unified advancement context, that the main processing thread and the downstream processing service have finished processing the first document includes: Summarizing the document processing information reported by the downstream processing service after the first document is processed based on the unified advancement context through the main processing thread, and determining that the downstream processing service has completed processing the first document according to the document processing information reported by the downstream processing service; Through the main processing thread, after the downstream processing service finishes processing the first document, a database transaction is created based on the unified promotion context, the first document is processed in the database transaction, and after the database transaction is committed, it is determined that the main processing thread has finished processing the first document.

[0030] In this embodiment, the unified promotion context has the ability to summarize the document processing information reported by the downstream processing service after the first document is processed. The downstream processing service refers to each downstream service that processes the first document. Therefore, firstly, the document processing information reported by the downstream processing service after the first document is processed is summarized based on the unified promotion context by the main processing thread. After receiving the document processing information reported by each downstream processing service, it can be determined that the downstream processing service has finished processing the first document.

[0031] Next, through the main processing thread, after the downstream processing service completes processing the first document, a database transaction is created based on the unified promotion context, the first document is processed in the database transaction, and after the database transaction is committed, it is determined that the main processing thread has completed processing the first document.

[0032] In a specific example, taking the payment scenario as an example, the process of processing the first document can be divided into an acceptance stage and a promotion stage. In the acceptance stage, the main processing thread creates an acceptance transaction, which is a database transaction. In the acceptance transaction, the first document corresponding to the user's payment-related operation is created, and a retry task is created for the first document. The retry task is used to handle the pending exceptions of the first document. After the acceptance transaction is submitted, the main processing thread enters the promotion stage. In the promotion stage, the main processing thread creates a unified promotion context as the processing framework of the first document. Then, in the promotion stage, the main processing thread summarizes the document processing information reported by the downstream processing service after the first document is processed based on the unified promotion context, and determines that the downstream processing service has finished processing the first document based on the document processing information reported by the downstream processing service. After the downstream processing service finishes processing the first document, the main processing thread creates a database transaction based on the unified promotion context. The database transaction is a promotion transaction. The main processing thread processes the first document in the promotion transaction. After the promotion transaction is submitted, it is determined that the main processing thread has finished processing the first document. Then, after the main processing thread and the downstream processing service finish processing the first document, the main processing thread creates and starts the exception handling thread based on the unified promotion context, thereby executing Figure 1The method flow in .

[0033] It can be seen that through this embodiment, the unified promotion context has the ability to summarize the document processing information reported after the downstream processing service completes processing the first document, and also has the ability to create database transactions, so that in the promotion stage, the processing flow of the first document is standardized and the processing efficiency of the first document is improved.

[0034] After the exception handling thread is created and started, in the above step S104, the document processing information reported by each processing party of the first document after processing the first document is completed is obtained through the exception handling thread. Each processing party includes a main processing thread, an asynchronous processing thread of the first document, and each downstream processing service of the first document. The asynchronous processing thread is another asynchronous thread created by the main processing thread except the exception handling thread. According to the above introduction, in the process of creating and starting the exception handling thread, it is determined that the main processing thread of the first document and each downstream processing service have finished processing the first document. The asynchronous processing thread of the first document can be an asynchronous thread started and created by the main processing thread when processing the first document in the promotion transaction. The asynchronous processing thread can perform asynchronous processing on the first document, for example, generate a message of successful processing of the first document, such as a payment success message, and return it to the user. In this embodiment. The exception handling thread can wait for the asynchronous processing thread to finish processing the first document based on the capabilities provided by the unified promotion context (the third capability mentioned above), and obtain the document processing information reported by the main processing thread, the asynchronous processing thread, and each downstream processing service after processing the first document. In an example, the document processing information includes normal processing information and abnormal processing information reported by the processor after the processor completes processing the first document, and may also include relevant information such as processing time.

[0035] In the above step S106, at least one unprocessed exception of the first document is determined according to the document processing information through the exception processing thread, and the unprocessed exception is processed.

[0036] In one embodiment, determining at least one to-be-processed exception of the first document according to the document processing information through the exception processing thread includes: By using the exception processing thread, according to the document processing information, determining whether at least one of the main processing thread and the asynchronous processing thread has a processing exception for the first document; If at least one of the main processing thread and the asynchronous processing thread has a processing exception, determining the to-be-processed exception of the first document according to the processing exception of at least one of them; If neither the main processing thread nor the asynchronous processing thread has any processing exception, the processing status of the first document is obtained, and at least one to-be-processed exception of the first document is determined according to the processing status of the first document.

[0037] In this embodiment, the specific process of determining at least one unprocessed exception of the first document based on the document processing information is executed by the exception processing thread. First, through the exception processing thread, based on the document processing information, it is determined whether the main processing thread has a processing exception when processing the first document. For example, if the document processing information of the main thread includes processing exception information for the first document, it is determined that the main processing thread has a processing exception when processing the first document. And, through the exception processing thread, based on the document processing information, it is determined whether the asynchronous processing thread has a processing exception when processing the first document. For example, if the document processing information of the asynchronous thread includes processing exception information for the first document, it is determined that the asynchronous processing thread has a processing exception when processing the first document.

[0038] If it is determined that at least one of the main processing thread and the asynchronous processing thread has a processing exception when processing the first document, then the to-be-processed exception of the first document is determined according to the processing exception of at least one of them. If it is determined that neither the main processing thread nor the asynchronous processing thread has a processing exception when processing the first document, the processing status of the first document is obtained, and the processing status includes processing completed and processing incomplete. According to the processing status of the first document, at least one to-be-processed exception of the first document is determined.

[0039] It can be seen that through the embodiments, it is possible to determine whether at least one of the main processing thread and the asynchronous processing thread has a processing exception based on the document processing information. When at least one of the main processing thread and the asynchronous processing thread has a processing exception, the pending exception of the first document is determined based on the processing exception of at least one. Conversely, at least one pending exception of the first document is determined based on the processing status of the first document, thereby achieving the effect of accurately identifying the pending exception of the first document.

[0040] In one embodiment, determining the to-be-processed exception of the first document according to at least one of the above processing exceptions includes: If a specific type of processing exception exists in the main processing thread or the asynchronous processing thread, the specific type of processing exception is processed. If a processing exception is obtained after processing, the processing exception is used as a pending exception of the first document; If the main processing thread or the asynchronous processing thread has a processing exception other than a specific type of processing exception, the processing exception other than the specific type of processing exception is treated as a pending exception of the first document.

[0041] The specific process of this embodiment can be executed by the exception handling thread. In this embodiment, if a specific type of processing exception occurs in the process of processing the first document by the main processing thread, for example, the document processing information reported by the main processing thread carries the exception handling information corresponding to the specific type of processing exception, then the specific type of processing exception is processed by the exception handling thread, and if a processing exception is obtained after processing, the processing exception is used as a pending exception of the first document, and if no processing exception is obtained after processing, it is determined that no pending exception of the first document is collected in this step.

[0042] Similarly, if a specific type of processing exception occurs during the processing of the first document by the asynchronous processing thread, for example, the document processing information reported by the asynchronous processing thread carries exception processing information corresponding to the specific type of processing exception, the specific type of processing exception is processed by the exception processing thread. If a processing exception is obtained after processing, the processing exception is used as a pending exception for the first document. If no processing exception is obtained after processing, it is determined that no pending exception for the first document is collected in this step.

[0043] In addition, in this embodiment, if the main processing thread has a processing exception other than a specific type of processing exception, for example, the document processing information reported by the main processing thread carries exception processing information corresponding to the processing exception other than the specific type of processing exception, then through the exception processing thread, the processing exception other than the specific type of processing exception is treated as an exception to be processed for the first document.

[0044] Similarly, if the asynchronous processing thread has processing exceptions other than specific types of processing exceptions, for example, the document processing information reported by the asynchronous processing thread carries exception processing information corresponding to processing exceptions other than specific types of processing exceptions, then the exception processing thread will use the processing exceptions other than the specific types of processing exceptions as the exceptions to be processed for the first document.

[0045] In one embodiment, the above-mentioned specific type of processing exception can be pre-configured by the background server, and the specific type of processing exception can be called a post-processing exception. The above-mentioned specific type of processing exception of the main processing thread or the asynchronous processing thread can be pre-identified by the main processing thread based on the unified advancement context, and marked in the unified advancement context, and the above-mentioned specific type of processing exception in the main processing thread or the asynchronous processing thread can be deleted.

[0046] In a specific embodiment, after starting the push phase of the first document, the main processing thread may also perform the following process in the push phase through the unified push context mentioned above: 1. Call the main processing thread to process the first document based on the transaction advancement, including: 1.1 Call the downstream according to the instructions in sequence and update the instruction status based on the transaction lock; 1.2 Based on the command execution result, open the transaction lock to update the document; 1.3 Aggregate all instruction results and update the document; 1.4 Use the unified advancement context definition method in the main processing thread to start the asynchronous processing thread, and complete the downstream compensation call, message sending, and some other necessary operations through the asynchronous processing thread; 1.5 Trigger the main processing thread to construct a specific type of processing exception such as a rollback exception.

[0047] 2. Identify the specific type of processing exception in the main processing thread, mark it in the unified promotion context, and delete the specific type of processing exception in the main processing thread.

[0048] 3. Return the document based on the current database information, or construct an exception return result based on the main processing thread exception; 4. Start the exception handling thread and execute Figure 1 Exception handling is performed in the method flow.

[0049] It can be seen that through this embodiment, the unprocessed exceptions of the first document can be accurately determined according to the types of exceptions reported by the main processing thread and the asynchronous processing thread.

[0050] In one embodiment, determining at least one to-be-processed exception of the first document according to the processing status of the first document includes: If the processing status of the first document indicates that the processing of the first document is completed, the retry task is deleted, and when a deletion exception occurs, the deletion exception is determined as a pending exception of the first document; the retry task is used to process the pending exception of the first document; If the processing status of the first document indicates that the first document has not been processed, it is determined based on the document processing information whether the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document, and based on the determination result, the unprocessed abnormality of the first document is determined.

[0051] In this embodiment, if it is determined through the exception handling thread that neither the main processing thread nor the asynchronous processing thread has any processing exception for the first document, it is determined whether the first document is in a processing completion state or an processing incomplete state. If the processing status of the first document indicates that the processing of the first document is complete, the retry task is deleted. The retry task is a task created by the main processing thread in the acceptance stage mentioned above. The retry task is used to handle the pending exceptions of the first document. If a deletion exception occurs, the deletion exception is determined as a pending exception of the first document. If no deletion exception occurs, it is determined that there is no pending exception for the first document, and the exception handling thread is terminated.

[0052] If the processing status of the first document indicates that the first document has not been processed, then based on the document processing information, it is determined whether the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document, and based on the determination result, the unprocessed exception of the first document is determined. Specifically, if the processing status of the first document indicates that the first document has not been processed, then it is determined whether the document processing information reported by the downstream processing service of the first document carries a non-abnormal processing result with a specific error identifier for the first document, that is, the document processing information reported by the downstream processing service includes normal processing information, but the normal processing information may carry a specific error identifier such as a specific error code. And based on the determination result, the unprocessed exception of the first document is determined.

[0053] It should be noted that before this embodiment, if a specific type of processing exception exists in the main processing thread or the asynchronous processing thread, the specific type of processing exception is processed. If no processing exception is obtained after processing, the above method can also be executed to determine whether the first document is in a processing completion state or an incomplete processing state. If the processing status of the first document indicates that the processing of the first document is completed, the retry task is deleted. If a deletion exception is generated, the deletion exception is determined as a pending exception of the first document. If no deletion exception is generated, it is determined that there is no pending exception for the first document, and the exception processing thread is terminated. And, if the processing status of the first document indicates that the first document is not processed, it is determined based on the document processing information whether the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document, and the pending exception of the first document is determined based on the judgment result.

[0054] Here is an explanation of the retry task: the processing method for the pending exception of the first document is generally based on the principle of reprocessing the first document, especially re-executing the advancement stage of the first document, so as to solve the pending exception of the first document. Based on this principle, the main processing thread can create a retry task for the first document in the acceptance stage of the first document. When processing the pending exception of the first document, the retry task can receive a retry message for the first document, so as to re-execute the advancement stage of the first document. In this embodiment, if neither the main processing thread nor the exception processing thread has a processing exception of the above-mentioned specific type, or the main processing thread or the exception processing thread has a processing exception of the above-mentioned specific type, but the exception processing thread successfully handles the processing exception of the specific type without throwing a new exception, then in the state where the processing of the first document is completed, try to delete the retry task. If the deletion is successful, it means that the processing of the first document is completed without any exception. If an exception occurs during the deletion, the deletion exception is also a pending exception of the first document to be resolved.

[0055] It can be seen that through this embodiment, the unprocessed exceptions of the first document can be determined according to the processing status of the first document, so as to achieve the effect of accurately identifying the unprocessed exceptions of the first document and improve the processing efficiency of the first document.

[0056] In one embodiment, determining the unprocessed exception of the first document according to the judgment result includes: If the downstream processing service of the first document reports a non-exceptional processing result with a specific error identifier for the first document, the non-exceptional processing result with the specific error identifier is used as a pending exception for the first document; If the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained and used as a pending exception for the first document.

[0057] In this embodiment, if the processing status of the first document indicates that the first document has not been processed, and the document processing information reported by the downstream processing service of the first document is determined by the exception processing thread to carry a non-exceptional processing result with a specific error identifier for the first document, then the non-exceptional processing result with the error identifier is used as the unprocessed exception of the first document. In one example, the non-exceptional processing result with the error identifier can be identified in advance by the main processing thread based on the method provided by the unified advancement context and written in the unified advancement context.

[0058] On the contrary, if the processing status of the first document indicates that the first document has not been processed, and it is determined through the exception processing thread that the document processing information reported by the downstream processing service of the first document does not carry a non-exceptional processing result with a specific error identifier for the first document, then considering that the first document has not been processed, a pre-set catch-all exception is obtained, and the catch-all exception is determined as a pending exception for the first document.

[0059] It can be seen that through this embodiment, when the first document is not processed completely, the pending exception of the first document can be accurately detected taking into account the situation that the normal processing information reported by the downstream processing service may carry an error identifier.

[0060] Figure 2 A flow chart of determining an exception to be processed of a first document provided in an embodiment of the present disclosure, such as Figure 2 As shown, the process includes: Step S202, judging, by the exception processing thread, according to the document processing information, whether at least one of the main processing thread and the asynchronous processing thread has a processing exception for the first document; Step S204, if a specific type of processing exception exists in the main processing thread or the asynchronous processing thread, the specific type of processing exception is processed; Step S206: if there is a processing exception after processing, the processing exception is taken as a pending exception of the first document; Step S208, if there is no processing exception after processing, execute step S214; Step S210, if the main processing thread or the asynchronous processing thread has a processing exception other than a specific type of processing exception, the processing exception other than the specific type of processing exception is taken as a to-be-processed exception of the first document; Step S212, if there is no processing exception in the main processing thread or the asynchronous processing thread, execute step S214; Step S214, determining whether the first document has been processed or not; Step S216: if the first document is processed, the retry task of the first document is deleted; if there is no exception in deleting the retry task, it is determined that there is no pending exception in the first document; if there is an exception in deleting the retry task, the deletion exception is used as the pending exception of the first document; Step S218: If the processing of the first document is not completed, and the downstream processing service of the first document reports a non-exceptional processing result with a specific error identifier for the first document, the non-exceptional processing result with the specific error identifier is used as a pending exception for the first document; Step S220: If the processing of the first document is not completed, and the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained and used as a pending exception for the first document.

[0061] In one embodiment, in the above step S106, the exception to be processed is processed by the exception processing thread, including: Determine the processing order of each pending exception through the exception handling thread; Through the exception handling thread, each pending exception is processed according to the processing order of each pending exception.

[0062] In this embodiment, first, the processing order of each exception to be processed is determined through the exception processing thread, and then, each exception to be processed is processed according to the processing order of each exception to be processed through the exception processing thread.

[0063] It can be seen that, through this embodiment, the effect of processing each unprocessed exception in sequence can also be achieved.

[0064] In one embodiment, determining the processing order of each to-be-processed exception includes: Determine the order in which each exception to be handled should be processed according to the following order from the beginning to the end: 1. Processing exceptions other than specific types of processing exceptions of the main processing thread of the first document; 2. The asynchronous processing thread of the first document processes exceptions other than the specific type of processing exceptions; the asynchronous processing thread is another asynchronous thread other than the exception processing thread opened by the main processing thread for the first document; 3. The processing exception obtained after processing a specific type of processing exception of the main processing thread; 4. The processing exception obtained after processing a specific type of processing exception of the asynchronous processing thread; 5. When the processing status of the first document indicates that the processing of the first document is completed, the deletion exception generated by the retry task is deleted; the retry task is used to handle the pending exception of the first document; 6. When the processing status of the first document indicates that the first document has not been processed, the non-abnormal processing result with a specific error identifier reported by the downstream processing service of the first document for the first document; 7. When the processing status of the first document indicates that the first document has not been processed, and the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained.

[0065] It can be understood that various types of unprocessed exceptions that can be determined by the method flow described above are listed here. In this embodiment, the order from top to bottom of the various types of exceptions listed here can be used as the order of processing each unprocessed exception.

[0066] It can be seen that through this embodiment, the processing order of each exception to be processed can be determined according to the order of the above types of exceptions from front to back, so as to achieve orderly processing of each exception to be processed.

[0067] In one embodiment, each of the pending exceptions is processed according to the processing order of each of the pending exceptions, including: According to the processing order of each pending exception, determine the pending exception that needs to be processed currently as the target exception; If the target exception is a forward call exception, the error code of the target exception is updated to the retry task according to the optimistic locking technology. After the update is successful, the target exception is processed by reprocessing the first document; the retry task is used to process the target exception; If the target exception is a system retry exception, the retry count of the first document is updated according to the optimistic locking technology and the number of retries of the first document corresponding to the target exception. After the update is successful, the target exception is handled by reprocessing the first document.

[0068] In this embodiment, when processing each pending exception through the exception processing thread, first, according to the processing order of each pending exception, determine the pending exception that needs to be processed currently as the target exception, and then determine whether the target exception is a forward call exception or a system retry exception. The forward call exception refers to the exception determined based on the document processing information reported by each processing party after processing the first document for the first time. The system retry exception refers to the exception determined based on the document processing information reported by each processing party after processing the first document not for the first time. In detail, since the way to resolve the pending exception is to reprocess the first document and retry the advancement stage of the first document, when each processing party processes the first document for the first time and generates an exception, the exception is a forward call exception, and when each processing party retries to process the first document and generates an exception, the exception is a system retry exception.

[0069] When the advancement phase of the first document is retried, the unified advancement context will be recreated, and the previously mentioned points 1-4 executed by the main processing thread through the unified advancement context in the advancement phase will be re-executed. Therefore, a mark can be set in the unified advancement context to indicate whether the unified advancement context is created for the first time or after a retry. If the mark indicates that the unified advancement context is created for the first time, then the pending exception determined by the exception handling thread created based on the unified advancement context is determined to be a forward call exception. If the mark indicates that the unified advancement context is created after a retry, then the pending exception determined by the exception handling thread created based on the unified advancement context is determined to be a system retry exception.

[0070] If the target exception is a forward call exception, and there is no retry task created by the main processing thread in the unified promotion context, and the retry task does not mark any error code, then the error code of the target exception will be updated to the retry task according to the optimistic locking technology. After the update is successful, the retry task will mark the error code corresponding to the target exception. After the update is successful, the target exception will be processed by reprocessing the first document. Based on this, if there is a concurrent exception of the target exception, since the target exception has updated the error code to the retry task, when the concurrent exception arrives, the error code update based on the optimistic locking technology will fail, so that the concurrent exception will not be processed.

[0071] If the target exception is a system retry exception, and there is a retry task created by the main processing thread in the unified promotion context, then the number of retries of the first document corresponding to the optimistic locking technology and the target exception is updated, that is, the number of retries of the first document is increased by 1 based on the number of retries, wherein the number of retries of the first document corresponding to the target exception can be carried in the target exception or pre-recorded in the unified promotion context. After the update is successful, the target exception is processed by reprocessing the first document. Based on this, if there is a concurrent exception of the target exception, since the target exception has updated the number of retries of the first document, when the concurrent exception arrives, the update of the number of retries based on the optimistic locking technology will fail, so that the concurrent exception will not be processed.

[0072] It can be seen that, through this embodiment, different types of target exceptions can be distinguished, thereby preventing the waste of system resources caused by concurrent exceptions in different situations, and concurrent exceptions do not need to be processed in various situations.

[0073] In one embodiment, in the above two cases, the target exception is processed by reprocessing the first document, including: Generate a retry message corresponding to the target exception and determine the retry delay of the retry message; A retry message is sent to the main processing thread; the retry message is used to reprocess the first document based on the retry delay.

[0074] When the target exception is a forward call exception and the target exception is a system retry exception, the target exception is handled by reprocessing the first document. Specifically, a retry message corresponding to the target exception is generated, and the retry delay of the retry message is determined, and the retry message is sent to the message center, and the retry message is sent to the main processing thread through the message center. Since the retry message has a retry delay, the message center will delay the delivery of the retry message to the main processing thread according to the retry delay, thereby achieving the effect of re-executing the advancement phase of the first document based on the retry delay. When the advancement phase of the first document is retried, a unified advancement context will be recreated, and the previously mentioned points 1-4 executed by the main processing thread through the unified advancement context in the advancement phase will be re-executed, which will not be repeated here.

[0075] It can be seen that, through this embodiment, the unprocessed exception of the first document can be resolved by delaying and retrying the advancement phase of the first document.

[0076] In this embodiment, the retry message generated according to the target exception carries a machine environment identifier. When the main processing thread receives the retry message, it can check whether the machine environment identifier carried in the retry message is the machine environment identifier of the currently used machine. If so, the main processing thread restores the context environment identifier of the user operation such as the payment operation in the retry message. If not, the main processing thread does not process the retry message and issues an alarm.

[0077] In one embodiment, sending a retry message to the main processing thread includes: According to the time interval between the retry message and the next retry, the retry message is put into the corresponding message queue; Send a retry message to the main processing thread through the message queue where the retry message is located.

[0078] In this embodiment, a retry message is sent to the main processing thread through a message queue. Since there are many retry messages and the retry message itself has a retry attribute, the retry attribute indicates the time interval for repeating the retry message next time if the retry message fails to be processed. For example, if the retry message fails to be processed, the retry message will be sent again after one second interval next time. If it fails again, it will be sent again after an interval of 3 seconds. Based on this, according to the time interval between the retry message and the next retry, the retry message is placed in the corresponding message queue. For example, the retry message with a shorter time interval between the next retry is placed in a high-priority queue, and the retry message with a longer time interval between the next retry is placed in a low-priority queue. After a retry message is retried many times, the time interval between the next retry will become longer, and the retry message may be transferred from the high-priority queue to the low-priority queue. Then, based on the message queue where the retry message is located, the retry message is sent to the main thread.

[0079] It can be seen that through this embodiment, it is possible to distinguish between high-priority and low-priority queues and send retry messages to the main processing thread, thereby improving the efficiency of sending retry messages.

[0080] In one embodiment, the above method flow further includes: Scanning retry messages corresponding to each pending exception based on a first time interval, the first time interval being greater than a second time interval; the second time interval being obtained based on a time interval between the retry message and the next retry; If a problem retry message whose sending time has been reached but has not been sent to the main processing thread is scanned in each retry message, the problem retry message is sent to the main processing thread, and the next retry time of the problem retry message is adjusted to a time that is a third time interval from the current time; the third time interval is greater than the first time interval.

[0081] In this embodiment, in order to prevent abnormalities in the message queue, a minute-level table scanning task for the database can be established to cover the sending of retry messages, wherein the retry messages are stored in the database before being put into the message queue. The retry messages stored in the database are scanned regularly based on a longer first time interval. Since the first time interval is greater than the second time interval, the second time interval is obtained based on the time interval between the retry message and the next retry. For example, the second time interval is the time interval between the retry message and the next retry plus one minute. Therefore, the retry messages normally sent to the main processing thread will not be scanned, so that the scanned retry messages are problematic retry messages that have reached the sending time but have not been sent to the main processing thread.

[0082] Based on this, if a problem retry message whose sending time has been reached but has not been sent to the main processing thread is scanned in each retry message, the problem retry message is sent to the main processing thread to achieve the blanket sending of the retry message, and the next retry time of the problem retry message is adjusted to a time that is the third time interval from the current time. Since the third time interval is greater than the first time interval, it can prevent the problem retry message from being scanned continuously and causing concurrent sending.

[0083] It can be seen that through this embodiment, the abnormality of retry message sending can be avoided by scanning the retry message at a regular interval, thereby achieving the bottom-up effect of retry message sending.

[0084] Figure 3 A schematic diagram of the system architecture of an exception handling method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 As shown in FIG. 1 , the system architecture includes: a main processing thread and an exception processing thread. Figure 3 As shown, the main processing thread can create the acceptance stage of the first document, that is, the document acceptance in the figure. In the acceptance stage, parameter verification indicates that the main processing thread can perform parameter verification on the upstream business request, order assembly indicates that order assembly is performed after the verification passes, document creation indicates that the corresponding first document is created through a database transaction, and task creation indicates that a retry task is created for the first document.

[0085] In addition, the main processing thread can create the promotion stage of the first document, which is the document promotion in the figure. In the promotion stage, the document can be loaded according to the downstream business callback. Promoting downstream one by one means that the main processing thread can promote the downstream processing party to process the first document. The lock judgment means that the main processing thread calls the downstream in turn according to the instruction and updates the instruction status based on the transaction lock judgment. The document update means that the main processing thread opens the transaction lock judgment to update the document based on the instruction execution result. The partial asynchronous processing after promotion means that the main processing thread uses the method defined by the unified promotion context to start the asynchronous thread, asynchronously complete some downstream compensation calls, complete message sending, and some other necessary operations. In the figure, the return value conversion and error code conversion indicate that the main processing thread returns a notification message to the user that the document processing is successful or failed.

[0086] like Figure 3 As shown, the main processing thread can start the exception handling thread after pushing the transaction commit. In the exception handling thread, first wait for the asynchronous processing thread to complete the processing, then determine the pending exceptions based on the document processing information, and determine the processing order of the pending exceptions. Then, handle each pending exception. During processing, a retry message can be sent to the message queue, and the message queue sends the retry message to the main processing thread's transfer interface retry process, thereby retrying the promotion phase. If an exception occurs in the message queue, the exception handling thread directly executes the transfer interface retry process to send a retry message through the RPC remote procedure call (Remote Procedure Call). During exception handling, the exception handling thread can also update the error code of the retry task.

[0087] Figure 3 The architecture in can be deployed in a distributed manner on various servers to implement a distributed document processing service that can prevent concurrent retry messages.

[0088] In summary, through the above embodiments, at least the following technical effects can be achieved: 1. Any exception of the document in this embodiment can be captured by the unified push context in the push phase, and the timed retry can be triggered based on MQ (Message Queue) distribution; 2. Process some downstream threads and the main processing thread asynchronously and separately. The two do not need to be processed synchronously, so that some downstream threads do not consume the resources of the main processing thread, which can greatly optimize the time consumption of the main processing thread; 3. When MQ is abnormal, the system can scan the table and make RPC calls to implement a true weak MQ dependency. 4. The retry message does not depend on the document status. All asynchronous processing threads of the document are executed successfully based on the task guarantee, and the following scenarios can be avoided: A. If the retry is coupled with the document status, when the completion message is sent in the advancement phase, the document may not have been successful in the transaction. If the consumer queries synchronously at this time, the document status queried may not be completed, resulting in inconsistent status; B. No MQ and RPC calls need to be sent in the document update transaction, so you can focus on processing database changes, avoid long database transactions, and ensure the number of available database connections; 5. Effectively support post-processing capabilities (such as rollback, etc.) when document advancement fails, without consuming the time of the main processing thread; 6. In the event of an abnormality, data is distributed to high-priority and low-priority queues based on policies, and can be divided into high-priority processing clusters and low-priority processing clusters. Based on the system architecture mechanism, the high-priority processing cluster is prevented from being backlogged in disasters; 7. MQ splitting can be effectively prevented for forward call exceptions and system retry exceptions.

[0089] 8. Effectively establish an environment isolation mechanism to prevent new function lanes from being streamed to the baseline environment for retry through machine identification and context identification.

[0090] Figure 4 A schematic diagram of the structure of an exception handling device provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the device comprises: The thread starting unit 41 is used to obtain a first document and start an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; The information acquisition unit 42 is used to acquire, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; The exception handling unit 43 is used to determine at least one unprocessed exception of the first document according to the document processing information through the exception handling thread, and to process the unprocessed exception.

[0091] Optionally, the thread starting unit 41 is specifically used for: Creating a unified advancement context as a processing framework for the first document through the main processing thread; Determining, by the main processing thread, based on the unified advancement context, that the main processing thread and the downstream processing service finish processing the first document; Through the main processing thread, after the main processing thread and the downstream processing service finish processing the first document, the exception processing thread is started based on the unified advancement context.

[0092] Optionally, the thread starting unit 41 is further specifically configured to: Summarizing, by the main processing thread, the document processing information reported by the downstream processing service after the processing of the first document is completed based on the unified advancement context, and determining that the processing of the first document by the downstream processing service is completed according to the document processing information reported by the downstream processing service; After the downstream processing service finishes processing the first document, through the main processing thread, a database transaction is created based on the unified promotion context, the first document is processed in the database transaction, and after the database transaction is committed, it is determined that the main processing thread has finished processing the first document.

[0093] Optionally, the exception handling unit 43 is specifically configured to: By means of the exception processing thread, according to the document processing information, determining whether at least one of the main processing thread and the asynchronous processing thread has a processing exception for the first document; If at least one of the main processing thread and the asynchronous processing thread has a processing exception, determining the to-be-processed exception of the first document according to the processing exception of the at least one; If neither the main processing thread nor the asynchronous processing thread has any processing exception, the processing status of the first document is obtained, and at least one to-be-processed exception of the first document is determined according to the processing status of the first document.

[0094] Optionally, the exception handling unit 43 is further specifically configured to: If a specific type of processing exception exists in the main processing thread or the asynchronous processing thread, the specific type of processing exception is processed, and if a processing exception is obtained after the processing, the processing exception is used as a pending exception of the first document; If the main processing thread or the asynchronous processing thread has a processing exception other than a specific type of processing exception, the processing exception other than the specific type of processing exception is treated as a to-be-processed exception of the first document.

[0095] Optionally, the exception handling unit 43 is further specifically configured to: If the processing status of the first document indicates that the processing of the first document is complete, the retry task is deleted, and when a deletion exception occurs, the deletion exception is determined as a pending exception of the first document; the retry task is used to process the pending exception of the first document; If the processing status of the first document indicates that the first document has not been processed, determine whether the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document based on the document processing information, and determine the unprocessed exception of the first document based on the judgment result.

[0096] Optionally, the exception handling unit 43 is further specifically configured to: If the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document, the non-abnormal processing result with the specific error identifier is used as a pending abnormality of the first document; If the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained and the catch-all exception is used as a pending exception for the first document.

[0097] Optionally, the exception handling unit 43 is specifically configured to: Determining the processing order of each of the to-be-processed exceptions through the exception processing thread; Through the exception processing thread, each of the exceptions to be processed is processed according to the processing order of each of the exceptions to be processed.

[0098] Optionally, the exception handling unit 43 is further specifically configured to: Determine the processing order of each of the exceptions to be processed according to the following order from front to back: Processing exceptions other than specific types of processing exceptions of the main processing thread of the first document; The asynchronous processing thread of the first document processes exceptions other than a specific type of processing exceptions; the asynchronous processing thread is another asynchronous thread other than the exception processing thread opened by the main processing thread for the first document; A processing exception obtained after processing a specific type of processing exception of the main processing thread; A processing exception obtained after processing a specific type of processing exception of the asynchronous processing thread; When the processing status of the first document indicates that the processing of the first document is completed, the deletion exception generated by the retry task is deleted; the retry task is used to process the pending exception of the first document; When the processing status of the first document indicates that the first document has not been processed, the non-abnormal processing result with a specific error identifier reported by the downstream processing service of the first document for the first document; When the processing status of the first document indicates that the first document has not been processed, and the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained.

[0099] Optionally, the exception handling unit 43 is further specifically configured to: According to the processing order of each of the pending exceptions, determining the pending exception that currently needs to be processed as the target exception; If the target exception is a forward call exception, the error code of the target exception is updated to the retry task according to the optimistic locking technology. After the update is successful, the target exception is processed by reprocessing the first document; the retry task is used to process the target exception; If the target exception is a system retry exception, the retry number of the first document is updated according to the optimistic locking technology and the number of retries of the first document corresponding to the target exception. After the update is successful, the target exception is handled by reprocessing the first document.

[0100] Optionally, the exception handling unit 43 is further specifically configured to: Generate a retry message corresponding to the target exception, and determine a retry delay of the retry message; The retry message is sent to the main processing thread; the retry message is used to reprocess the first document based on the retry delay.

[0101] Optionally, the exception handling unit 43 is further specifically configured to: According to the time interval between the retry message and the next retry, the retry message is placed in the corresponding message queue; The retry message is sent to the main processing thread through the message queue where the retry message is located.

[0102] Optionally, the exception handling unit 43 is further specifically configured to: Scanning the retry messages corresponding to the exceptions to be processed based on a first time interval, the first time interval is greater than a second time interval; the second time interval is obtained based on the time interval between the retry message and the next retry; If a problem retry message whose sending time has been reached but has not been sent to the main processing thread is scanned in each of the retry messages, the problem retry message is sent to the main processing thread, and the next retry time of the problem retry message is adjusted to a time that is a third time interval from the current time; the third time interval is greater than the first time interval.

[0103] The exception handling device in the embodiment of the present disclosure can implement each process of the above-mentioned exception handling method embodiment and achieve the same effect and function, which will not be repeated here.

[0104] An embodiment of the present disclosure further provides an electronic device, Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and one or more applications or data may be stored in the memory 502. Among them, the memory 502 may be a temporary storage or a permanent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 501 may be configured to communicate with the memory 502 to execute a series of computer executable instructions in the memory 502 on the electronic device. The electronic device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input or output interfaces 505, one or more keyboards 506, etc.

[0105] In a specific embodiment, the electronic device includes a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor implements the following process: Obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; Obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; Through the exception processing thread, at least one unprocessed exception of the first document is determined according to the document processing information, and the unprocessed exception is processed.

[0106] The electronic device in the embodiment of the present disclosure can implement each process of the above-mentioned exception handling method embodiment and achieve the same effect and function, which will not be repeated here.

[0107] Another embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following process is implemented: Obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; Obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; Through the exception processing thread, at least one unprocessed exception of the first document is determined according to the document processing information, and the unprocessed exception is processed.

[0108] The computer-readable storage medium in the embodiment of the present disclosure can implement each process of the above-mentioned exception handling method embodiment and achieve the same effect and function, which will not be repeated here.

[0109] Another embodiment of the present disclosure further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following process is implemented: Obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; the exception processing thread is an asynchronous thread of the main processing thread; Obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; Through the exception processing thread, at least one unprocessed exception of the first document is determined according to the document processing information, and the unprocessed exception is processed.

[0110] The computer program product in the embodiment of the present disclosure can implement each process of the above-mentioned exception handling method embodiment and achieve the same effect and function, which will not be repeated here.

[0111] In various embodiments of the present disclosure, the computer-readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0112] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0113] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0114] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0115] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of the present disclosure, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0116] It should be understood by those skilled in the art that one or more embodiments of the present disclosure may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0117] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0119] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0120] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0121] One or more embodiments of the present disclosure may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present disclosure may also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0122] Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0123] The above description is only an embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims of the present disclosure.

Claims

1. An exception handling method, characterized in that: include: Obtaining a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; The exception processing thread is an asynchronous thread of the main processing thread; Obtaining, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; Through the exception processing thread, at least one unprocessed exception of the first document is determined according to the document processing information, and the unprocessed exception is processed.

2. The method according to claim 1, characterized in that The step of starting an exception processing thread for the first document through the main processing thread of the first document includes: Creating a unified advancement context as a processing framework for the first document through the main processing thread; Determining, by the main processing thread, based on the unified advancement context, that the main processing thread and the downstream processing service finish processing the first document; Through the main processing thread, after the main processing thread and the downstream processing service finish processing the first document, the exception processing thread is started based on the unified advancement context.

3. The method according to claim 2, characterized in that The determining, by the main processing thread, based on the unified advancement context, that the main processing thread and the downstream processing service finish processing the first document includes: Summarizing, by the main processing thread, the document processing information reported by the downstream processing service after the processing of the first document is completed based on the unified advancement context, and determining that the processing of the first document by the downstream processing service is completed according to the document processing information reported by the downstream processing service; After the downstream processing service finishes processing the first document, through the main processing thread, a database transaction is created based on the unified promotion context, the first document is processed in the database transaction, and after the database transaction is committed, it is determined that the main processing thread has finished processing the first document.

4. The method according to claim 1, characterized in that: The determining, through the exception processing thread, at least one to-be-processed exception of the first document according to the document processing information, includes: By means of the exception processing thread, according to the document processing information, determining whether at least one of the main processing thread and the asynchronous processing thread has a processing exception for the first document; If at least one of the main processing thread and the asynchronous processing thread has a processing exception, determining the to-be-processed exception of the first document according to the processing exception of the at least one; If neither the main processing thread nor the asynchronous processing thread has any processing exception, the processing status of the first document is obtained, and at least one to-be-processed exception of the first document is determined according to the processing status of the first document.

5. The method according to claim 4, characterized in that The determining, according to the processing exception of the at least one, the to-be-processed exception of the first document comprises: If a specific type of processing exception exists in the main processing thread or the asynchronous processing thread, the specific type of processing exception is processed, and if a processing exception is obtained after the processing, the processing exception is used as a pending exception of the first document; If the main processing thread or the asynchronous processing thread has a processing exception other than a specific type of processing exception, the processing exception other than the specific type of processing exception is treated as a to-be-processed exception of the first document.

6. The method according to claim 4, characterized in that The determining, according to the processing status of the first document, at least one to-be-processed exception of the first document includes: If the processing status of the first document indicates that the processing of the first document is complete, the retry task is deleted, and when a deletion exception occurs, the deletion exception is determined as a pending exception of the first document; the retry task is used to process the pending exception of the first document; If the processing status of the first document indicates that the first document has not been processed, determine whether the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document based on the document processing information, and determine the unprocessed exception of the first document based on the judgment result.

7. The method according to claim 6, characterized in that The determining, according to the judgment result, the exception to be processed of the first document includes: If the downstream processing service of the first document reports a non-abnormal processing result with a specific error identifier for the first document, the non-abnormal processing result with the specific error identifier is used as a pending abnormality of the first document; If the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained and the catch-all exception is used as a pending exception for the first document.

8. The method according to claim 1, characterized in that The processing of the to-be-processed exception includes: Determining the processing order of each of the to-be-processed exceptions through the exception processing thread; Through the exception processing thread, each of the exceptions to be processed is processed according to the processing order of each of the exceptions to be processed.

9. The method according to claim 8, characterized in that Determining the processing order of each of the to-be-processed exceptions includes: Determine the processing order of each of the exceptions to be processed according to the following order from front to back: Processing exceptions other than specific types of processing exceptions of the main processing thread of the first document; The asynchronous processing thread of the first document processes exceptions other than a specific type of processing exceptions; the asynchronous processing thread is another asynchronous thread other than the exception processing thread opened by the main processing thread for the first document; A processing exception obtained after processing a specific type of processing exception of the main processing thread; A processing exception obtained after processing a specific type of processing exception of the asynchronous processing thread; When the processing status of the first document indicates that the processing of the first document is completed, the deletion exception generated by the retry task is deleted; the retry task is used to process the pending exception of the first document; When the processing status of the first document indicates that the first document has not been processed, the non-abnormal processing result with a specific error identifier reported by the downstream processing service of the first document for the first document; When the processing status of the first document indicates that the first document has not been processed, and the downstream processing service of the first document does not report a non-exceptional processing result with a specific error identifier for the first document, a catch-all exception is obtained.

10. The method according to claim 8, characterized in that The processing of each of the to-be-processed exceptions according to the processing order of each of the to-be-processed exceptions includes: According to the processing order of each of the pending exceptions, determining the pending exception that currently needs to be processed as the target exception; If the target exception is a forward call exception, the error code of the target exception is updated to the retry task according to the optimistic locking technology. After the update is successful, the target exception is processed by reprocessing the first document; the retry task is used to process the target exception; If the target exception is a system retry exception, the retry number of the first document is updated according to the optimistic locking technology and the number of retries of the first document corresponding to the target exception. After the update is successful, the target exception is handled by reprocessing the first document.

11. The method according to claim 10, characterized in that The processing of the target exception by reprocessing the first document includes: Generate a retry message corresponding to the target exception, and determine a retry delay of the retry message; The retry message is sent to the main processing thread; the retry message is used to reprocess the first document based on the retry delay.

12. The method according to claim 11, characterized in that The sending the retry message to the main processing thread includes: According to the time interval between the retry message and the next retry, the retry message is placed in the corresponding message queue; The retry message is sent to the main processing thread through the message queue where the retry message is located.

13. The method according to claim 12, characterized in that Also includes: Scanning the retry messages corresponding to the exceptions to be processed based on a first time interval, the first time interval is greater than a second time interval; the second time interval is obtained based on the time interval between the retry message and the next retry; If a problem retry message whose sending time has been reached but has not been sent to the main processing thread is scanned in each of the retry messages, the problem retry message is sent to the main processing thread, and the next retry time of the problem retry message is adjusted to a time that is a third time interval from the current time; the third time interval is greater than the first time interval.

14. An exception handling device, characterized in that: include: A thread starting unit, used for acquiring a first document, and starting an exception processing thread for the first document through a main processing thread of the first document; The exception processing thread is an asynchronous thread of the main processing thread; an information acquisition unit, configured to acquire, through the exception processing thread, document processing information reported by each processing party of the first document after processing the first document; the each processing party includes the main processing thread, the asynchronous processing thread of the first document, and the downstream processing service of the first document; the asynchronous processing thread is another asynchronous thread of the main processing thread except the exception processing thread; The exception handling unit is used to determine at least one unprocessed exception of the first document according to the document processing information through the exception handling thread, and to handle the unprocessed exception.

15. An electronic device, characterized in that: include: processor; as well as, A memory configured to store computer executable instructions, which, when executed, cause the processor to implement the steps of the method according to any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the steps of the method described in any one of claims 1 to 13.

17. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.