TWI753876B - Asynchronous service processing method and its server - Google Patents

Asynchronous service processing method and its server Download PDF

Info

Publication number
TWI753876B
TWI753876B TW106102680A TW106102680A TWI753876B TW I753876 B TWI753876 B TW I753876B TW 106102680 A TW106102680 A TW 106102680A TW 106102680 A TW106102680 A TW 106102680A TW I753876 B TWI753876 B TW I753876B
Authority
TW
Taiwan
Prior art keywords
request
service
service request
polling
asynchronous
Prior art date
Application number
TW106102680A
Other languages
Chinese (zh)
Other versions
TW201732654A (en
Inventor
黃梅龍
Original Assignee
香港商阿里巴巴集團服務有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Publication of TW201732654A publication Critical patent/TW201732654A/en
Application granted granted Critical
Publication of TWI753876B publication Critical patent/TWI753876B/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

本發明提供了一種異步服務處理方法及伺服器。該方法包括:根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料;接收並記錄所述服務提供方返回的所述目標服務請求的結果資料。本發明提供的異步服務處理方法及伺服器,保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 The invention provides an asynchronous service processing method and a server. The method includes: according to the recorded processing details information of each service request, acquiring a service request that needs to re-request result data from a service provider as a target service request; for the target service request, re-sending a polling to the service provider request, so as to request to obtain the result data of the target service request; receive and record the result data of the target service request returned by the service provider. The asynchronous service processing method and server provided by the present invention ensure that the request result data in the service provider is consistent with the data recorded by the service requester, and ensure that the user obtains accurate request result data in time. Labor costs, improve processing efficiency.

Description

異步服務處理方法及其伺服器 Asynchronous service processing method and its server

本發明涉及計算機技術領域,尤其涉及一種異步服務處理方法及伺服器。 The present invention relates to the field of computer technology, and in particular, to an asynchronous service processing method and a server.

目前,有些網路(web)服務系統,為了保障高可靠性,經常會採用多主機冗餘的系統提供服務,其主要架構如圖1所示,包括一台轉發伺服器(為了防止單點故障,通常會有兩台或者多台主備轉發伺服器,如果當前的主轉發伺服器故障則自動切換到備轉發伺服器,但通常同一時間只有一台轉發伺服器投入使用)、多台相同的應用伺服器(每台應用伺服器提供完全相同的服務並且同時運行)和一個資料庫。其工作原理如下:用戶向轉發伺服器發出服務請求,轉發伺服器將該服務請求隨機轉發到任意一台應用伺服器,應用伺服器處理該服務請求的過程中會讀寫資料庫,處理完成後再將結果資料返回給用戶。這種多主機服務系統可以提高系統的穩定性,任何一台伺服器故障不會影響該系統正常提供服務,同時可以同時處理更多的用戶服務請求。 At present, some network (web) service systems, in order to ensure high reliability, often use multi-host redundant systems to provide services. The main architecture is shown in Figure 1, including a forwarding server (in order to prevent single point failures , usually there are two or more active and standby forwarding servers, if the current main forwarding server fails, it will automatically switch to the standby forwarding server, but usually only one forwarding server is put into use at the same time), multiple identical Application servers (each application server provides the exact same service and runs concurrently) and a database. Its working principle is as follows: the user sends a service request to the forwarding server, the forwarding server randomly forwards the service request to any application server, and the application server will read and write the database in the process of processing the service request. Then return the result data to the user. This multi-host service system can improve the stability of the system. The failure of any server will not affect the normal provision of services by the system, and it can handle more user service requests at the same time.

如果圖1所示的多主機服務系統中有調用第三方伺服器的異步請求服務,則其主要架構如圖2所示,在圖1所示的多主機服務系統的基礎上增加了第三方伺服器。若異步請求結果採用輪詢模式,則其工作原理如下:1、用戶通過客戶端向轉發伺服器發出服務請求;2、轉發伺服器將該服務請求隨機轉發到任意一台應用伺服器;3應用伺服器將異步服務請求發送至第三方伺服器;4、應用伺服器接收第三方伺服器返回的異步服務請求成功的響應,該響應中包括異步服務請求的標識;5、應用伺服器根據第三方伺服器返回的該異步服務請求的標識將輪詢請求發送至第三方伺服器,該輪詢請求中包括異步服務請求的標識;6、應用伺服器接收第三方伺服器返回的與異步服務請求的標識對應的請求結果資料;7、應用伺服器根據獲取到的請求結果資料更新資料庫;8、用戶想查詢請求結果資料時,向轉發伺服器發出查詢請求;9、轉發伺服器將該查詢請求隨機轉發到任意一台應用伺服器;10、應用伺服器在資料庫中查詢請求結果資料,並返回給用戶。 If there is an asynchronous request service that calls a third-party server in the multi-host service system shown in Figure 1, its main architecture is shown in Figure 2, and a third-party server is added on the basis of the multi-host service system shown in Figure 1 device. If the asynchronous request result adopts the polling mode, its working principle is as follows: 1. The user sends a service request to the forwarding server through the client; 2. The forwarding server randomly forwards the service request to any application server; 3. The server sends the asynchronous service request to the third-party server; 4. The application server receives the successful response of the asynchronous service request returned by the third-party server, and the response includes the identifier of the asynchronous service request; 5. The application server according to the third-party server The identifier of the asynchronous service request returned by the server sends the polling request to the third-party server, and the polling request includes the identifier of the asynchronous service request; 6. The application server receives the information returned by the third-party server and the asynchronous service request. Identifies the corresponding request result data; 7. The application server updates the database according to the obtained request result data; 8. When the user wants to query the request result data, it sends a query request to the forwarding server; 9. The forwarding server sends the query request Randomly forward it to any application server; 10. The application server queries the request result data in the database and returns it to the user.

在應用伺服器輪詢第三方伺服器的過程中,若應用伺服器因故障或升級發佈停機或網路異常導致應用伺服器無法連接上第三方伺服器,則輪詢停止,資料庫不更新,導致第三方伺服器中的請求結果資料與資料庫中的資料不一致,用戶無法獲知準確的請求結果資料。 During the process of polling the third-party server by the application server, if the application server is unable to connect to the third-party server due to a failure or downtime due to an upgrade release or a network abnormality, the polling will stop and the database will not be updated. As a result, the request result data in the third-party server is inconsistent with the data in the database, and the user cannot obtain the accurate request result data.

為保證第三方伺服器中的請求結果資料與資料庫中的資料一致,確保用戶獲知準確的請求結果資料,現有技術 中通過運維人員手動查詢資料庫中的資料與第三方伺服器中的資料是否一致,來確定未完成輪詢操作的資料,並手動訂正資料庫中未完成輪詢操作的資料來恢復資料,但由於為事後處理,無法保證用戶及時獲知準確的請求結果資料,且人力成本較高,處理效率較低。 In order to ensure that the request result data in the third-party server is consistent with the data in the database, and to ensure that the user knows the accurate request result data, the prior art The operation and maintenance personnel manually query whether the data in the database is consistent with the data in the third-party server to determine the data that has not completed the polling operation, and manually correct the data in the database that has not completed the polling operation to restore the data. However, due to post-processing, users cannot be guaranteed to obtain accurate request result data in a timely manner, and the labor cost is high and the processing efficiency is low.

本發明提供一種異步服務處理方法及伺服器,無需人力參與,即可實現在故障恢復後自動完成未完成的輪詢操作,保證服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,降低了人力成本,提高了處理效率。 The present invention provides an asynchronous service processing method and a server, which can automatically complete unfinished polling operations after fault recovery without human participation, and ensure that the request result data in the service provider is consistent with the data recorded by the service requester. It ensures that users are informed of accurate request result data in a timely manner, reduces labor costs and improves processing efficiency.

為達到上述目的,本發明採用如下技術方案: To achieve the above object, the present invention adopts the following technical solutions:

一方面,本發明提供一種異步服務處理方法,包括:根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料;接收並記錄所述服務提供方返回的所述目標服務請求的結果資料。 In one aspect, the present invention provides an asynchronous service processing method, comprising: obtaining a service request that needs to re-request result data from a service provider as a target service request according to the recorded processing details information of each service request; for the target service request, Re-send a polling request to the service provider to request the result data of the target service request; receive and record the result data of the target service request returned by the service provider.

另一方面,本發明提供一種異步服務處理方法,包括:針對服務請求,執行異步服務處理流程;在執行所述異步服務處理流程的過程中,記錄所述服務請求的處理詳情資訊。 In another aspect, the present invention provides an asynchronous service processing method, comprising: executing an asynchronous service processing flow for a service request; and recording processing details of the service request during the execution of the asynchronous service processing flow.

另一方面,本發明提供一種伺服器,包括:獲取模組,用於根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;輪詢模組,用於針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料;接收模組,用於接收並記錄所述服務提供方返回的所述目標服務請求的結果資料。 In another aspect, the present invention provides a server, comprising: an acquisition module for acquiring a service request that needs to re-request result data from a service provider as a target service request according to the recorded processing details information of each service request; polling a module for re-sending a polling request to the service provider for the target service request to request the result data of the target service request; a receiving module for receiving and recording the service provider The returned result data of the target service request.

另一方面,本發明提供一種伺服器,包括:執行模組,用於針對服務請求,執行異步服務處理流程;第二記錄模組,用於在所述執行模組執行所述異步服務處理流程的過程中,記錄所述服務請求的處理詳情資訊。 In another aspect, the present invention provides a server, comprising: an execution module for executing an asynchronous service processing flow for a service request; a second recording module for executing the asynchronous service processing flow in the execution module In the process of recording the processing details of the service request.

本發明提供的異步服務處理方法及伺服器,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料,接收並記錄所述服務提供方返回的所述目標服務請求的結果資料,保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 The asynchronous service processing method and server provided by the present invention, according to the recorded processing details information of each service request, obtain the service request that needs to re-request the result data from the service provider as the target service request, and re-request the target service request for the target service request. The service provider sends a polling request to request the result data of the target service request, receives and records the result data of the target service request returned by the service provider, and ensures the request result in the service provider The data is consistent with the data recorded by the service requester to ensure that the user is informed of the accurate request result data in a timely manner. Since there is no need for human participation in the process, labor costs are reduced and processing efficiency is improved.

上述說明僅是本發明技術方案的概述,為了能夠更清楚瞭解本發明的技術手段,而可依照說明書的內容予以實施,並且為了讓本發明的上述和其它目的、特徵和優點能夠更明顯易懂,以下特舉本發明的具體實施方式。 The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.

111‧‧‧獲取模組 111‧‧‧Get Modules

112‧‧‧輪詢模組 112‧‧‧Polling Module

113‧‧‧接收模組 113‧‧‧Receiver module

121‧‧‧執行模組 121‧‧‧Execution module

122‧‧‧記錄模組 122‧‧‧Recording module

通過閱讀下文較佳實施方式的詳細描述,各種其他的優點和益處對於本領域普通技術人員將變得清楚明瞭。附圖僅用於示出較佳實施方式的目的,而並不認為是對本發明的限制。而且在整個附圖中,用相同的參考符號表示相同的部件。在附圖中:圖1為現有的多主機服務系統的架構示意圖;圖2為現有的多主機異步服務系統的架構及工作原理示意圖;圖3為本發明提供的異步服務處理方法一個實施例的流程示意圖;圖4為本發明提供的異步服務處理方法又一個實施例的流程示意圖;圖5為圖4所示實施例的異步服務處理方法一種可行實施方式的流程示意圖;圖6為圖5所示的異步服務處理方法應用於多主機異步服務系統的架構及交互邏輯示意圖;圖7為本發明提供的異步服務處理方法又一個實施例的流程示意圖;圖8為本發明提供的異步服務處理方法又一個實施例的流程示意圖;圖9為圖8所示實施例的異步服務處理方法一種可行實施方式的流程示意圖; 圖10為圖9所示的異步服務處理方法應用於多主機異步服務系統的架構及交互邏輯示意圖;圖11為本發明提供的伺服器一個實施例的結構示意圖;圖12為本發明提供的伺服器又一個實施例的結構示意圖。 Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the present invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the accompanying drawings: FIG. 1 is a schematic diagram of the architecture of an existing multi-host service system; FIG. 2 is a schematic diagram of the architecture and working principle of an existing multi-host asynchronous service system; FIG. 3 is an embodiment of an asynchronous service processing method provided by the present invention. Schematic flow chart; FIG. 4 is a schematic flow chart of another embodiment of the asynchronous service processing method provided by the present invention; FIG. 5 is a schematic flow chart of a feasible implementation manner of the asynchronous service processing method of the embodiment shown in FIG. 4 ; Figure 7 is a schematic flowchart of another embodiment of the asynchronous service processing method provided by the present invention; Figure 8 is the asynchronous service processing method provided by the present invention. A schematic flowchart of another embodiment; FIG. 9 is a schematic flowchart of a possible implementation manner of the asynchronous service processing method of the embodiment shown in FIG. 8; 10 is a schematic diagram of the architecture and interaction logic of the asynchronous service processing method shown in FIG. 9 applied to a multi-host asynchronous service system; FIG. 11 is a schematic structural diagram of an embodiment of a server provided by the present invention; FIG. 12 is a server provided by the present invention. A schematic diagram of the structure of another embodiment of the device.

下面將參照附圖更詳細地描述本公開的示例性實施例。雖然附圖中顯示了本公開的示例性實施例,然而應當理解,可以以各種形式實現本公開而不應被這裡闡述的實施例所限制。相反,提供這些實施例是為了能夠更透徹地理解本公開,並且能夠將本公開的範圍完整的傳達給本領域的技術人員。 Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.

下面結合附圖對本發明實施例的異步服務處理方法及伺服器進行詳細描述。 The asynchronous service processing method and server according to the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

實施例一 Example 1

圖3為本發明提供的異步服務處理方法一個實施例的流程示意圖。本發明實施例的異步服務處理方法可應用於異步服務請求方,例如圖2所示的異步服務系統中的應用伺服器中,為異步服務系統的資料恢復流程。如圖3所示,本發明實施例的異步服務處理方法具體可包括: FIG. 3 is a schematic flowchart of an embodiment of an asynchronous service processing method provided by the present invention. The asynchronous service processing method of the embodiment of the present invention can be applied to an asynchronous service requester, such as the application server in the asynchronous service system shown in FIG. 2 , which is the data recovery process of the asynchronous service system. As shown in FIG. 3 , the asynchronous service processing method according to the embodiment of the present invention may specifically include:

S301,根據記錄的各服務請求的處理詳情資訊,獲取 需要重新向服務提供方請求結果資料的服務請求作為目標服務請求。 S301, according to the recorded processing details of each service request, obtain The service request that needs to re-request the result data from the service provider is regarded as the target service request.

S302,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料。 S302, for the target service request, re-send a polling request to the service provider to request to obtain the result data of the target service request.

S303,接收並記錄服務提供方返回的目標服務請求的結果資料。 S303: Receive and record the result data of the target service request returned by the service provider.

具體的,本發明實施例描述了異步服務請求處理的資料恢復流程。異步服務請求方根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,即獲取因故障未完成輪詢操作的服務請求作為目標服務請求。針對目標服務請求,重新執行輪詢操作,即重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料,接收並記錄服務提供方返回的目標服務請求的結果資料,以保證服務提供方的請求結果資料與服務請求方記錄的結果資料一致。其中,可以將服務提供方返回的目標服務請求的結果資料記錄在本地資料庫中,也可以記錄在外部的其他儲存媒體中,例如雲盤、移動硬盤等中。 Specifically, the embodiments of the present invention describe a data recovery process for asynchronous service request processing. According to the recorded processing details of each service request, the asynchronous service requester obtains the service request that needs to re-request the result data from the service provider as the target service request, that is, obtains the service request that has not completed the polling operation due to the failure as the target service request. For the target service request, re-execute the polling operation, that is, re-send the polling request to the service provider to request the result data of the target service request, receive and record the result data of the target service request returned by the service provider to ensure the service The provider's request result data is consistent with the result data recorded by the service requester. The result data of the target service request returned by the service provider may be recorded in the local database, or may be recorded in other external storage media, such as cloud disk, mobile hard disk, and the like.

本發明實施例的異步服務處理方法,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料,接收並記錄服務提供方返回的目標服務請求的結果資料,保證了服務提供方中的請求結果資料 與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 In the asynchronous service processing method of the embodiment of the present invention, according to the recorded processing details information of each service request, the service request that needs to re-request the result data from the service provider is obtained as the target service request, and the target service request is re-sent to the service provider. Polling request to request the result data of the target service request, receive and record the result data of the target service request returned by the service provider, and ensure the request result data in the service provider It is consistent with the data recorded by the service requester to ensure that the user is informed of the accurate request result data in a timely manner. Since there is no need for human participation in the process, labor costs are reduced and processing efficiency is improved.

實施例二 Embodiment 2

圖4為本發明提供的異步服務處理方法又一個實施例的流程示意圖。本發明實施例的異步服務處理方法可應用於異步服務請求方,例如圖2所示的異步服務系統中的應用伺服器中,為異步服務系統的資料恢復流程。如圖4所示,本發明實施例的異步服務處理方法為圖3所示實施例的異步服務處理方法的一種可行實施方式,具體可包括: FIG. 4 is a schematic flowchart of another embodiment of the asynchronous service processing method provided by the present invention. The asynchronous service processing method of the embodiment of the present invention can be applied to an asynchronous service requester, such as the application server in the asynchronous service system shown in FIG. 2 , which is the data recovery process of the asynchronous service system. As shown in FIG. 4 , the asynchronous service processing method of the embodiment of the present invention is a feasible implementation manner of the asynchronous service processing method of the embodiment shown in FIG. 3 , which may specifically include:

圖3所示實施例中的步驟S301中,各服務請求的處理詳情資訊具體可包括各服務請求的接收時間和執行狀態,執行狀態具體可包括“發送異步請求成功”狀態和“輪詢結果完成”狀態。因此圖3所示實施例中的步驟S301具體可包括如下步驟S401-S402。 In step S301 in the embodiment shown in FIG. 3 , the processing details information of each service request may specifically include the reception time and execution status of each service request, and the execution status may specifically include the status of "successful sending of asynchronous requests" and "completed polling results" "condition. Therefore, step S301 in the embodiment shown in FIG. 3 may specifically include the following steps S401-S402.

S401,根據各服務請求的執行狀態,獲取處於“發送異步請求成功”狀態的服務請求作為候選服務請求。 S401 , according to the execution state of each service request, acquire a service request in a state of "successfully sending an asynchronous request" as a candidate service request.

S402,計算候選服務請求的接收時間與當前時間的差值,獲取差值大於指定時間的服務請求作為目標服務請求。 S402: Calculate the difference between the reception time of the candidate service request and the current time, and obtain a service request whose difference is greater than a specified time as a target service request.

具體的,步驟S401-S402中,通過獲取接收時間與當前時間的差值大於指定時間,且執行狀態為“發送異步請求成功”狀態的服務請求,以獲取因故障未完成輪詢操作 的服務請求。其中,指定時間可以根據需要設定,一般會設置一個最大輪詢時長,例如30分鐘,30分鐘內還未輪詢到結果,則認為此次異步服務處理失敗,因此此處可設置指定時間大於最大輪詢時長,但也不能設置過大,避免資料恢復時間過長,例如設置為最大輪詢時長的2倍。 Specifically, in steps S401-S402, by obtaining the service request whose difference between the receiving time and the current time is greater than the specified time, and whose execution status is the status of "successful sending of asynchronous request", to obtain the polling operation that is not completed due to a fault service request. Among them, the specified time can be set according to the needs. Generally, a maximum polling time will be set, such as 30 minutes. If the result is not polled within 30 minutes, it is considered that the asynchronous service processing fails. Therefore, the specified time can be set here to be greater than The maximum polling duration should not be set too large to avoid data recovery time being too long. For example, set it to 2 times the maximum polling duration.

S403,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料。 S403, for the target service request, re-send a polling request to the service provider to request to obtain the result data of the target service request.

若輪詢請求發送成功,則執行以下步驟S404。 If the polling request is sent successfully, the following step S404 is performed.

S404,接收並記錄服務提供方返回的目標服務請求的結果資料。 S404: Receive and record the result data of the target service request returned by the service provider.

具體的,步驟S403-S404與圖3所示實施例中的步驟S302-S303相同,具體過程可參見圖3所示實施例中的相關描述,此處不再贅述。 Specifically, steps S403-S404 are the same as steps S302-S303 in the embodiment shown in FIG. 3 , and the specific process can refer to the relevant description in the embodiment shown in FIG. 3 , which will not be repeated here.

進一步的,本發明實施例的異步服務處理方法還可包括: Further, the asynchronous service processing method according to the embodiment of the present invention may further include:

S405,當服務提供方成功返回目標服務請求的結果資料時,更新目標服務請求的執行狀態為“輪詢結果完成”狀態。 S405, when the service provider successfully returns the result data of the target service request, update the execution status of the target service request to a "polling result completed" status.

具體的,本步驟S405當對因故障未完成輪詢操作的服務請求重新完成輪詢操作,獲取到對應的結果資料後,將該服務請求的執行狀態由“發送異步請求成功”狀態更新為“輪詢結果完成”,避免該服務請求再次被獲取為未完成輪詢操作的服務請求,避免對該服務請求再次執行輪詢操作,造成資源浪費。 Specifically, in this step S405, when the polling operation is re-completed for the service request for which the polling operation has not been completed due to a fault, and the corresponding result data is obtained, the execution status of the service request is updated from the "successful sending of the asynchronous request" to "" The polling result is completed", to prevent the service request from being obtained again as a service request for which the polling operation has not been completed, and to avoid performing the polling operation again on the service request, resulting in a waste of resources.

進一步的,本發明實施例的異步服務處理方法還可包括: Further, the asynchronous service processing method according to the embodiment of the present invention may further include:

在步驟S403之後,若未成功發送輪詢請求,則執行以下步驟S406。 After step S403, if the polling request is not sent successfully, the following step S406 is performed.

S406,等待設定時長後返回步驟S403重新向服務提供方發送輪詢請求。 S406, after waiting for the set duration, return to step S403 to re-send the polling request to the service provider.

具體的,在發送輪詢請求失敗的情況下,通過本步驟S406可在故障時間較短的情況下,嘗試快速恢復對服務請求的輪詢操作。其中,設定時長可根據需要設定,一般會設置一個最大輪詢時長,例如30分鐘,30分鐘內還未輪詢到結果,則認為此次異步服務處理失敗,沒必要一直輪詢,浪費資源,因此此處可設置設定時長為最大輪詢時長,例如30分鐘。 Specifically, in the case that the sending of the polling request fails, this step S406 can try to quickly restore the polling operation for the service request when the failure time is short. Among them, the set duration can be set according to the needs. Generally, a maximum polling duration will be set, such as 30 minutes. If the result is not polled within 30 minutes, it is considered that the asynchronous service processing fails, and there is no need to poll all the time, which is a waste. resources, so the set duration can be set here as the maximum polling duration, such as 30 minutes.

進一步的,步驟S406具體可包括:若未成功發送輪詢請求,判斷是否達到設定的輪詢次數閾值;若否,則等待設定時長後返回步驟S403重新向服務提供方發送輪詢請求。 Further, step S406 may specifically include: if the polling request is not sent successfully, judging whether the set threshold of polling times is reached; if not, returning to step S403 after waiting for the set time period to send the polling request to the service provider again.

具體的,輪詢次數閾值和設定時長可根據需要設定,一般會設置一個最大輪詢時長,例如30分鐘,而最大輪詢時長=輪詢次數*(輪詢間隔+輪詢操作需要的時間),輪詢操作需要的時間一般為毫秒級別可以忽略不計,因此可認為最大輪詢時長=輪詢次數*輪詢間隔,因此可設置輪詢次數為5次,輪詢間隔即設定時長為6分鐘等組合方式。 Specifically, the threshold of polling times and the set duration can be set as required. Generally, a maximum polling duration is set, such as 30 minutes, and the maximum polling duration = polling times * (polling interval + polling operation needs time), the time required for the polling operation is generally negligible in milliseconds, so it can be considered that the maximum polling time = polling times * polling interval, so the polling times can be set to 5 times, and the polling interval is set The duration is 6 minutes and other combinations.

進一步的,步驟S401具體可包括:當預設掃描週期到達時,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;或者在每次重新啟動時,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求。其中,預設掃描週期可以根據需要設定,一般會設置一個最大輪詢時長,例如30分鐘,30分鐘內還未輪詢到結果,則認為此次異步服務處理失敗,因此此處可設置預設掃描週期大於最大輪詢時長,儘量不要設置過短,避免異步服務處理還未完成,又去獲取需要重新向服務提供方請求結果資料的服務請求,例如設置為最大輪詢時長的10倍。 Further, step S401 may specifically include: when the preset scanning period arrives, according to the recorded processing details information of each service request, obtain the service request that needs to re-request the result data from the service provider as the target service request; When restarting, according to the recorded processing details of each service request, the service request that needs to re-request the result data from the service provider is obtained as the target service request. Among them, the preset scanning period can be set as required, and a maximum polling time is generally set, such as 30 minutes. If no result is polled within 30 minutes, it is considered that the asynchronous service processing failed, so the preset can be set here. Set the scan period to be greater than the maximum polling duration, try not to set it too short, to avoid asynchronous service processing not being completed, and to obtain service requests that need to re-request the result data from the service provider, for example, set it to 10 of the maximum polling duration. times.

為更清楚的說明本發明實施例的異步服務處理方法的具體過程,圖5給出了圖4所示實施例的異步服務處理方法一種可行實施方式的流程示意圖。如圖5所示,圖4所示實施例的異步服務處理方法應用於圖2所示的異步服務系統中,應用伺服器作為服務請求方,第三方伺服器作為服務提供方,包括: In order to more clearly illustrate the specific process of the asynchronous service processing method according to the embodiment of the present invention, FIG. 5 is a schematic flowchart of a possible implementation manner of the asynchronous service processing method of the embodiment shown in FIG. 4 . As shown in FIG. 5 , the asynchronous service processing method of the embodiment shown in FIG. 4 is applied to the asynchronous service system shown in FIG. 2 , the application server is used as the service requester, and the third-party server is used as the service provider, including:

S501,應用伺服器在資料庫中查找狀態為“發送異步服務請求成功”狀態且攜帶有應用伺服器的標識的候選記錄資料,候選記錄資料中還攜帶有服務請求的接收時間和異步服務請求的標識。 S501, the application server searches the database for candidate record data whose status is "successful in sending the asynchronous service request" and carries the identifier of the application server, and the candidate record data also carries the reception time of the service request and the data of the asynchronous service request. logo.

S502,應用伺服器計算候選記錄資料中服務請求的接收時間與當前時間的差值,將差值大於指定時間的候 選記錄資料作為目標記錄資料。其中,指定時間可設置為30分鐘*2=60分鐘。 S502, the application server calculates the difference between the reception time of the service request and the current time in the candidate record data, Select the record data as the target record data. Among them, the specified time can be set to 30 minutes * 2 = 60 minutes.

S503,應用伺服器將輪詢請求發送至第三方伺服器,輪詢請求中包括目標記錄資料中攜帶的異步服務請求的標識。 S503, the application server sends a polling request to a third-party server, where the polling request includes the identifier of the asynchronous service request carried in the target record data.

S504,應用伺服器判斷在第一設定時間內是否接收到第三方伺服器發送的輪詢請求成功的響應。若否,則執行步驟S505;若是,則執行步驟S507。其中,第一設定時間可以根據需要設定,一般設置為60秒以下,例如30秒。 S504, the application server determines whether a successful response to the polling request sent by the third-party server is received within the first set time. If no, go to step S505; if yes, go to step S507. Wherein, the first set time can be set as required, and is generally set to be less than 60 seconds, for example, 30 seconds.

S505,應用伺服器判斷是否達到輪詢次數閾值。若是,則返回步驟S501;若否,則執行步驟S506。其中,輪詢次數閾值可設置為5次。 S505, the application server determines whether the polling times threshold is reached. If yes, go back to step S501; if no, go to step S506. The threshold for the number of polling times can be set to 5 times.

S506,應用伺服器等待第一設定時長後返回步驟S503。其中,第一設定時長可設置為6分鐘。 S506, the application server returns to step S503 after waiting for the first set duration. The first set duration may be set to 6 minutes.

S507,應用伺服器判斷輪詢請求成功的響應中是否攜帶有結果資料。若否,則執行步驟S508;若是,則執行步驟S509。 S507, the application server determines whether the response to the successful polling request carries the result data. If no, go to step S508; if yes, go to step S509.

S508,應用伺服器等待第二設定時長後返回步驟S503。其中,第二設定時長可設置為30分鐘。 S508, the application server returns to step S503 after waiting for the second set duration. The second set duration may be set to 30 minutes.

S509,應用伺服器根據結果資料更新資料庫中對應的目標記錄資料,並將對應的目標記錄資料的狀態更新為“輪詢結果完成”狀態。 S509 , the application server updates the corresponding target record data in the database according to the result data, and updates the state of the corresponding target record data to a "polling result completed" state.

S510,應用伺服器等待預設掃描週期到達後返回步驟 S501。其中,預設掃描週期具體可以為。其中,預設掃描週期可設置為30分鐘*10=300分鐘。 S510, the application server returns to the step after waiting for the preset scanning period to arrive S501. The preset scan period may specifically be: The preset scanning period can be set to 30 minutes*10=300 minutes.

上述圖5所示的異步服務處理方法的資料恢復流程對應的多主機異步服務系統的架構圖及資料恢復流程的交互邏輯可如圖6所示,包括: The architecture diagram of the multi-host asynchronous service system corresponding to the data recovery process of the asynchronous service processing method shown in FIG. 5 and the interaction logic of the data recovery process can be shown in FIG. 6 , including:

多主機異步服務系統啟動,在執行異步服務處理方法的主流程的同時,執行異步服務處理方法的資料恢復流程,應用伺服器開始計時。 When the multi-host asynchronous service system is started, the data recovery process of the asynchronous service processing method is executed while the main process of the asynchronous service processing method is executed, and the application server starts timing.

S601,應用伺服器在資料庫中查找攜帶有應用伺服器的標識、狀態為“發送異步服務請求成功”且服務請求的接收時間與當前時間的差值大於指定時間的記錄資料作為目標記錄資料。 S601, the application server searches the database for the record data carrying the identifier of the application server, the status is "successfully sending the asynchronous service request", and the difference between the reception time of the service request and the current time is greater than the specified time as the target record data.

S602,應用伺服器將輪詢請求發送至第三方伺服器,輪詢請求中包括目標記錄資料中攜帶的異步服務請求的標識。 S602, the application server sends a polling request to a third-party server, where the polling request includes the identifier of the asynchronous service request carried in the target record data.

S603,應用伺服器接收第三方伺服器返回的與異步服務請求的標識對應的結果資料。 S603, the application server receives the result data corresponding to the identifier of the asynchronous service request returned by the third-party server.

S604,應用伺服器根據獲取到的結果資料更新資料庫中對應的目標記錄資料,並將對應的目標記錄資料的狀態更新為“輪詢結果完成”狀態。 S604, the application server updates the corresponding target record data in the database according to the obtained result data, and updates the state of the corresponding target record data to a state of "polling result completed".

此處需要說明的是,本發明實施例中各服務請求的處理詳情資訊(包括各服務請求的接收時間和執行狀態)在下述實例三、四中描述異步服務請求處理的主流程的異步服務處理方法中進行記錄,具體過程此處不再 贅述。 It should be noted here that the processing details of each service request in the embodiment of the present invention (including the reception time and execution status of each service request) are described in the following examples 3 and 4. The asynchronous service processing of the main process of asynchronous service request processing Recorded in the method, the specific process is no longer here Repeat.

本發明實施例的異步服務處理方法,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料,接收並記錄服務提供方返回的目標服務請求的結果資料保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 In the asynchronous service processing method of the embodiment of the present invention, according to the recorded processing details information of each service request, the service request that needs to re-request the result data from the service provider is obtained as the target service request, and the target service request is re-sent to the service provider. Polling request to request the result data of the target service request, receive and record the result data of the target service request returned by the service provider, ensure that the request result data in the service provider is consistent with the data recorded by the service requester, and ensure that the user is timely Obtaining accurate request result data, since no human participation is required in the process, labor costs are reduced and processing efficiency is improved.

實施例三 Embodiment 3

圖7為本發明提供的異步服務處理方法又一個實施例的流程示意圖。本發明實施例的異步服務處理方法可應用於異步服務請求方,例如圖2所示的異步服務系統中的應用伺服器中,為異步服務系統的主流程,可與圖3-圖5所示的異步服務處理方法的資料恢復流程相結合實施,也可單獨實施。如圖7所示,本發明實施例的異步服務處理方法具體可包括: FIG. 7 is a schematic flowchart of another embodiment of the asynchronous service processing method provided by the present invention. The asynchronous service processing method in the embodiment of the present invention can be applied to an asynchronous service requester. For example, the application server in the asynchronous service system shown in FIG. 2 is the main process of the asynchronous service system, which can be similar to those shown in FIGS. 3 to 5 . The asynchronous service processing method is implemented in combination with the data recovery process, or can be implemented separately. As shown in FIG. 7 , the asynchronous service processing method according to the embodiment of the present invention may specifically include:

S701,針對服務請求,執行異步服務處理流程。 S701, for the service request, execute an asynchronous service processing flow.

S702,在執行異步服務處理流程的過程中,記錄服務請求的處理詳情資訊。 S702, in the process of executing the asynchronous service processing flow, record processing details information of the service request.

具體的,通過在針對服務請求執行異步服務處理流程的過程中,記錄服務請求的處理詳情資訊,方便在上 述圖3-圖5所示的異步服務處理方法的資料恢復流程中根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求。其中,可以將服務提供方返回的目標服務請求的結果資料記錄在本地資料庫中,也可以記錄在外部的其他儲存媒體中,例如雲盤、移動硬盤等中。 Specifically, by recording the processing details of the service request during the process of executing the asynchronous service processing flow for the service request, it is convenient to In the data recovery process of the asynchronous service processing method shown in Figures 3-5, a service request that needs to re-request the result data from the service provider is obtained according to the recorded processing details of each service request. The result data of the target service request returned by the service provider may be recorded in the local database, or may be recorded in other external storage media, such as cloud disk, mobile hard disk, and the like.

本發明實施例的異步服務處理方法,通過在針對服務請求執行異步服務處理流程的過程中,記錄服務請求的處理詳情資訊,使得處理過程中不同階段對應的服務請求的處理詳情資訊不同,便於在故障恢復後查找未完成輪詢操作的服務請求,並自動完成輪詢操作,保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 The asynchronous service processing method of the embodiment of the present invention records the processing details of the service request during the process of executing the asynchronous service processing flow for the service request, so that the processing details of the service requests corresponding to different stages in the processing process are different, which is convenient for After the fault is recovered, the service request that has not completed the polling operation is found, and the polling operation is automatically completed, which ensures that the request result data in the service provider is consistent with the data recorded by the service requester, and ensures that the user is informed of the accurate request result data in a timely manner. There is no need for human participation in the process, which reduces labor costs and improves processing efficiency.

實施例四 Embodiment 4

圖8為本發明提供的異步服務處理方法又一個實施例的流程示意圖。本發明實施例的異步服務處理方法可應用於異步服務請求方,例如圖2所示的異步服務系統中的應用伺服器中,為異步服務系統的主流程,可與圖3-圖5所示的異步服務處理方法的資料恢復流程相結合實施,也可單獨實施。如圖8所示,本發明實施例的異步服務處理方法為圖7所示實施例的異步服務處理方法的 一種可行實施方式,具體可包括: FIG. 8 is a schematic flowchart of another embodiment of the asynchronous service processing method provided by the present invention. The asynchronous service processing method in the embodiment of the present invention can be applied to an asynchronous service requester. For example, the application server in the asynchronous service system shown in FIG. 2 is the main process of the asynchronous service system, which can be similar to those shown in FIGS. 3 to 5 . The asynchronous service processing method is implemented in combination with the data recovery process, or can be implemented separately. As shown in FIG. 8 , the asynchronous service processing method in the embodiment of the present invention is the same as the asynchronous service processing method in the embodiment shown in FIG. 7 . A feasible implementation manner may specifically include:

圖7所示實施例中的步驟S701具體可包括如下步驟S801-S805。 Step S701 in the embodiment shown in FIG. 7 may specifically include the following steps S801-S805.

S801,接收服務請求。 S801, a service request is received.

S803,針對服務請求,向服務提供方發送異步請求。 S803, for the service request, send an asynchronous request to the service provider.

在步驟S803之後,若成功發送異步請求,則執行以下步驟S805。 After step S803, if the asynchronous request is successfully sent, the following step S805 is performed.

S805,向服務提供方發送輪詢請求,以請求服務請求的結果資料。 S805: Send a polling request to the service provider to request the result data of the service request.

具體的,異步服務請求方接收服務請求,針對該服務請求,向服務提供方發送異步請求,若成功發送異步請求,向服務提供方發送輪詢請求,以請求服務請求的結果資料。 Specifically, the asynchronous service requester receives the service request, sends an asynchronous request to the service provider for the service request, and if the asynchronous request is successfully sent, sends a polling request to the service provider to request the result data of the service request.

進一步的,圖7所示實施例中的步驟S702具體可包括以下步驟S802-S806中的至少一個步驟: Further, step S702 in the embodiment shown in FIG. 7 may specifically include at least one of the following steps S802-S806:

在步驟S801接收到服務請求之後,執行以下步驟S802。 After the service request is received in step S801, the following step S802 is performed.

S802,記錄服務請求的接收時間。 S802, record the receiving time of the service request.

在步驟S803之後,若發送異步請求成功,則執行以下步驟S804。 After step S803, if the asynchronous request is sent successfully, the following step S804 is performed.

S804,記錄服務請求的執行狀態為“發送異步請求成功”狀態。 S804, record the execution status of the service request as a "successful sending of the asynchronous request" status.

在步驟S805之後,若成功發送輪詢請求,則執行以 下步驟S806。 After step S805, if the polling request is successfully sent, execute the The next step is S806.

S806,當服務提供方成功返回各服務請求的結果資料時,更新服務請求的執行狀態為“輪詢結果完成”狀態。 S806, when the service provider successfully returns the result data of each service request, update the execution status of the service request to a "polling result completed" state.

進一步的,本發明實施例的異步服務處理方法還可包括: Further, the asynchronous service processing method according to the embodiment of the present invention may further include:

在步驟S805之後,若未成功發送輪詢請求,則執行以下步驟S807。 After step S805, if the polling request is not sent successfully, the following step S807 is performed.

S807,等待設定時長後返回步驟S805重新向服務提供方發送輪詢請求。 S807, after waiting for the set time period, return to step S805 to re-send the polling request to the service provider.

具體的,在發送輪詢請求失敗的情況下,通過本步驟可在故障時間較短的情況下,嘗試快速恢復對服務請求的輪詢操作。其中,設定時長的設置可參見上述圖4所示實施例中的相關描述,此處不再贅述。 Specifically, in the case that the sending of the polling request fails, this step can try to quickly restore the polling operation for the service request when the failure time is short. For the setting of the set duration, reference may be made to the relevant description in the embodiment shown in FIG. 4 , which is not repeated here.

進一步的,步驟S807具體可包括:若未成功發送輪詢請求,判斷是否達到設定的輪詢次數閾值;若否,則等待設定時長後返回步驟S805重新向服務提供方發送輪詢請求。其中,輪詢次數閾值和設定時長的設置可參見上述圖4所示實施例中的相關描述,此處不再贅述。 Further, step S807 may specifically include: if the polling request is not sent successfully, judging whether the set threshold of polling times is reached; if not, returning to step S805 after waiting for the set time period to send the polling request to the service provider again. For the settings of the polling times threshold and the set duration, reference may be made to the relevant descriptions in the embodiment shown in FIG. 4 , which will not be repeated here.

為更清楚的說明本發明實施例的異步服務處理方法的具體過程,圖9給出了圖8所示實施例的異步服務處理方法一種可行實施方式的流程示意圖。如圖9所示,圖8所示實施例的異步服務處理方法應用於圖2所示的異步服務系統中,應用伺服器作為服務請求方,第三方伺服器作為 服務提供方,包括: In order to more clearly illustrate the specific process of the asynchronous service processing method according to the embodiment of the present invention, FIG. 9 is a schematic flowchart of a possible implementation manner of the asynchronous service processing method of the embodiment shown in FIG. 8 . As shown in FIG. 9 , the asynchronous service processing method of the embodiment shown in FIG. 8 is applied to the asynchronous service system shown in FIG. 2 , the application server is used as the service requester, and the third-party server is used as the service requester. Service providers, including:

S901,應用伺服器接收轉發伺服器發送的服務請求。 S901, the application server receives the service request sent by the forwarding server.

S902,應用伺服器將與服務請求對應的記錄資料儲存至資料庫中,記錄資料包括服務請求的接收時間和應用伺服器的標識。 S902, the application server stores the record data corresponding to the service request in a database, where the record data includes the reception time of the service request and the identifier of the application server.

S903,應用伺服器將與服務請求對應的異步服務請求發送至第三方伺服器。 S903, the application server sends an asynchronous service request corresponding to the service request to a third-party server.

S904,應用伺服器判斷在第二設定時間內是否接收到第三方伺服器發送的異步服務請求成功的響應。若否,則執行S905;若是,則執行S906。其中,第二設定時間可根據需要進行設置,一般設置為60秒以下,例如30秒。 S904, the application server determines whether a successful response to the asynchronous service request sent by the third-party server is received within the second set time. If not, execute S905; if yes, execute S906. Wherein, the second set time can be set as required, and is generally set to be less than 60 seconds, for example, 30 seconds.

S905,應用伺服器將異步服務請求失敗的通知消息發送至轉發伺服器,結束流程。 S905, the application server sends a notification message that the asynchronous service request fails to the forwarding server, and the process ends.

S906,應用伺服器將記錄資料的狀態設置為“發送異步服務請求成功”狀態,並將異步服務請求成功的響應中攜帶的異步服務請求的標識添加到記錄資料中。 S906, the application server sets the state of the record data to the state of "successful sending of the asynchronous service request", and adds the identifier of the asynchronous service request carried in the response of the successful asynchronous service request to the record data.

S907,應用伺服器將輪詢請求發送至第三方伺服器,輪詢請求中包括異步服務請求的標識。 S907, the application server sends the polling request to the third-party server, where the polling request includes the identifier of the asynchronous service request.

S908,應用伺服器判斷第一設定時間內是否接收到第三方伺服器發送的輪詢請求成功的響應。若否,則執行步驟S909;若是,則執行步驟S911。其中,第一設定時間可以根據需要設定,一般設置為60秒以下,例如30秒。 S908, the application server determines whether a successful response to the polling request sent by the third-party server is received within the first set time. If no, go to step S909; if yes, go to step S911. Wherein, the first set time can be set as required, and is generally set to be less than 60 seconds, for example, 30 seconds.

S909,應用伺服器判斷是否達到輪詢次數閾值。若 是,則結束流程;若否,則執行步驟S910。其中,輪詢次數閾值可設置為5次。 S909, the application server determines whether the polling times threshold is reached. like If yes, end the process; if no, go to step S910. The threshold for the number of polling times can be set to 5 times.

S910,應用伺服器等待第一設定時長後返回步驟S907。其中,第一設定時長可設置為6分鐘。 S910, the application server returns to step S907 after waiting for the first set duration. The first set duration may be set to 6 minutes.

S911,應用伺服器判斷輪詢請求成功的響應中是否攜帶有結果資料。若否,則執行步驟S912;若是,則執行步驟S913。 S911, the application server determines whether the response to the successful polling request carries the result data. If no, go to step S912; if yes, go to step S913.

S912,應用伺服器等待第二設定時長後返回步驟S907。其中,第二設定時長可設置為30分鐘。 S912, the application server returns to step S907 after waiting for the second set duration. The second set duration may be set to 30 minutes.

S913,應用伺服器根據結果資料更新資料庫中對應的記錄資料,並將對應的記錄資料的狀態更新為“輪詢結果完成”狀態,結束流程。 S913, the application server updates the corresponding record data in the database according to the result data, and updates the state of the corresponding record data to a "polling result completed" state, and the process ends.

上述圖9所示的異步服務處理方法的主流程對應的多主機異步服務系統的架構圖及主流程的交互邏輯可如圖10所示,包括: The architecture diagram of the multi-host asynchronous service system corresponding to the main process of the asynchronous service processing method shown in FIG. 9 and the interaction logic of the main process can be shown in FIG. 10 , including:

多主機異步服務系統啟動,執行異步服務處理方法的主流程。 The multi-host asynchronous service system starts and executes the main process of the asynchronous service processing method.

S1001,用戶通過客戶端向轉發伺服器發出服務請求。 S1001, a user sends a service request to a forwarding server through a client.

S1002,轉發伺服器將該服務請求隨機轉發到任意一台應用伺服器。 S1002, the forwarding server randomly forwards the service request to any application server.

S1003,應用伺服器將服務請求的接收時間和應用伺服器的標識儲存至資料庫中對應的記錄資料中。 S1003, the application server stores the reception time of the service request and the identifier of the application server into the corresponding record data in the database.

S1004,應用伺服器將異步服務請求發送至第三方伺 服器。 S1004, the application server sends an asynchronous service request to a third-party server server.

S1005,應用伺服器接收第三方伺服器返回的異步服務請求成功的響應,該響應中包括異步服務請求的標識。 S1005, the application server receives a successful response of the asynchronous service request returned by the third-party server, where the response includes an identifier of the asynchronous service request.

S1006,應用伺服器將資料庫中對應的記錄資料的狀態設置為“發送異步服務請求成功”狀態。 S1006, the application server sets the state of the corresponding record data in the database to the state of "successfully sending the asynchronous service request".

S1007,應用伺服器根據第三方伺服器返回的該異步服務請求的標識將輪詢請求發送至第三方伺服器,該輪詢請求中包括異步服務請求的標識。 S1007, the application server sends a polling request to the third-party server according to the identifier of the asynchronous service request returned by the third-party server, where the polling request includes the identifier of the asynchronous service request.

S1008,應用伺服器接收第三方伺服器返回的與異步服務請求的標識對應的結果資料。 S1008, the application server receives the result data corresponding to the identifier of the asynchronous service request returned by the third-party server.

S1009,應用伺服器根據獲取到的請求結果資料更新資料庫中對應的記錄資料,並將對應的記錄資料的狀態更新為“輪詢結果完成”狀態。 S1009, the application server updates the corresponding record data in the database according to the obtained request result data, and updates the state of the corresponding record data to a state of "polling result completed".

S1010,用戶想查詢結果資料時,向轉發伺服器發出查詢請求。 S1010, when the user wants to query the result data, a query request is sent to the forwarding server.

S1011,轉發伺服器將該查詢請求隨機轉發到任意一台應用伺服器。 S1011, the forwarding server randomly forwards the query request to any application server.

S1012,應用伺服器在資料庫中查詢結果資料,並返回給用戶。 S1012, the application server searches the database for the result data, and returns it to the user.

本發明實施例的異步服務處理方法,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲 取目標服務請求的結果資料,接收並記錄服務提供方返回的目標服務請求的結果資料保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 In the asynchronous service processing method of the embodiment of the present invention, according to the recorded processing details information of each service request, the service request that needs to re-request the result data from the service provider is obtained as the target service request, and the target service request is re-sent to the service provider. polling request to request Take the result data of the target service request, receive and record the result data of the target service request returned by the service provider, to ensure that the request result data in the service provider is consistent with the data recorded by the service requester, and to ensure that the user knows the accurate request result data, Since there is no need for human participation in the process, labor costs are reduced and processing efficiency is improved.

實施例五 Embodiment 5

圖11為本發明提供的伺服器一個實施例的結構示意圖。本發明實施例的伺服器對應圖3-圖5所示實施例中的服務請求方,可執行圖3-圖5所示任一實施例中的異步服務處理方法。如圖11所示,本發明實施例的伺服器具體可包括獲取模組111、輪詢模組112和接收模組113,其中:獲取模組111,用於根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;輪詢模組112,用於針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料;接收模組113,用於接收並記錄服務提供方返回的目標服務請求的結果資料。 FIG. 11 is a schematic structural diagram of an embodiment of a server provided by the present invention. The server in the embodiment of the present invention corresponds to the service requester in the embodiment shown in FIG. 3 to FIG. 5 , and can execute the asynchronous service processing method in any of the embodiments shown in FIG. 3 to FIG. 5 . As shown in FIG. 11 , the server in this embodiment of the present invention may specifically include an acquisition module 111 , a polling module 112 and a receiving module 113 , wherein: the acquisition module 111 is used for processing details of each service request recorded according to information, and obtain the service request that needs to re-request the result data from the service provider as the target service request; the polling module 112 is used to re-send the polling request to the service provider for the target service request, so as to request to obtain the target service request. Result data; the receiving module 113 is used to receive and record the result data of the target service request returned by the service provider.

其中,各服務請求的處理詳情資訊包括各服務請求的接收時間和執行狀態。 The processing detail information of each service request includes the receiving time and execution status of each service request.

進一步的,獲取模組111具體可用於:根據各服務請 求的執行狀態,獲取處於發送異步請求成功狀態的服務請求作為候選服務請求;計算候選服務請求的接收時間與當前時間的差值,獲取差值大於指定時間的服務請求作為目標服務請求。 Further, the acquisition module 111 can be specifically used for: requesting The execution status of the request is obtained, and the service request in the successful state of sending the asynchronous request is obtained as the candidate service request; the difference between the reception time of the candidate service request and the current time is calculated, and the service request with the difference greater than the specified time is obtained as the target service request.

進一步的,接收模組113還可用於:當服務提供方成功返回目標服務請求的結果資料時,更新目標服務請求的執行狀態為輪詢結果完成狀態。 Further, the receiving module 113 can be further configured to: when the service provider successfully returns the result data of the target service request, update the execution status of the target service request to the polling result completion status.

進一步的,輪詢模組112還可用於:若未成功發送輪詢請求,等待設定時長後重新向服務提供方發送輪詢請求。 Further, the polling module 112 can also be used to: if the polling request is not sent successfully, wait for the set time period to send the polling request to the service provider again.

進一步的,輪詢模組112還可用於:在等待設定時長後重新向服務提供方發送輪詢請求之前,判斷是否達到設定的輪詢次數閾值;若否,則執行等待設定時長後重新向服務提供方發送輪詢請求的步驟。 Further, the polling module 112 can also be used to: before re-sending the polling request to the service provider after waiting for the set period of time, to determine whether the set threshold of polling times has been reached; Steps for the provider to send a polling request.

進一步的,獲取模組111具體可用於:當預設掃描週期到達時,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;或者在每次重新啟動時,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求。 Further, the obtaining module 111 can be specifically used for: when the preset scanning period arrives, according to the recorded processing details information of each service request, obtain the service request that needs to re-request the result data from the service provider as the target service request; or At each restart, according to the recorded processing details of each service request, the service request that needs to re-request the result data from the service provider is obtained as the target service request.

進一步的,獲取模組111還可用於:在根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求之前,在針對各服務請求執行異步服務處理流程的過程中,記錄各服務請 求的處理詳情資訊。 Further, the obtaining module 111 can also be used for: before obtaining the service request that needs to re-request the result data from the service provider as the target service request according to the recorded processing details information of each service request, before executing the asynchronous service for each service request. During the process of processing the process, please record each service Requested processing details.

進一步的,獲取模組111具體可用於執行以下至少一種操作:當接收到各服務請求時,記錄各服務請求的接收時間;當針對各服務請求成功向服務提供方發送異步請求時,記錄各服務請求的執行狀態為發送異步請求成功狀態;當服務提供方成功返回各服務請求的結果資料時,更新各服務請求的執行狀態為輪詢結果完成狀態。 Further, the obtaining module 111 can be specifically configured to perform at least one of the following operations: when receiving each service request, record the receiving time of each service request; when successfully sending an asynchronous request to the service provider for each service request, record each service request. The execution status of the request is the successful status of sending the asynchronous request; when the service provider successfully returns the result data of each service request, the execution status of each service request is updated to the polling result completion status.

具體的,本發明實施例的伺服器中各模組實現其功能的具體過程可參見上述圖3-圖9所示實施例中的相關描述,此處不再贅述。 Specifically, for the specific process of implementing the functions of each module in the server according to the embodiment of the present invention, reference may be made to the relevant descriptions in the embodiments shown in FIG. 3 to FIG. 9 above, which will not be repeated here.

本發明實施例的伺服器,根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,針對目標服務請求,重新向服務提供方發送輪詢請求,以請求獲取目標服務請求的結果資料,接收並記錄服務提供方返回的目標服務請求的結果資料保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 The server in the embodiment of the present invention obtains, according to the recorded processing details information of each service request, a service request that needs to re-request the result data from the service provider as a target service request, and re-sends polling to the service provider for the target service request To request to obtain the result data of the target service request, receive and record the result data of the target service request returned by the service provider to ensure that the request result data in the service provider is consistent with the data recorded by the service requester, and ensure that the user is informed in time and accurately Since there is no need for human participation in the process, the labor cost is reduced and the processing efficiency is improved.

實施例六 Embodiment 6

圖12為本發明提供的伺服器一個實施例的結構示意圖。本發明實施例的伺服器對應圖7-圖9所示實施例中的服務請求方,可執行圖7-圖9所示任一實施例中的異 步服務處理方法。如圖12所示,本發明實施例的伺服器具體可包括執行模組121和記錄模組122,其中: FIG. 12 is a schematic structural diagram of an embodiment of a server provided by the present invention. The server in this embodiment of the present invention corresponds to the service requester in the embodiment shown in FIG. 7 to FIG. 9 , and can execute the exception in any of the embodiments shown in FIG. 7 to FIG. 9 . Step service processing method. As shown in FIG. 12 , the server in the embodiment of the present invention may specifically include an execution module 121 and a recording module 122, wherein:

執行模組121,用於針對服務請求,執行異步服務處理流程。 The execution module 121 is configured to execute the asynchronous service processing flow for the service request.

記錄模組122,用於在執行模組執行異步服務處理流程的過程中,記錄服務請求的處理詳情資訊。 The recording module 122 is used for recording the processing details of the service request during the process of executing the asynchronous service processing flow by the execution module.

進一步的,執行模組121具體可用於:接收服務請求;針對服務請求,向服務提供方發送異步請求;若成功發送異步請求,向服務提供方發送輪詢請求,以請求服務請求的結果資料。 Further, the execution module 121 can be specifically used for: receiving the service request; for the service request, sending an asynchronous request to the service provider; if the asynchronous request is successfully sent, sending a polling request to the service provider to request the result data of the service request.

進一步的,記錄模組122具體可用於執行以下至少一種操作:當接收到服務請求時,記錄服務請求的接收時間;當針對服務請求成功向服務提供方發送異步請求時,記錄服務請求的執行狀態為發送異步請求成功狀態;當服務提供方成功返回各服務請求的結果資料時,更新服務請求的執行狀態為輪詢結果完成狀態。 Further, the recording module 122 can be specifically configured to perform at least one of the following operations: when a service request is received, record the reception time of the service request; when an asynchronous request is successfully sent to the service provider for the service request, record the execution status of the service request Indicates the successful status of sending the asynchronous request; when the service provider successfully returns the result data of each service request, the execution status of the update service request is the polling result completion status.

進一步的,執行模組121還可用於:若未成功發送輪詢請求,等待設定時長後重新向服務提供方發送輪詢請求。 Further, the execution module 121 can also be used to: if the polling request is not sent successfully, wait for the set time period to send the polling request to the service provider again.

進一步的,執行模組121還可用於:在等待設定時長後重新向服務提供方發送輪詢請求之前,判斷是否達到設定的輪詢次數閾值;若否,則執行等待設定時長後重新向服務提供方發送輪詢請求的步驟。 Further, the execution module 121 can also be used to: before re-sending the polling request to the service provider after waiting for the set period of time, to determine whether the set threshold of the number of polling times has been reached; The steps in which a party sends a polling request.

具體的,本發明實施例的伺服器中各模組實現其功 能的具體過程可參見上述圖7-圖9所示實施例中的相關描述,此處不再贅述。 Specifically, each module in the server of the embodiment of the present invention realizes its function For the specific process, reference may be made to the relevant descriptions in the above-mentioned embodiments shown in FIG. 7 to FIG. 9 , which will not be repeated here.

本發明實施例的伺服器,通過在針對服務請求執行異步服務處理流程的過程中,記錄服務請求的處理詳情資訊,使得處理過程中不同階段對應的服務請求的處理詳情資訊不同,便於在故障恢復後查找未完成輪詢操作的服務請求,並自動完成輪詢操作,保證了服務提供方中的請求結果資料與服務請求方記錄的資料一致,確保用戶及時獲知準確的請求結果資料,由於過程中無需人力參與,降低了人力成本,提高了處理效率。 The server of the embodiment of the present invention records the processing details of the service request during the process of executing the asynchronous service processing flow for the service request, so that the processing details of the service requests corresponding to different stages in the processing process are different, which is convenient for fault recovery. Then search for service requests that have not completed the polling operation, and automatically complete the polling operation, which ensures that the request result data in the service provider is consistent with the data recorded by the service requester, and ensures that the user is informed of the accurate request result data in a timely manner. No human participation is required, labor costs are reduced, and processing efficiency is improved.

本領域普通技術人員可以理解:實現上述各方法實施例的全部或部分步驟可以通過程序指令相關的硬體來完成。前述的程序可以儲存於一計算機可讀取儲存媒體中。該程序在執行時,執行包括上述各方法實施例的步驟;而前述的儲存媒體包括:ROM、RAM、磁碟或者光碟等各種可以儲存程序代碼的媒體。 Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by program instructions related to hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps including the above method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

最後應說明的是:以上各實施例僅用以說明本發明的技術方案,而非對其限制;儘管參照前述各實施例對本發明進行了詳細的說明,本領域的普通技術人員應當理解:其依然可以對前述各實施例所記載的技術方案進行修改,或者對其中部分或者全部技術特徵進行等同替換;而這些修改或者替換,並不使相應技術方案的本質脫離本發明各實施例技術方案的範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. Scope.

Claims (26)

一種異步服務處理方法,包括:根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料;接收並記錄所述服務提供方返回的所述目標服務請求的結果資料。 An asynchronous service processing method, comprising: obtaining a service request that needs to re-request result data from a service provider according to recorded processing details information of each service request as a target service request; for the target service request, re-providing the service to the service The service provider sends a polling request to request the result data of the target service request; receives and records the result data of the target service request returned by the service provider. 根據申請專利範圍第1項所述的方法,其中,所述各服務請求的處理詳情資訊包括各服務請求的接收時間和執行狀態;所述根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,包括:根據所述各服務請求的執行狀態,獲取處於發送異步請求成功狀態的服務請求作為候選服務請求;計算所述候選服務請求的接收時間與當前時間的差值,獲取所述差值大於指定時間的服務請求作為所述目標服務請求。 According to the method described in item 1 of the scope of the application, the processing detail information of each service request includes the reception time and execution status of each service request; The service request requesting the result data from the service provider as the target service request includes: according to the execution state of each service request, obtaining the service request in the successful state of sending the asynchronous request as the candidate service request; calculating the reception of the candidate service request The difference between the time and the current time, and the service request whose difference is greater than the specified time is obtained as the target service request. 根據申請專利範圍第2項所述的方法,其中,還包括:當所述服務提供方成功返回所述目標服務請求的結果資料時,更新所述目標服務請求的執行狀態為輪詢結果完 成狀態。 The method according to item 2 of the scope of the application, further comprising: when the service provider successfully returns the result data of the target service request, updating the execution status of the target service request to the polling result completed into a state. 根據申請專利範圍第1項所述的方法,其中,還包括:若未成功發送所述輪詢請求,等待設定時長後重新向所述服務提供方發送所述輪詢請求。 The method according to item 1 of the scope of the application, further comprising: if the polling request is not sent successfully, waiting for a set period of time to re-send the polling request to the service provider. 根據申請專利範圍第4項所述的方法,其中,所述等待設定時長後重新向所述服務提供方發送所述輪詢請求之前,還包括:判斷是否達到設定的輪詢次數閾值;若否,則執行所述等待所述設定時長後重新向所述服務提供方發送所述輪詢請求的步驟。 The method according to item 4 of the scope of the patent application, wherein, before re-sending the polling request to the service provider after the waiting for a set period of time, the method further includes: judging whether a set threshold of polling times is reached; if not , the step of re-sending the polling request to the service provider after waiting for the set period of time is performed. 根據申請專利範圍第1項所述的方法,其中,所述根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求,包括:當預設掃描週期到達時,根據記錄的所述各服務請求的處理詳情資訊,獲取需要重新向所述服務提供方請求結果資料的服務請求作為所述目標服務請求;或者在每次重新啟動時,根據記錄的所述各服務請求的處理詳情資訊,獲取需要重新向所述服務提供方請求結果資料的服務請求作為所述目標服務請求。 The method according to item 1 of the scope of the application, wherein, according to the recorded processing details information of each service request, acquiring the service request that needs to re-request the result data from the service provider as the target service request includes: when preset When the scanning period arrives, according to the recorded processing details of each service request, obtain the service request that needs to re-request the result data from the service provider as the target service request; or at each restart, according to the record The processing details information of each service request is obtained, and the service request that needs to re-request the result data from the service provider is obtained as the target service request. 根據申請專利範圍第1-6項任一項所述的方法,其中,所述根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服 務請求之前,還包括:在針對所述各服務請求執行異步服務處理流程的過程中,記錄所述各服務請求的處理詳情資訊。 The method according to any one of items 1 to 6 of the scope of the application, wherein the service request that needs to re-request the result data from the service provider is obtained as the target service according to the recorded processing details information of each service request. Before the service request, the method further includes: in the process of executing the asynchronous service processing flow for each service request, recording the processing detail information of each service request. 根據申請專利範圍第7項所述的方法,其中,所述在針對所述各服務請求執行異步服務處理流程的過程中,記錄所述各服務請求的處理詳情資訊,包括以下至少一種操作:當接收到所述各服務請求時,記錄所述各服務請求的接收時間;當針對所述各服務請求成功向所述服務提供方發送所述異步請求時,記錄所述各服務請求的執行狀態為發送異步請求成功狀態;當所述服務提供方成功返回所述各服務請求的結果資料時,更新所述各服務請求的執行狀態為輪詢結果完成狀態。 The method according to item 7 of the scope of the application, wherein in the process of executing the asynchronous service processing flow for each service request, recording the processing details of each service request includes at least one of the following operations: when When each service request is received, record the receiving time of each service request; when the asynchronous request is successfully sent to the service provider for each service request, record the execution status of each service request as: Send the asynchronous request success status; when the service provider successfully returns the result data of each service request, update the execution status of each service request to the polling result completion status. 一種異步服務處理方法,包括:針對服務請求,執行異步服務處理流程;在執行所述異步服務處理流程的過程中,記錄所述服務請求的處理詳情資訊。 An asynchronous service processing method, comprising: executing an asynchronous service processing flow for a service request; and recording the processing detail information of the service request during the execution of the asynchronous service processing flow. 根據申請專利範圍第9項所述的方法,其中,所述針對服務請求,執行異步服務處理流程,包括:接收所述服務請求;針對所述服務請求,向服務提供方發送異步請求;若成功發送所述異步請求,向所述服務提供方發送輪 詢請求,以請求所述服務請求的結果資料。 The method according to item 9 of the scope of the patent application, wherein performing an asynchronous service processing flow for a service request includes: receiving the service request; for the service request, sending an asynchronous request to a service provider; if successful send the asynchronous request, send the wheel to the service provider query request to request the result data of the service request. 根據申請專利範圍第10項所述的方法,其中,所述在執行所述異步服務處理流程的過程中,記錄所述服務請求的處理詳情資訊,包括以下至少一種操作:當接收到所述服務請求時,記錄所述服務請求的接收時間;當針對所述服務請求成功向所述服務提供方發送所述異步請求時,記錄所述服務請求的執行狀態為發送異步請求成功狀態;當所述服務提供方成功返回所述各服務請求的結果資料時,更新所述服務請求的執行狀態為輪詢結果完成狀態。 The method according to item 10 of the scope of the application, wherein the recording of the processing details of the service request during the process of executing the asynchronous service processing flow includes at least one of the following operations: when the service is received When requesting, record the reception time of the service request; when the asynchronous request is successfully sent to the service provider for the service request, record the execution status of the service request as the status of sending the asynchronous request successfully; when the service request is successfully sent to the service provider When the service provider successfully returns the result data of each service request, the execution state of the service request is updated to the polling result completion state. 根據申請專利範圍第10項所述的方法,其中,所述針對服務請求,執行異步服務處理流程,還包括:若未成功發送所述輪詢請求,等待設定時長後重新向所述服務提供方發送所述輪詢請求。 The method according to item 10 of the scope of the application, wherein the performing an asynchronous service processing flow for the service request further comprises: if the polling request is not sent successfully, waiting for a set period of time and re-reporting to the service provider The polling request is sent. 根據申請專利範圍第12項所述的方法,其中,所述等待設定時長後重新向所述服務提供方發送所述輪詢請求之前,還包括:判斷是否達到設定的輪詢次數閾值;若否,則執行所述等待設定時長後重新向所述服務提供方發送所述輪詢請求的步驟。 The method according to item 12 of the scope of the patent application, wherein, before re-sending the polling request to the service provider after the waiting for a set period of time, the method further comprises: judging whether the set threshold of polling times is reached; , the step of re-sending the polling request to the service provider after the waiting for the set time period is performed. 一種伺服器,包括:獲取模組,用於根據記錄的各服務請求的處理詳情資 訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求;輪詢模組,用於針對所述目標服務請求,重新向所述服務提供方發送輪詢請求,以請求獲取所述目標服務請求的結果資料;接收模組,用於接收並記錄所述服務提供方返回的所述目標服務請求的結果資料。 A server, comprising: an acquisition module for processing detailed information according to recorded service requests information, obtain the service request that needs to re-request the result data from the service provider as the target service request; the polling module is used to re-send the polling request to the service provider for the target service request to request to obtain all the The result data of the target service request; the receiving module is used to receive and record the result data of the target service request returned by the service provider. 根據申請專利範圍第14項所述的伺服器,其中,所述各服務請求的處理詳情資訊包括各服務請求的接收時間和執行狀態;所述獲取模組用於:根據所述各服務請求的執行狀態,獲取處於發送異步請求成功狀態的服務請求作為候選服務請求;計算所述候選服務請求的接收時間與當前時間的差值,獲取所述差值大於指定時間的服務請求作為所述目標服務請求。 The server according to claim 14, wherein the processing detail information of each service request includes the reception time and execution status of each service request; the acquiring module is used for: according to the processing details of each service request In the execution state, the service request in the successful state of sending the asynchronous request is obtained as the candidate service request; the difference between the reception time of the candidate service request and the current time is calculated, and the service request with the difference greater than the specified time is obtained as the target service ask. 根據申請專利範圍第15項所述的伺服器,其中,所述接收模組還用於:當所述服務提供方成功返回所述目標服務請求的結果資料時,更新所述目標服務請求的執行狀態為輪詢結果完成狀態。 The server according to claim 15, wherein the receiving module is further configured to: update the execution of the target service request when the service provider successfully returns the result data of the target service request The status is the polling result completion status. 根據申請專利範圍第14項所述的伺服器,其中,所述輪詢模組還用於:若未成功發送所述輪詢請求,等待設定時長後重新向 所述服務提供方發送所述輪詢請求。 The server according to item 14 of the scope of the application, wherein the polling module is further configured to: if the polling request is not sent successfully, wait for a set time period and then send the polling request again. The service provider sends the polling request. 根據申請專利範圍第17項所述的伺服器,其中,所述輪詢模組還用於:在所述等待設定時長後重新向所述服務提供方發送所述輪詢請求之前,判斷是否達到設定的輪詢次數閾值;若否,則執行所述等待所述設定時長後重新向所述服務提供方發送所述輪詢請求的步驟。 The server according to claim 17, wherein the polling module is further configured to: determine whether the polling request is reached before resending the polling request to the service provider after the waiting set time period. The set threshold for the number of polling times; if not, execute the step of re-sending the polling request to the service provider after waiting for the set period of time. 根據申請專利範圍第14項所述的伺服器,其中,所述獲取模組用於:當預設掃描週期到達時,根據記錄的所述各服務請求的處理詳情資訊,獲取需要重新向所述服務提供方請求結果資料的服務請求作為所述目標服務請求;或者在每次重新啟動時,根據記錄的所述各服務請求的處理詳情資訊,獲取需要重新向所述服務提供方請求結果資料的服務請求作為所述目標服務請求。 The server according to item 14 of the scope of the application, wherein the obtaining module is used for: when the preset scanning cycle arrives, according to the recorded processing details information of each service request, obtain the need to re-report to the The service request of the service provider requesting the result data is taken as the target service request; or at each restart, according to the recorded processing details of the service requests, obtain the service request that needs to re-request the result data from the service provider. A service request serves as the target service request. 根據申請專利範圍第14-19項任一項所述的伺服器,其中,所述獲取模組還用於:在所述根據記錄的各服務請求的處理詳情資訊,獲取需要重新向服務提供方請求結果資料的服務請求作為目標服務請求之前,在針對所述各服務請求執行異步服務處理流程的過程中,記錄所述各服務請求的處理詳情資訊。 The server according to any one of items 14 to 19 in the scope of the application, wherein the obtaining module is further configured to: obtain, according to the recorded processing details information of each service request, which needs to be re-reported to the service provider Before the service request requesting the result data is used as the target service request, in the process of executing the asynchronous service processing flow for each service request, the processing detail information of each service request is recorded. 根據申請專利範圍第20項所述的伺服器,其中,所述獲取模組用於執行以下至少一種操作:當接收到所述各服務請求時,記錄所述各服務請求的 接收時間;當針對所述各服務請求成功向所述服務提供方發送所述異步請求時,記錄所述各服務請求的執行狀態為發送異步請求成功狀態;當所述服務提供方成功返回所述各服務請求的結果資料時,更新所述各服務請求的執行狀態為輪詢結果完成狀態。 The server according to claim 20, wherein the acquisition module is configured to perform at least one of the following operations: when each service request is received, record the Receiving time; when the asynchronous request is successfully sent to the service provider for each service request, the execution status of each service request is recorded as the status of sending asynchronous requests successfully; when the service provider successfully returns the When the result data of each service request is obtained, the execution state of each service request is updated to the polling result completion state. 一種伺服器,包括:執行模組,用於針對服務請求,執行異步服務處理流程;記錄模組,用於在所述執行模組執行所述異步服務處理流程的過程中,記錄所述服務請求的處理詳情資訊。 A server, comprising: an execution module for executing an asynchronous service processing flow for a service request; a recording module for recording the service request when the execution module executes the asynchronous service processing flow 's processing details. 根據申請專利範圍第22項所述的伺服器,其中,所述執行模組用於:接收所述服務請求;針對所述服務請求,向服務提供方發送異步請求;若成功發送所述異步請求,向所述服務提供方發送輪詢請求,以請求所述服務請求的結果資料。 The server according to claim 22, wherein the execution module is configured to: receive the service request; send an asynchronous request to a service provider for the service request; if the asynchronous request is successfully sent , sending a polling request to the service provider to request the result data of the service request. 根據申請專利範圍第23項所述的伺服器,其中,所述記錄模組用於執行以下至少一種操作:當接收到所述服務請求時,記錄所述服務請求的接收時間;當針對所述服務請求成功向所述服務提供方發送所述異步請求時,記錄所述服務請求的執行狀態為發送異步請 求成功狀態;當所述服務提供方成功返回所述各服務請求的結果資料時,更新所述服務請求的執行狀態為輪詢結果完成狀態。 The server according to claim 23, wherein the recording module is configured to perform at least one of the following operations: when receiving the service request, record the receiving time of the service request; When the service request successfully sends the asynchronous request to the service provider, record the execution status of the service request as sending asynchronous request. Obtain the success status; when the service provider successfully returns the result data of each service request, update the execution status of the service request to the polling result completion status. 根據申請專利範圍第23項所述的伺服器,其中,所述執行模組還用於:若未成功發送所述輪詢請求,等待設定時長後重新向所述服務提供方發送所述輪詢請求。 The server according to claim 23, wherein the execution module is further configured to: if the polling request is not sent successfully, wait for a set period of time to re-send the polling to the service provider ask. 根據申請專利範圍第25項所述的伺服器,其中,所述執行模組還用於:在所述等待設定時長後重新向所述服務提供方發送所述輪詢請求之前,判斷是否達到設定的輪詢次數閾值;若否,則執行所述等待設定時長後重新向所述服務提供方發送所述輪詢請求的步驟。 The server according to claim 25, wherein the execution module is further configured to: determine whether the setting is reached before re-sending the polling request to the service provider after the waiting set time period If not, execute the step of re-sending the polling request to the service provider after waiting for a set period of time.
TW106102680A 2016-02-04 2017-01-24 Asynchronous service processing method and its server TWI753876B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610080674.6 2016-02-04
CN201610080674.6A CN107040563B (en) 2016-02-04 2016-02-04 Asynchronous service processing method and server

Publications (2)

Publication Number Publication Date
TW201732654A TW201732654A (en) 2017-09-16
TWI753876B true TWI753876B (en) 2022-02-01

Family

ID=59500983

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106102680A TWI753876B (en) 2016-02-04 2017-01-24 Asynchronous service processing method and its server

Country Status (3)

Country Link
CN (1) CN107040563B (en)
TW (1) TWI753876B (en)
WO (1) WO2017133531A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729165A (en) * 2017-10-12 2018-02-23 郑州云海信息技术有限公司 A kind of information acquisition method, apparatus and system
CN110827108B (en) * 2018-08-13 2023-05-26 阿里巴巴集团控股有限公司 Information searching method, searching request control method and system
CN109711741A (en) * 2018-12-29 2019-05-03 上海二三四五金融科技有限公司 A kind of control method and control device obtaining equipment air control data
CN109889593B (en) * 2019-02-27 2021-11-12 中国人民解放军海军工程大学 Distributed master-slave machine communication method and device for mobile security shelter
CN111711826B (en) * 2019-03-18 2023-11-03 北京奇虎科技有限公司 Video live broadcast service system and method
CN112085490A (en) * 2019-06-13 2020-12-15 百度在线网络技术(北京)有限公司 Asynchronous charging method, device, equipment and computer readable storage medium
CN110543381B (en) * 2019-08-21 2022-02-22 语联网(武汉)信息技术有限公司 Method and device for recovering service of machine translation engine
CN113065054B (en) * 2021-03-31 2024-03-01 北京达佳互联信息技术有限公司 Request processing method, request processing device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120240A1 (en) * 1995-02-13 2008-05-22 Intertrust Tecnologies Corporation Trusted infrastructure support systems, methods and techniques for secure electronic commerce, electronic transactions, commerce process control and automation, distributed computing, and rights management
US7899915B2 (en) * 2002-05-10 2011-03-01 Richard Reisman Method and apparatus for browsing using multiple coordinated device sets
CN102710665A (en) * 2012-06-27 2012-10-03 深圳中兴网信科技有限公司 Mobile terminal, and data synchronization method of server and mobile terminal
CN103885988A (en) * 2012-12-21 2014-06-25 中国移动通信集团公司 Method and device for outputting content and content outputting system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7984330B2 (en) * 2009-02-27 2011-07-19 Yahoo! Inc. Smart recovery of asynchronous processing
CN103220206B (en) * 2012-01-19 2017-04-19 阿里巴巴集团控股有限公司 Message sending method and device and message receiving method and device
CN104753966A (en) * 2013-12-25 2015-07-01 明博教育科技有限公司 Resource file inquiry method and system based on server and client caches
CN104852991A (en) * 2015-06-01 2015-08-19 上海雷腾软件股份有限公司 Distributed push server system and data push method using the system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120240A1 (en) * 1995-02-13 2008-05-22 Intertrust Tecnologies Corporation Trusted infrastructure support systems, methods and techniques for secure electronic commerce, electronic transactions, commerce process control and automation, distributed computing, and rights management
US7899915B2 (en) * 2002-05-10 2011-03-01 Richard Reisman Method and apparatus for browsing using multiple coordinated device sets
CN102710665A (en) * 2012-06-27 2012-10-03 深圳中兴网信科技有限公司 Mobile terminal, and data synchronization method of server and mobile terminal
CN103885988A (en) * 2012-12-21 2014-06-25 中国移动通信集团公司 Method and device for outputting content and content outputting system

Also Published As

Publication number Publication date
CN107040563B (en) 2021-01-19
CN107040563A (en) 2017-08-11
TW201732654A (en) 2017-09-16
WO2017133531A1 (en) 2017-08-10

Similar Documents

Publication Publication Date Title
TWI753876B (en) Asynchronous service processing method and its server
US11277464B2 (en) Data restoration for datacenter failover
US10862740B2 (en) Method and apparatus for switching service nodes in a distributed storage system
US11741075B2 (en) Methods and system of tracking transactions for distributed ledger
US9722890B2 (en) Integrated incident management for hybrid landscapes
WO2013078689A1 (en) Method and device for realizing message transfer in cloud message service
CN109819265B (en) Data storage method, data acquisition method and system
TW201724825A (en) System and method for acquiring, processing and updating global information
TW201724001A (en) System and method for acquiring, processing and updating global information
WO2012171349A1 (en) Method, apparatus and system for implementing distributed auto-incrementing counting
CN108228581B (en) Zookeeper compatible communication method, server and system
CN111083228A (en) Identification number generation method and device and electronic equipment
EP3754998B1 (en) Streaming media quality monitoring method and system
US20110093509A1 (en) Common interaction log repository with advanced content management capabilities
JP2016527846A (en) Manage data feeds
CN111355765A (en) Network request processing and sending method and device
US10812434B2 (en) Apparatus and method for maintaining message databases in eventual consistency distributed database systems
US9374437B2 (en) Schema validation proxy
US10848580B2 (en) Information processing system and control method
WO2018196715A1 (en) Short message centre reminding method and short message gateway
US20090106781A1 (en) Remote call handling methods and systems
US8977682B2 (en) Rebuild system for a storage network
CN113032021A (en) System switching and data processing method, device, equipment and storage medium thereof
US20200042403A1 (en) Apparatus, method, and program product for cluster configuration data backup and recovery
CN110764932A (en) Data processing method, system, medium and computing device