Business status management method and device
By recording abnormal status in the business status table and updating it regularly, combined with synchronous and asynchronous process processing, the problem of data inconsistency in cross-system interaction is solved, the business processing time is shortened, and the stability of the system is improved.
Patent Information
- Application Number
- CN201811023091.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-03
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2038-09-03
AI Technical Summary
In the process of multiple systems working together, data inconsistencies caused by cross-system interactions, especially when the network environment is poor, may lead to extended business processing cycles and the risk of deadlock.
By recording abnormal status in the business status table, regularly obtaining the latest processing results of external systems, updating the business status, using synchronous processes to process requests and combining asynchronous processes for data compensation, we ensure data consistency between systems.
It shortens the business processing time, improves the data consistency and robustness of the system, avoids the risk of transaction rollback and deadlock, and ensures the accuracy of the business status.
Smart Images

Figure CN110874713B_ABST
Abstract
Description
Background Art
[0002] With the rapid development of the Internet, the demands for various Internet services are becoming more and more diversified and personalized. For example, in e-commerce platforms, the demands for transactions, refunds, logistics, online communication, etc. are becoming more and more specific, and the related processing procedures are becoming more and more complicated. In order to improve the system processing capacity and maintenance convenience, multiple systems are often run independently, and each system handles a specific type of business. However, as the systems become independent, the scenarios of system interaction become more frequent. The realization of a business often requires the collaboration of multiple systems. Ensuring data consistency between systems during the collaborative work process is an important issue that needs to be solved in this field.
[0003] In the related art, when a business request requires coordination between system A and system B, that is, system A is the server providing external services, system B is the support end, and system B provides services to system A, the entire business process requires system A to first process part of the business data of the business request and then call system B to process other data of the business request, and update the business status in system A according to the processing status feedback of system B. If a business processing exception is returned when system A calls system B, system A will roll back the transaction and reprocess the business request.
[0004] Since the cross-system interaction process is often affected by the network environment, the network environment is relatively poor during peak traffic periods. Even if system B returns a business processing abnormality, it is possible that system B processes the business normally after receiving the request, but system A receives the business processing abnormality due to a communication timeout. At this time, system A rolls back the transaction based on the abnormal status, but system B retains the processing data of this business, causing data inconsistency. In this case, the business processing cycle is extended, the database processing capacity is reduced, and if there is a locking operation on the data during the processing, the possibility of deadlock will increase.
[0005] Therefore, there is a need for a business status management method that can shorten the business processing cycle and maintain data consistency between systems.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0007] The purpose of the present disclosure is to provide a service status management method and a service status management device, which are used to overcome the problem of data inconsistency between systems caused by the limitations and defects of related technologies at least to a certain extent.
[0008] According to a first aspect of an embodiment of the present disclosure, a business status management method is provided, comprising: when calling an external system to process a business request, obtaining a processing result of the business request by the external system; when it is judged that the processing result is abnormal, recording in a business status table that the business status of the business request is an abnormal state, and continuing to process the next business request; periodically obtaining from the external system the latest processing results of multiple business requests corresponding to the abnormal state; and updating the business status table according to the latest processing result.
[0009] In an exemplary embodiment of the present disclosure, the periodically obtaining from the external system the latest processing results of the service requests corresponding to the abnormal statuses includes:
[0010] Obtaining a preset compensation period corresponding to each service type according to the service types of the service requests corresponding to the plurality of abnormal states;
[0011] According to the preset compensation period, the latest processing result of the business request in the abnormal state corresponding to the business type is obtained from the external system.
[0012] In an exemplary embodiment of the present disclosure, updating the service status table according to the latest processing result includes:
[0013] If the latest processing result is normal, updating the status of the service request corresponding to the latest processing result to a normal status in the service status table;
[0014] If the latest processing result is abnormal, the number of times the service request has been compensated is increased by 1.
[0015] In an exemplary embodiment of the present disclosure, updating the service status table according to the latest processing result further includes:
[0016] When the latest processing result of a service request is abnormal, obtaining a preset maximum number of compensation times and a preset alarm action corresponding to the service request;
[0017] If the compensated number of times is equal to the preset maximum number of times, the state of the service request is updated to an alarm state and the preset alarm action is executed.
[0018] In an exemplary embodiment of the present disclosure, the obtaining of a preset maximum number of compensation times and a preset alarm action corresponding to the service request includes:
[0019] Obtain the preset maximum number of compensation times and the preset alarm action of the service type corresponding to the service request.
[0020] In an exemplary embodiment of the present disclosure, the periodically obtaining from the external system the latest processing results of the service requests corresponding to the abnormal statuses includes:
[0021] Obtaining the service type of the service request whose service status is abnormal recorded in the service status table;
[0022] Obtain the compensation logic corresponding to the business type through the factory class, the compensation logic including a preset compensation period, a number of compensations completed, a preset maximum number of compensations, and a preset alarm action;
[0023] Assembling request parameters of the scheduled task according to the compensation logic;
[0024] The scheduled task is called to obtain from the external system the latest processing result of each business request in the business type corresponding to the scheduled task.
[0025] In an exemplary embodiment of the present disclosure, when it is determined that the processing result is abnormal, recording in the service status table that the service status of the service request is an abnormal status includes:
[0026] When it is judged that the processing result is abnormal, a business status record of the business request is generated in the business status table, recording the business type, the preset maximum number of compensations and the preset alarm action of the business request, recording the number of compensated times as 0, and recording the business status as abnormal.
[0027] According to a second aspect of an embodiment of the present disclosure, a service status management device is provided, including:
[0028] A synchronization status acquisition module, configured to obtain a processing result of the external system on the business request when calling the external system to process the business request;
[0029] A synchronization status update module, configured to record the business status of the business request as an abnormal state in a business status table when judging that the processing result is abnormal, and continue to process the next business request;
[0030] An asynchronous status acquisition module, configured to periodically acquire the latest processing results of the business requests corresponding to the abnormal status from the external system;
[0031] The asynchronous status update module is configured to update the service status table according to the latest processing result.
[0032] According to a third aspect of the present disclosure, a service status management device is provided, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any one of the above methods based on instructions stored in the memory.
[0033] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a program is stored, and when the program is executed by a processor, the service status management method as described in any one of the above items is implemented.
[0034] The disclosed embodiment uses a synchronous process to process business requests and record abnormal business status returned by an external system, and uses a timed asynchronous process to uniformly retrieve the latest processing results of abnormal business from the external system and update the business status. This can shorten the business processing time while maintaining data consistency between systems in a timely manner.
[0035] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0037] Figure 1 is a flow chart of a service status management method in an exemplary embodiment of the present disclosure.
[0038] Figure 2 It is a sub-flow chart of the service status management method in the exemplary embodiment of the present disclosure.
[0039] Figure 3 It is a sub-flow chart of the service status management method in the exemplary embodiment of the present disclosure.
[0040] Figure 4 It is a sub-flow chart of the service status management method in the exemplary embodiment of the present disclosure.
[0041] Figure 5 It is a sub-flow chart of the service status management method in the exemplary embodiment of the present disclosure.
[0042] Figure 6 It is a block diagram of a service status management method in an exemplary embodiment of the present disclosure.
[0043] Figure 7 yes Figure 6 A synchronization flow chart of the service status management method in the illustrated embodiment.
[0044] Figure 8 yes Figure 6 An asynchronous flow chart of the service status management method in the illustrated embodiment.
[0045] Fig. 9It is a block diagram of a service status management device in an exemplary embodiment of the present disclosure.
[0046] Fig.10 is a block diagram of an electronic device in an exemplary embodiment of the present disclosure.
[0047] Fig.11 is a schematic diagram of a computer-readable storage medium in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0049] In addition, the accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities, which do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0050] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0051] Figure 1 The flowchart of the service status management method in the exemplary embodiment of the present disclosure is schematically shown. Figure 1 , the service status management method 100 may include:
[0052] Step S1, when calling an external system to process a business request, obtaining a processing result of the external system on the business request;
[0053] Step S2, when it is determined that the processing result is abnormal, the service status of the service request is recorded as an abnormal status in the service status table, and the next service request is processed;
[0054] Step S3, regularly obtaining the latest processing results of multiple business requests corresponding to the abnormal status from the external system;
[0055] Step S4: update the service status table according to the latest processing result.
[0056] The disclosed embodiment uses a synchronous process to process business requests and record abnormal business status returned by an external system, and uses a timed asynchronous process to uniformly retrieve the latest processing results of abnormal business from the external system and update the business status. This can shorten the business processing time while maintaining data consistency between systems in a timely manner.
[0057] Next, each step of the service status management method 100 is described in detail.
[0058] In step S1, when an external system is called to process a business request, a processing result of the external system on the business request is obtained.
[0059] When a business request needs to call an external support system for processing, the external system corresponding to the business request can be called normally, and the business processing results can be obtained by timed reading or passive reception.
[0060] Figure 2 It is a sub-flowchart of step S1.
[0061] refer to Figure 2 In one embodiment of the present disclosure, step S1 may include:
[0062] Step S11, receiving an external business processing request and performing parameter verification;
[0063] Step S12, start the transaction and generate business-related data;
[0064] Step S13, committing the transaction;
[0065] Step S14, assembling request parameters according to the agreement of the preset interface, and sending a business request to the external system through a predetermined interface calling protocol (for example: http, hessian, dubble, etc.).
[0066] In step S2, when it is determined that the processing result is abnormal, the service status of the service request is recorded as an abnormal status in the service status table, and the next service request is processed continuously.
[0067] When it is judged that the processing result is abnormal, a business status record of the business request can be first generated in the business status table, recording the business identifier, business type identifier, preset maximum number of compensations and preset alarm action of the business request, recording the number of compensations as 0, and recording the business status as abnormal.
[0068] The preset maximum number of compensation times and the preset alarm action can be determined according to the service type or according to the service.
[0069] In some embodiments, the above process of generating the business status record may also be completed before the transaction is submitted in step S13, and the present disclosure does not impose any special limitation on this.
[0070] If the process of generating the business status record is completed before step S13, if the processing result of a business request by the external system is normal, the business status can be recorded as normal, and a new transaction can be started to process the remaining business data of this system, and finally the transaction can be submitted to complete this business request.
[0071] If the processing result of a business request by the external system is obtained as abnormal or failed, the status of the business request is recorded as an abnormal status, and then the request is terminated and waits for the asynchronous compensation process to process.
[0072] By recording the abnormal status when the processing result is abnormal and continuing to process the next business request, transaction rollback can be avoided, business processing time can be shortened, and business processing efficiency can be improved.
[0073] In step S3, the latest processing results of the business requests corresponding to the abnormal status are obtained from the external system at a regular interval.
[0074] Figure 3 It is a sub-flowchart of step S3.
[0075] refer to Figure 3 In one embodiment of the present disclosure, step S3 may include:
[0076] Step S31, obtaining a preset compensation period corresponding to each service type according to the service types of the service requests corresponding to the plurality of abnormal states;
[0077] Step S32: acquiring, from the external system according to the preset compensation period, the latest processing result of the service request in the abnormal state corresponding to the service type.
[0078] The preset compensation period corresponding to each service type can be obtained, and the latest processing result of the abnormal service under the service type can be obtained according to the preset compensation period.
[0079] In other embodiments, the preset compensation period corresponding to each service may be obtained, and abnormal services with the same preset compensation period may be centrally processed, and a scheduled task may be called to complete the task of obtaining the latest processing results of multiple abnormal services with the same preset compensation period.
[0080] Figure 4It is a sub-flowchart of step S3.
[0081] refer to Figure 4 In one embodiment of the present disclosure, step S3 may include:
[0082] Step S33, obtaining the service type of the service request whose service status is abnormal recorded in the service status table;
[0083] Step S34, obtaining the compensation logic corresponding to the service type through the factory class, the compensation logic including a preset compensation period, a number of compensations completed, a preset maximum number of compensations, and a preset alarm action;
[0084] Step S35, assembling request parameters of the scheduled task according to the compensation logic;
[0085] Step S36, calling the scheduled task to obtain from the external system the latest processing result of each business request in the business type corresponding to the scheduled task.
[0086] exist Figure 4 In the illustrated embodiment, a scheduled task may be started first to scan service requests with abnormal service status (abnormal services), which include service requests that have failed to be compensated or are to be compensated, and the number of compensations is less than the preset maximum number of compensations.
[0087] Next, the abnormal business can be classified according to the business type identifier of the scanned abnormal business, and the corresponding business processing logic can be obtained through the factory class program. The business logic can mainly include: querying all the data requesting compensation services through the business identifier; assembling the request parameters according to the requirements of the compensation service; calling the compensation service. Among them, the compensation service is used to obtain the latest processing results of the business request from the external system.
[0088] In step S4, the service status table is updated according to the latest processing result.
[0089] Figure 5 It is a sub-flowchart of step S4 in the embodiment of the present disclosure.
[0090] refer to Figure 5 In one embodiment, step S4 may include:
[0091] Step S41: if the latest processing result is normal, updating the status of the service request corresponding to the latest processing result in the service status table to a normal status;
[0092] Step S42: if the latest processing result is abnormal, the number of times the service request has been compensated is increased by 1;
[0093] Step S43, obtaining a preset maximum compensation number and a preset alarm action corresponding to the service request;
[0094] Step S44: if the number of times compensated is equal to the preset maximum number, the state of the service request is updated to an alarm state and the preset alarm action is executed.
[0095] Among them, step S43 can also be to obtain the preset maximum compensation times and preset alarm action of the service type corresponding to the service request.
[0096] Compared with the related art that uses the transaction function of MySql in conjunction with Java's Timer (a tool class in the Java thread that specifies the time or period to run tasks, and executes tasks by calling the TimerTask implementer) and Schedule Executor to design a solution, the embodiment of the present disclosure achieves the scalability of business access by using a factory class, so that each business can independently customize its own compensation mechanism and early warning mechanism.
[0097] exist Figure 5 In the illustrated embodiment, by recording the number of times a service request has been compensated, an extreme number of times can be set for the data compensation behavior to prevent unlimited requests from wasting system resources.
[0098] The above method 100 is described in detail below through a specific application scenario.
[0099] Figure 6 It is a block diagram of one embodiment of the present disclosure.
[0100] refer to Figure 6 In the embodiment of the present disclosure, the service status module 63 and the service compensation module 64 can be set in the system A to achieve Figure 1 to Figure 5 The method shown.
[0101] System A may mainly include a business data processing module 61 , an external system access module 62 , a business status module 63 and a business compensation module 64 .
[0102] Among them, the business data processing module 61 runs in real time to process business requests. When it is necessary to call an external system to process a business request, it calls the external system access module 62 to access system B to obtain a response, and records the response data of system B in the business status module 63.
[0103] The external system access module 62 includes multiple interfaces and interface protocols for accessing external systems.
[0104] The service status module 63 may be composed of a service status maintenance unit 631 and a service processing factory 632 .
[0105] The business status maintenance unit 631 module can mainly include a business status table, which can mainly include the following fields: business ID, business type ID, compensation status, compensation retry times, and maximum allowed compensation times. The business ID marks the only business request in the system. The requirement for the business ID is that all data that completes this business request can be found according to the business ID association, that is, all business request data of the request service party can be found through the query of the business ID; the business type ID is used to mark a type of business in the system, so that the business compensation module 64 can obtain the corresponding business process according to the business type ID; the compensation status is an identification of whether the business compensation is successful or not, which can include three states: "pending compensation", "compensation success", and "compensation failure"; the compensation retry times records the number of times the business is called by the compensation module, and the compensation retry times are increased by one each time it is called; the preset maximum compensation times are the maximum number of times the business corresponding to the business ID is allowed to be called by the compensation module. Business status record maintenance mainly provides business status record generation services and business status record update services.
[0106] The business processing factory 632 is a factory class, which can obtain the corresponding business compensation logic through the business type ID to ensure that the needs of multiple business types are met at the same time.
[0107] The service state maintenance unit 631 may be read by the service processing factory 632 to obtain the service compensation logic corresponding to the service request whose service state is an abnormal state.
[0108] The business compensation module 64 is a task scheduling work set. A task scheduling is a scheduled task. The business compensation module 64 is a work set composed of many scheduled tasks. Each business can define its own scheduling rules in the business compensation module 64. The scheduling rules include the execution time, the maximum number of times the task is attempted to be executed, and the operation to be performed when the number of attempts reaches the preset maximum number of compensations. The operation of the business compensation module 64 requires that the interface service of the external system access module 62 has idempotence (the interface supports repeated calls, and for the logic that has been successfully processed, multiple calls return the same result) or supports the query status function.
[0109] The business compensation module 64 periodically scans the business status module 63, and assembles scheduled tasks according to the business compensation logic of each abnormal business request recorded in the business processing factory 632. Each scheduled task calls the external system access module 62 to obtain the latest processing result of each abnormal business request. The business compensation module 63 accesses the business status module 63 again, modifies the status of the business request with the latest processing result being normal and the number of compensations corresponding to the business request with the latest processing result being abnormal, and executes the corresponding alarm logic when the number of compensations reaches the preset maximum number of compensations.
[0110] In short, in Figure 6 In the illustrated embodiment, the actions of system A can be divided into synchronous processes and asynchronous processes.
[0111] Figure 7 yes Figure 6 A schematic diagram of the synchronization process in the illustrated embodiment.
[0112] refer to Figure 7 , the synchronization process can include:
[0113] Step S71, the business data processing module 61 receives an external business processing request;
[0114] Step S72, perform parameter verification, if the verification is successful, proceed to step S73;
[0115] Step S73, the business data processing module 61 starts a transaction and generates business-related data;
[0116] Step S74, the business status module 63 generates a business status record and submits the transaction, wherein the business ID of the generated business status record is the ID of this business, the business type ID is the business type ID corresponding to the business of this type, one business corresponds to a unique business type ID, the compensation state is set to "pending compensation", the number of compensation retries is set to 0, and the maximum allowed number of compensations is set to the preset value of the business. The preset value corresponding to each business can be specified according to actual needs;
[0117] Step S75, the business data processing module 61 assembles the request parameters according to the interface agreement, and sends the business request to the external system by calling a predetermined interface calling protocol (for example, http, hessian, dubble, etc.) through the external system access module 62;
[0118] Step S76, after the external system access module returns the response information, the business data processing module 61 determines the processing result. If the response is successful (processing is normal), it goes to step S77 to first start a new transaction, and then processes the remaining business data of this system, calls the business status record update service of the business status module 63, updates the compensation status of the business record to "compensation successful", and finally submits the transaction to complete this business request; if an exception or failure occurs outside the request, it goes to step S78 to call the business status record update service of the business status module 63, updates the compensation status of the business record to "compensation failed", and then ends this request and waits for the asynchronous compensation process to be processed.
[0119] Figure 8 yes Figure 6 A schematic diagram of an asynchronous process in the illustrated embodiment.
[0120] refer to Figure 8, an asynchronous process can include:
[0121] Step S81, the timer in the service compensation module 64 is started, and the service status module 63 is scanned;
[0122] Step S82, determine whether there is a service compensation record that meets the compensation conditions. The compensation conditions are generally: the compensation status is compensation failure or pending compensation, and the number of compensations is less than the maximum allowed number of compensations. If there is, proceed to S83;
[0123] Step S83, the business compensation module 64 requests the business processing factory 632 of the business status module 63 according to the business type ID in the business compensation record to obtain the corresponding business processing logic; wherein the business processing logic may mainly include: querying all data for calling the external system access module through the business ID; assembling request parameters according to the requirements of the external system access module; calling the external system access module;
[0124] Step S84, assembling a scheduled task according to the acquired business processing logic, and calling the external system access module 62 to obtain the latest processing result;
[0125] Step S85, when the external system access module 62 responds, the processing result is determined. If the processing result is normal (the request response is successful), the process proceeds to step S86, calling the business status record service of the business status module 63 to update the compensation status of the business record to "compensation success", and notifying the business data processing module 61 to start the transaction, process the remaining logic, and commit the transaction;
[0126] If the processing result is abnormal (the request response fails or is abnormal), the process goes to step S87, calling the business status record update service of the business status module 63 to update the compensation status of the business record to "compensation failure", and adding one to the "compensation retry count";
[0127] Step S88, determine whether the preset maximum number of compensation times is exceeded, and if exceeded, call the alarm logic of the service.
[0128] The business state management method for ensuring data consistency during cross-system interaction provided by the disclosed embodiment makes up for the business risks brought by inconsistent data during cross-system interaction. It can solve the data consistency problem during cross-system calls without relying on too many peripheral components, split the original super-long cross-system transactions, and shorten the business processing time. The robustness of the system is guaranteed by calling the asynchronous data compensation function while the synchronous process is running. In addition, the scalability of business access is achieved through the factory class method, so that each business can independently customize its own compensation mechanism and early warning mechanism; the business track is recorded to a certain extent. Once the external system is called abnormally, the status of the current business can be reflected through the submitted data and business record status table of this system, avoiding the situation that there is no business data trace to reflect the business process, the external system has data, but the upstream caller system has no data to check. This solution can guarantee the order of all businesses to a certain extent. As long as the external system successfully processes the business request, the caller system will definitely obtain correct feedback through the compensation mechanism.
[0129] Corresponding to the above method embodiment, the present disclosure also provides a service status management device, which can be used to execute the above method embodiment.
[0130] Fig. 9 A block diagram schematically shows a service status management device in an exemplary embodiment of the present disclosure.
[0131] refer to Fig. 9 , the service status management device 90 may include:
[0132] The synchronization status acquisition module 91 is configured to obtain the processing result of the external system on the business request when calling the external system to process the business request;
[0133] The synchronization status update module 92 is configured to record the business status of the business request as an abnormal state in the business status table when judging that the processing result is abnormal, and continue to process the next business request;
[0134] An asynchronous state acquisition module 93 is configured to periodically acquire the latest processing results of the business requests corresponding to the abnormal states from the external system;
[0135] The asynchronous status updating module 94 is configured to update the service status table according to the latest processing result.
[0136] The asynchronous state acquisition module 93 is set as:
[0137] Obtaining a preset compensation period corresponding to each service type according to the service types of the service requests corresponding to the plurality of abnormal states;
[0138] According to the preset compensation period, the latest processing result of the business request in the abnormal state corresponding to the business type is obtained from the external system.
[0139] In an exemplary embodiment of the present disclosure, the asynchronous state updating module 94 is configured as follows:
[0140] If the latest processing result is normal, updating the status of the service request corresponding to the latest processing result to a normal status in the service status table;
[0141] If the latest processing result is abnormal, the number of times the service request has been compensated is increased by 1.
[0142] In an exemplary embodiment of the present disclosure, the asynchronous state updating module 94 is configured as follows:
[0143] When the latest processing result of a service request is abnormal, obtaining a preset maximum number of compensation times and a preset alarm action corresponding to the service request;
[0144] If the compensated number of times is equal to the preset maximum number of times, the state of the service request is updated to an alarm state and the preset alarm action is executed.
[0145] In an exemplary embodiment of the present disclosure, the obtaining of a preset maximum number of compensation times and a preset alarm action corresponding to the service request includes:
[0146] Obtain the preset maximum number of compensation times and the preset alarm action of the service type corresponding to the service request.
[0147] In an exemplary embodiment of the present disclosure, the asynchronous state acquisition module 93 is configured as follows:
[0148] Obtaining the service type of the service request whose service status is abnormal recorded in the service status table;
[0149] Obtain the compensation logic corresponding to the business type through the factory class, the compensation logic including a preset compensation period, a number of compensations completed, a preset maximum number of compensations, and a preset alarm action;
[0150] Assembling request parameters of the scheduled task according to the compensation logic;
[0151] The scheduled task is called to obtain from the external system the latest processing result of each business request in the business type corresponding to the scheduled task.
[0152] In an exemplary embodiment of the present disclosure, the synchronization status update module 92 is configured as follows:
[0153] When it is judged that the processing result is abnormal, a business status record of the business request is generated in the business status table, recording the business type, the preset maximum number of compensations and the preset alarm action of the business request, recording the number of compensated times as 0, and recording the business status as abnormal.
[0154] Since the functions of the device 900 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0155] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0156] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0157] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0158] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present invention will be described. Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0159] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, and a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010).
[0160] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1The steps S1 shown in the figure are as follows: when calling an external system to process a business request, obtaining the processing result of the business request by the external system; step S2: when judging that the processing result is abnormal, recording the business status of the business request as an abnormal state in the business status table, and continuing to process the next business request; step S3: periodically obtaining the latest processing results of multiple business requests corresponding to the abnormal state from the external system; step S4: updating the business status table according to the latest processing result.
[0161] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0162] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0163] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0164] The electronic device 1000 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0165] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0166] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0167] refer to Fig.11 As shown, a program product 1100 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0168] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0169] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0170] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0171] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0172] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0173] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A service status management method, characterized in that: include: When the synchronization process calls an external system to process a business request, it obtains the processing result of the external system on the business request; When the synchronization process determines that the processing result is abnormal, the business status of the business request is recorded as an abnormal state in the business status table, and the next business request is processed; The asynchronous process periodically obtains the latest processing results of the business requests corresponding to the abnormal status from the external system; The asynchronous process updates the service status table according to the latest processing result; When the latest processing result is normal, the asynchronous process notifies the synchronous process to start a transaction corresponding to the business request and process the remaining logic of the business request; Wherein, the periodically obtaining from the external system the latest processing results of the multiple business requests corresponding to the abnormal statuses includes: Obtain a preset compensation period corresponding to the service request corresponding to each abnormal state; The abnormal services with the same preset compensation period are processed centrally, and a scheduled task is called to complete the task of obtaining the latest processing results of service requests corresponding to multiple abnormal states with the same preset compensation period.
2. The service status management method according to claim 1, characterized in that: The updating of the service status table according to the latest processing result comprises: If the latest processing result is normal, updating the status of the service request corresponding to the latest processing result to a normal status in the service status table; If the latest processing result is abnormal, the number of times the service request has been compensated is increased by 1.
3. The service status management method according to claim 2, characterized in that: The updating of the service status table according to the latest processing result further comprises: When the latest processing result of a service request is abnormal, obtaining a preset maximum number of compensation times and a preset alarm action corresponding to the service request; If the number of times of compensation is equal to the preset maximum number of times of compensation, the state of the service request is updated to an alarm state and the preset alarm action is executed.
4. The service status management method according to claim 3, characterized in that: The obtaining of the preset maximum number of compensation times and the preset alarm action corresponding to the service request includes: Obtain the preset maximum number of compensation times and the preset alarm action of the service type corresponding to the service request.
5. The service status management method according to claim 1, characterized in that: When judging that the processing result is abnormal, recording the service status of the service request as an abnormal status in the service status table includes: When it is judged that the processing result is abnormal, a business status record of the business request is generated in the business status table, recording the business type, the preset maximum number of compensations and the preset alarm action of the business request, recording the number of compensated times as 0, and recording the business status as abnormal.
6. A service status management method, characterized in that: include: When the synchronization process calls an external system to process a business request, it obtains the processing result of the external system on the business request; When the synchronization process determines that the processing result is abnormal, the business status of the business request is recorded as an abnormal state in the business status table, and the next business request is processed; The asynchronous process periodically obtains the latest processing results of the business requests corresponding to the abnormal status from the external system; The asynchronous process updates the service status table according to the latest processing result; When the latest processing result is normal, the asynchronous process notifies the synchronous process to start a transaction corresponding to the business request and process the remaining logic of the business request; Wherein, the periodically obtaining from the external system the latest processing results of the multiple business requests corresponding to the abnormal statuses includes: Obtaining the service type of the service request whose service status is abnormal recorded in the service status table; Obtain the compensation logic corresponding to the business type through the factory class, the compensation logic including a preset compensation period, a number of compensations completed, a preset maximum number of compensations, and a preset alarm action; Assembling request parameters of the scheduled task according to the compensation logic; The scheduled task is called to obtain from the external system the latest processing result of each business request in the business type corresponding to the scheduled task.
7. The service status management method according to claim 6, characterized in that: The updating of the service status table according to the latest processing result comprises: If the latest processing result is normal, updating the status of the service request corresponding to the latest processing result to a normal status in the service status table; If the latest processing result is abnormal, the number of times the service request has been compensated is increased by 1.
8. The service status management method according to claim 7, characterized in that: The updating of the service status table according to the latest processing result further comprises: When the latest processing result of a service request is abnormal, obtaining a preset maximum number of compensation times and a preset alarm action corresponding to the service request; If the number of times of compensation is equal to the preset maximum number of times of compensation, the state of the service request is updated to an alarm state and the preset alarm action is executed.
9. The service status management method according to claim 8, characterized in that: The obtaining of the preset maximum number of compensation times and the preset alarm action corresponding to the service request includes: Obtain the preset maximum number of compensation times and the preset alarm action of the service type corresponding to the service request.
10. The service status management method according to claim 6, characterized in that: When judging that the processing result is abnormal, recording the service status of the service request as an abnormal status in the service status table includes: When it is judged that the processing result is abnormal, a business status record of the business request is generated in the business status table, recording the business type, the preset maximum number of compensations and the preset alarm action of the business request, recording the number of compensated times as 0, and recording the business status as abnormal.
11. A service status management device, characterized in that: include: A synchronization status acquisition module, configured to acquire the processing result of the external system on the business request when the synchronization process calls the external system to process the business request; A synchronization status update module, configured to record the business status of the business request as an abnormal state in a business status table when the synchronization process determines that the processing result is abnormal, and continue to process the next business request; An asynchronous state acquisition module, configured to periodically acquire the latest processing results of the business requests corresponding to the abnormal states from the external system in an asynchronous process; an asynchronous status update module, configured so that the asynchronous process updates the business status table according to the latest processing result, and when the latest processing result is normal, notifies the synchronous process to start a transaction corresponding to the business request and processes the remaining logic of the business request; Wherein, the asynchronous state update module is set to: Obtain a preset compensation period corresponding to the service request corresponding to each abnormal state; The abnormal services with the same preset compensation period are processed centrally, and a scheduled task is called to complete the task of obtaining the latest processing results of service requests corresponding to multiple abnormal states with the same preset compensation period.
12. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, wherein the processor is configured to execute the service state management method according to any one of claims 1 to 10 based on instructions stored in the memory.
13. A computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the service status management method according to any one of claims 1 to 10 is implemented.
