Business callback method and apparatus

By introducing registration and unbinding interfaces for hook services into the distributed registration callback system, asynchronous and synchronous queue registration is supported, solving the flexibility and process control problems of the existing system, realizing flexible registration and unbinding of business functions, and meeting diverse needs.

CN119743515BActive Publication Date: 2026-02-27CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411762824.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2026-02-27
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

Existing distributed registration callback systems are insufficient in terms of flexibility and process control, and cannot meet a wide variety of business needs.

Method used

The registration and unbinding interfaces provided by the hook service allow external services to be dynamically registered and unbound throughout the entire lifecycle of the business. It supports asynchronous queue registration and synchronous queue registration, and uses the hook service to perform flexible process control by dividing it into pre-hook, mid-hook, and post-hook services.

Benefits of technology

It enables flexible registration and unbinding of services, supports dynamic plug-and-play operations, has a controllable process, is easy to expand, and meets diverse business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743515B_ABST
    Figure CN119743515B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a service callback method and device, the service includes a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided by using a hook service, the method comprises the following steps: allowing an external service to register on the service through the registration interface in the whole life cycle of the service; and / or, allowing the external service to register and unbind on the service through the unbinding interface in the whole life cycle of the service. The service of the embodiment of the present application can allow the external service to flexibly register and unbind in the whole life cycle, so that the plug and unplug operation of a single service can be performed at any time according to actual service needs, thereby meeting various service demands.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of cloud computing, and in particular, to a service callback method, a service callback device, an electronic device, and a computer readable storage medium. BACKGROUND

[0002] In a specific implementation, a distributed registration callback system is a mechanism for managing and processing events and callbacks in a distributed system. The distributed registration callback system can allow an external service to handle a business after the external service registers the business. However, the registration and callback of the existing distributed registration callback system are not flexible enough to meet various business needs. SUMMARY

[0003] In view of the above problems, a service callback method and device are provided to overcome the above problems or at least partially solve the above problems. The specific technical solutions are as follows:

[0004] In a first aspect of the present application, a service callback method is first provided. The service includes a registration interface and an unbinding interface. The registration interface and the unbinding interface are provided using a hook service. The method includes:

[0005] allowing an external service to register on the business through the registration interface throughout the life cycle of the business; and / or

[0006] allowing the external service to register unbinding on the business through the unbinding interface throughout the life cycle of the business.

[0007] In an embodiment of the present application, after allowing the external service to register on the business through the registration interface throughout the life cycle of the business, the method further includes:

[0008] determining whether the business is registered with a registration interface of the external service when the business is triggered;

[0009] if the business is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to allow the external service to handle the business, and calling the external service to handle the business processing result of the business.

[0010] In an embodiment of the present application, the registration of the external service on the business includes asynchronous queue registration and synchronous queue registration. The asynchronous queue registration is used to obtain the business processing result of the external service on the business, and the synchronous queue registration is used to control the flow of the business according to the business processing result of the external service.

[0011] In an embodiment of the present application, if the service is registered with the registration interface of the external service, the registration interface of the external service is invoked one by one to make the external service process the service, and the service processing result of the external service processing the service is called back, including:

[0012] When the registration of the external service on the service is asynchronous queue registration, if the service is registered with the registration interface of the external service, the registration interface of the external service is invoked one by one to make the external service process the service, and the service processing result of the external service processing the service is called back.

[0013] In an embodiment of the present application, if the service is registered with the registration interface of the external service, the registration interface of the external service is invoked one by one to make the external service process the service, and the service processing result of the external service processing the service is called back, including:

[0014] When the registration of the external service on the service is synchronous queue registration, if the service is registered with the registration interface of the external service, the registration interface of the external service is invoked one by one to make the external service process the service, and the service processing result of the external service processing the service is called back.

[0015] It is determined whether to continue to execute the service according to the service processing result.

[0016] In an embodiment of the present application, the method further includes:

[0017] When the service is triggered, it is determined whether the service is registered with the registration interface of the external service;

[0018] If the service is not registered with the registration interface of the external service, the service is continued to be executed or ended.

[0019] In an embodiment of the present application, the hook service is divided into a front hook service, a middle hook service and a rear hook service according to time; the front hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration before the service starts; the middle hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration in the process of executing the service; and the rear hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration after the service starts to be executed.

[0020] The embodiment of the present application further discloses a service calling back device, a service including a registration interface and an unbinding interface, the registration interface and the unbinding interface being provided by using a hook service, and the device including:

[0021] a registration module, configured to allow an external service to register on the service through the registration interface during the whole life cycle of the service; and / or,

[0022] an unregistration module, configured to allow an external service to register unregistration on the service through the unregistration interface during the whole life cycle of the service.

[0023] In another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the service callback method described above.

[0024] In another aspect of the embodiments of the present application, a computer program product containing instructions is also provided, which, when executed on a computer, cause the computer to perform the service callback method described above.

[0025] Compared with the related art, the embodiments of the present application have at least the following advantages:

[0026] In the embodiments of the present application, the service in the distributed registration callback system can include a registration interface and an unregistration interface, the registration interface and the unregistration interface are provided by using a hook service, which can allow an external service to register on the service through the registration interface during the whole life cycle of the service, and / or can allow an external service to register unregistration on the service through the unregistration interface during the whole life cycle of the service. The service in the embodiments of the present application can allow an external service to flexibly register and unregister during the whole life cycle of the service, so that the plug and unplug operations of a single service can be performed at any time according to actual service needs, thereby meeting various service requirements. BRIEF DESCRIPTION OF DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced.

[0028] Figure 1 a flowchart of a service callback registration and callback process of a distributed registration callback system;

[0029] Figure 2 a flowchart of another service callback registration and callback process of a distributed registration callback system;

[0030] Figure 3 a flowchart of a service callback method provided in the embodiments of the present application;

[0031] Figure 4 a flowchart of a dynamic registration and dynamic unregistration process provided in the embodiments of the present application;

[0032] Figure 5A flowchart of a hook service provided in an embodiment of the present application;

[0033] Figure 6 A flowchart of a pre-hook provided in an embodiment of the present application;

[0034] Figure 7 A flowchart of an in-hook provided in an embodiment of the present application;

[0035] Figure 8 A schematic diagram of a bandwidth product information replacement provided in an embodiment of the present application;

[0036] Figure 9 A flowchart of a post-hook provided in an embodiment of the present application;

[0037] Figure 10 A structural block diagram of a service callback device provided in an embodiment of the present application;

[0038] Figure 11 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0040] The existing distributed registration callback system is roughly divided into two schemes. Referring to Figure 1 , the first scheme is implemented by using hard coding, the order and stage of the business are confirmed through pre-play of the scheme, and then the callback method of the business concerned is registered in the code in advance, and then the production environment is released online. This way requires a higher pre-play of the scheme, and lacks flexibility, sacrifices the smooth scalability of the micro-service architecture, and needs to be re-released online every time. Referring to Figure 2 , the second scheme is to implement the registration callback mechanism through some intermediate media (message middleware, database, etc.), for example, the registration of message middleware, that is, the consumer subscribes to a topic of the middleware, when the producer publishes a message to the topic, the consumer asynchronously consumes the message to complete the business, and the callback is completed by attaching the callback address in the message. The second scheme is more flexible than the first scheme, but it lacks process control, that is, it cannot determine whether the business continues to execute according to the callback result of the dependent service.

[0041] To solve the above problems, the embodiment of the present application proposes a new registration and callback scheme, which adds many new capabilities, including but not limited to dynamic registration, process control, data change, etc., while retaining the original registration callback basic functions. The embodiment of the present application has the characteristics of low deployment cost, flexibility, easy expansion, etc., so that it can be applied to a wider range of businesses in practical applications with lower R&D investment.

[0042] Reference Figure 3 The steps of the service callback method provided in the embodiment of the present application are shown in the flow chart as Figure 3 The service includes a registration interface and an unbinding interface, which are provided by using a hook service. The method can specifically include the following steps:

[0043] Step 201, allowing external services to register on the service through the registration interface during the entire life cycle of the service; and / or,

[0044] Step 202, allowing external services to register and unbind on the service through the unbinding interface during the entire life cycle of the service.

[0045] In the embodiment of the present application, the service (event) in the distributed registration callback system can include dynamic registration interfaces and unbinding interfaces, wherein the registration interfaces and the unbinding interfaces are provided by using a hook service. Specifically, in the computer field, hook, also known as hook, is a programming technique for intercepting function calls, message passing, event passing, etc. between software modules, so as to modify or extend the behavior of these modules. Therefore, the registration interfaces and the unbinding interfaces provided based on the hook service enable dynamic registration and registration unbinding during the entire life cycle of the service according to the service requirements. Callback is a programming technique, which refers to passing a function as a parameter to another function and calling this function by another function when an event (service) occurs.

[0046] In the embodiment of the present application, various services can be involved in the distributed registration callback system, such as bare metal opening service, order processing service, payment processing service, bandwidth service, and authentication service, etc. During the entire life cycle of a certain service, i.e. before, during and after the start of the service, one or more external services can be allowed to register on the dynamic registration interface of the service to realize the registration and callback of the external services, or one or more external services can be allowed to register on the dynamic unbinding interface of the service to realize the registration unbinding of the external services, so that the external service no longer calls back the service.

[0047] In the above business callback method, the business in the distributed registration callback system can include a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided by using a hook service, can allow an external service to register on the business through the registration interface in the whole life cycle of the business, and / or can allow the external service to register unbinding on the business through the unbinding interface in the whole life cycle of the business. The business of the embodiment of the present application can allow the external service to flexibly register and unbind in the whole life cycle thereof, so that the plug and play operation of a single business can be performed at any time according to actual business needs, thereby meeting various business needs.

[0048] In an embodiment of the present application, after allowing the external service to register on the business through the registration interface in the whole life cycle of the business, the method further includes:

[0049] When the business is triggered, it is determined whether the business is registered with the registration interface of the external service;

[0050] If the business is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the business, and the business processing result of the external service processing the business is called back.

[0051] Specifically, when the registration of the external service on the business is asynchronous queue registration, if the business is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the business, and the business processing result of the external service processing the business is called back; when the registration of the external service on the business is synchronous queue registration, if the business is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the business, and the business processing result of the external service processing the business is called back; whether to continue to execute the business is determined according to the business processing result.

[0052] In an embodiment of the present application, the registration of the external service on the business includes asynchronous queue registration and synchronous queue registration; the asynchronous queue registration is used to obtain the business processing result of the external service on the business, and the synchronous queue registration is used to perform flow control on the business according to the business processing result of the external service.

[0053] Exemplarily, with reference to Figure 4Fig. 1 is a flowchart of a dynamic registration and dynamic unbinding process provided in an embodiment of the present application. Specifically, the flowchart of the dynamic registration and dynamic unbinding based on hook is as follows: external services (e.g., service 1 and service 2) can register a service interface that needs to be accessed by the external services through a dynamic registration interface (hook service provision). The hook service can provide two queues for the external services to select from, one is in the form of a synchronous queue (synchronous queue registration or synchronous queue unbinding), and the other is in the form of an asynchronous queue (asynchronous queue registration or asynchronous queue unbinding). The external services select the queue that needs to be registered as needed. The registration form of the synchronous queue can be used for process control, and the asynchronous queue registration only focuses on whether the event (service) itself occurs, that is, only the service processing result of the external service on the service needs to be obtained. Of course, when unbinding is needed, the external services (e.g., service 1 and service 2) can perform unbinding through a dynamic unbinding interface.

[0054] In an embodiment of the present application, the registration interface and the unbinding interface are divided into a pre-hook service (pre-hook), a middle-hook service (middle-hook), and a post-hook service (post-hook) according to a triggering time. Specifically, the pre-hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration before the service starts. The middle-hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration during the execution of the service. The post-hook service is used to register or unbind on the service by using asynchronous queue registration and synchronous queue registration after the execution of the service starts.

[0055] For example, refer to Fig. 2. Figure 5 Fig. 3 is a flowchart of a hook service provided in an embodiment of the present application. Taking a bare metal opening service (Ebm Create Request) as an example, the hook is mainly divided into three time points, pre-hook, middle-hook, and post-hook, which involve the following services:

[0056] Api Service (hereinafter referred to as api): aggregation service, mainly used for integrating the returned data of the backend micro service, and providing a stable interface to the front end.

[0057] Ebm Service (hereinafter referred to as ebm): bare metal service micro service, mainly used for screening and applying bare metal resources, and is the actual service for executing the bare metal opening service.

[0058] Database (hereinafter referred to as db): database service, mainly used for saving data.

[0059] The function of the pre-hook: before the execution of a specific business, if process control is needed, the registered service interface can be called in the form of a synchronous queue, and the business process is determined to be terminated according to the returned business processing result, or the registered service interface can be called in the form of an asynchronous queue if process control is not needed. Among them, the pre-hook is often used for permission or data verification.

[0060] The function of the middle-hook: in the execution of a specific business, if process control is needed, the registered service interface can be called in the form of a synchronous queue, and the business process is determined to be terminated according to the returned business processing result, or the registered service interface can be called in the form of an asynchronous queue if process control is not needed. Among them, the middle-hook is also often used for data change, and the passed parameter service can be added or deleted by itself.

[0061] The function of the post-hook: after the execution of a specific business, if process control is needed, the registered service interface can be called in the form of a synchronous queue, and the business process is determined to be terminated according to the returned business processing result, or the registered service interface can be called in the form of an asynchronous queue if process control is not needed. Among them, the post-hook is often used for sending business execution results, and is mostly in the form of an asynchronous queue.

[0062] Reference Figure 6 A flowchart of a pre-hook provided in an embodiment of the present application is shown, taking a pre-hook of a bare metal opening service (Ebm Create Request) as an example. The following services using the pre-hook exist:

[0063] User Authority Verify Service (hereinafter referred to as uavs): user authority service, mainly for permission verification.

[0064] Resource Inventory Verify Service (hereinafter referred to as rivs): resource inventory service, mainly for checking whether the resource inventory is sufficient.

[0065] Log Record Service (hereinafter referred to as lrs): log record service, used for recording event logs.

[0066] Specifically, the API calls the uavs service in a synchronous manner for permission verification, and according to the permission verification result, it is determined whether the business process can continue. The API also calls the rivs in a synchronous manner, and according to the inventory verification result, it is determined whether the business process can continue. However, the lrs log record can be called in an asynchronous manner, because the success or failure of the log record does not affect the progress of the overall business process.

[0067] In the above example of the pre-hook, the hook mechanism also realizes the easy expansion in the distributed architecture by the effect on the flow control. Other services can access the pre-hook through dynamic registration at any time, and can exit at any time through dynamic unsubscription.

[0068] Referring to Figure 7 , a flowchart of a middle hook provided in an embodiment of the present application is taken as an example of a middle hook of a bare metal service opening (Ebm Create Request), and the following services using the middle hook exist

[0069] Bandwidth Service (hereinafter referred to as bs): bandwidth product service, mainly processing bandwidth related business

[0070] Specifically, before entering the ebm formal opening of the bare metal, there is usually a bandwidth product accompanying the opening of the bare metal, but the ebm certainly does not process the bandwidth product related logic, so at this time, the bs can process the bandwidth product business related logic through the service interface registered in the middle hook, and after the processing is completed, the bandwidth product information transmitted by the original api layer is replaced with a newly opened bandwidth instance id, specifically as Figure 8 , “bandWidth id":0” is replaced with “bandWidth id":10”, and then returned to the ebm through the response, and the ebm can establish a correlation between the opened bare metal and the bandwidth product instance by means of the bandwidth instance id when writing the database. It can be seen that the middle hook can realize the powerful function of data management in the middle process of the business process, and the flexible registration and unbinding of the hook can realize the purpose of producing different data streams at different times. The interface call of the bs should also adopt a synchronous mode, because if the bandwidth instance fails to be created, the bare metal instance should not be created, and the process control of the hook scheme is realized again.

[0071] Referring to Figure 9 , a flowchart of a post-hook provided in an embodiment of the present application is taken as an example of a post-hook of a bare metal service opening (Ebm Create Request) Figure 8 , and the following services using the middle hook exist

[0072] Order Service (hereinafter referred to as os): order service, mainly processing order related business

[0073] Data Statistics Service (hereinafter referred to as dss): statistical service, mainly processing data statistical related business

[0074] Specifically, after the ebm completes the opening of the bare metal instance, the process of representing the entire resource opening has been completed, at this time, the os service needs to be notified to mark the order completion, so the os service can register the processing function of the related business through the post-hook, and this call should also be completed in the form of synchronization to ensure that the order process can end normally. Because the dss service is for data statistics, it can use the post-hook asynchronously to record the results of this opening. Because the success or failure of data statistics recording does not affect the execution of the entire business process.

[0075] In an embodiment of the present application, the method can further comprise:

[0076] When the business is triggered, it is determined whether the business is registered with the registration interface of the external service;

[0077] If the business is not registered with the registration interface of the external service, the business is continued to be executed or ended.

[0078] In an embodiment of the present application, when the business is triggered, it can be determined whether the business is registered with the registration interface of the external service. If it is determined that the business is registered with the registration interface of the external service, the external service is called to process the business through the registration node and returns the business processing result, and the process control can be performed according to the queue registration form (asynchronous queue registration or synchronous queue registration) of the external business or the processing result is directly returned and saved. If it is determined that the business is not registered with the registration interface of the external service, the business can be continued to be executed according to the original process or ended.

[0079] It can be seen that the application of the embodiment of the present application can achieve at least the following advantages: 1. Dynamic registration process, according to the actual business needs, the plug-in operation of a single event (business) can be performed at any time (that is, the external business can be called at any time or stopped); 2. Process controllable, the business process can be controlled according to the callback result of the external service whether it can be executed; 3. Easy to expand, new extended external services can be accessed as needed according to the business needs; 4. Process data change control, data change screening and change can be added in the business process.

[0080] It should be noted that for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0081] With reference to Figure 10 , a structural block diagram of a service callback device provided in an embodiment of the present application is shown in FIG. 1. The service includes a registration interface and an unregistration interface, and the registration interface and the unregistration interface are provided by using a hook service. The device can specifically include the following modules: Figure 10

[0082] A registration module 1001 is configured to allow an external service to register on the service through the registration interface during the entire life cycle of the service; and / or

[0083] An unregistration module 1002 is configured to allow the external service to register unregistration on the service through the unregistration interface during the entire life cycle of the service.

[0084] In an embodiment of the present application, the device further includes a service processing module configured to:

[0085] When the service is triggered, it is determined whether the service is registered with a registration interface of an external service;

[0086] If the service is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the service and callback a service processing result of the external service processing the service.

[0087] In an embodiment of the present application, the registration of the external service on the service includes asynchronous queue registration and synchronous queue registration; the asynchronous queue registration is used to obtain a service processing result of the external service on the service, and the synchronous queue registration is used to perform flow control on the service according to the service processing result of the external service.

[0088] In an embodiment of the present application, the service processing module is configured to:

[0089] When the registration of the external service on the service is asynchronous queue registration, if the service is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the service and callback a service processing result of the external service processing the service.

[0090] In an embodiment of the present application, the service processing module is configured to:

[0091] When the registration of the external service on the service is synchronous queue registration, if the service is registered with the registration interface of the external service, the registration interfaces of the external service are called one by one to make the external service process the service and callback a service processing result of the external service processing the service.

[0092] ​Determine whether to continue executing the service according to the service processing result.

[0093] In an embodiment of the present application, the service processing module is configured to:

[0094] When the service is triggered, determine whether the service is registered with a registration interface of an external service;

[0095] If the service is not registered with the registration interface of the external service, continue executing the service or end.

[0096] In an embodiment of the present application, the hook service is divided into a pre-hook service, a middle-hook service and a post-hook service according to time; the pre-hook service is configured to register or unbind on the service using asynchronous queue registration and synchronous queue registration before the service starts; the middle-hook service is configured to register or unbind on the service using asynchronous queue registration and synchronous queue registration during execution of the service; and the post-hook service is configured to register or unbind on the service using asynchronous queue registration and synchronous queue registration after the service starts.

[0097] In an embodiment of the present application, the service in the distributed registration callback system can include a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided using the hook service, and the external service can be allowed to register on the service throughout the life cycle of the service through the registration interface, and / or the external service can be allowed to register and unbind on the service throughout the life cycle of the service through the unbinding interface. The service in the embodiment of the present application can allow the external service to flexibly register and unbind throughout the life cycle of the service, so that the plug-in operation of a single service can be performed at any time according to actual service needs, thereby meeting various service requirements.

[0098] For the above-mentioned device embodiment, since it is basically similar to the method embodiment, it is described relatively simply, and the related parts refer to the part of the method embodiment.

[0099] It should be noted that the present application embodiment can involve the use of user data, and in actual application, user-specific personal data can be used in the scheme described herein within the scope allowed by applicable laws and regulations (for example, user explicit consent, user actual notification, etc.).

[0100] The present application embodiment further provides an electronic device, as shown in the figure, comprising a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504, Figure 11 as shown, comprising a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,

[0101] a memory 503, configured to store a computer program;

[0102] a processor 501, configured to execute the program stored in the memory 503, and implement the service callback method in any of the above embodiments.

[0103] allowing an external service to register on the service through the registration interface during the whole life cycle of the service; and / or,

[0104] allowing the external service to unregister on the service through the unregistration interface during the whole life cycle of the service.

[0105] Optionally, after allowing the external service to register on the service through the registration interface during the whole life cycle of the service, the method further comprises:

[0106] determining whether the service is registered with the registration interface of the external service when the service is triggered;

[0107] if the service is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to make the external service process the service and callback the service processing result of the external service.

[0108] Optionally, if the service is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to make the external service process the service and callback the service processing result of the external service, comprises:

[0109] if the registration of the external service on the service is asynchronous queue registration, if the service is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to make the external service process the service and callback the service processing result of the external service.

[0110] Optionally, if the service is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to make the external service process the service and callback the service processing result of the external service, comprises:

[0111] if the registration of the external service on the service is synchronous queue registration, if the service is registered with the registration interface of the external service, invoking the registration interface of the external service one by one to make the external service process the service and callback the service processing result of the external service.

[0112] determining whether to continue to execute the service according to the service processing result.

[0113] Optionally, the method further comprises:

[0114] When the service is triggered, determining whether the service is registered with a registration interface of the external service;

[0115] If the service is not registered with the registration interface of the external service, continuing to execute the service or ending.

[0116] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0117] The communication interface is used for communication between the terminal and other devices.

[0118] The memory can include a Random Access Memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the processor.

[0119] The processor mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc. It can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0120] In another embodiment provided by the application, a computer readable storage medium is provided, and the computer readable storage medium stores instructions, when the instructions are run on a computer, the computer executes the service callback method in any of the above embodiments.

[0121] In yet another embodiment of the present disclosure, there is provided a computer program product comprising instructions which, when executed on a computer, cause the computer to carry out the business callback method of any of the above embodiments.

[0122] In the above embodiments, the whole or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, the whole or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the whole or part of the processes or functions according to the embodiments of the present disclosure are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk (SSD)) and the like.

[0123] It should be noted that, in this document, the terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed or inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0124] The various embodiments in the specification are described in a related manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the system embodiments are described more simply because they are basically similar to the method embodiments, and the relevant parts can be referred to the part of the method embodiments.

[0125] The above only describes the preferred embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A business callback method, characterized in that, The service includes a registration interface and an unbinding interface, which are provided using a hook service. The method includes: Allows external services to register with the service throughout its entire lifecycle via the registration interface; and / or, External services are allowed to register and unbind on the service throughout its entire lifecycle via the unbinding interface; After allowing external services to register with the business throughout its entire lifecycle via the registration interface, the method further includes: When the service is triggered, determine whether the service has registered an external service registration interface; If the business registration has the registration interface of the external service, then the registration interface of the external service is called one by one so that the external service can process the business and the business processing result of the external service is called back; The registration of the external service with the business includes asynchronous queue registration and synchronous queue registration; the asynchronous queue registration is used to obtain the business processing result of the external service for the business, and the synchronous queue registration is used to perform process control on the business based on the business processing result of the external service; According to the timing, the hook services are divided into pre-hook services, mid-hook services, and post-hook services. The pre-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration before the service starts. The mid-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration during the service execution. The post-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration after the service execution starts.

2. The method according to claim 1, characterized in that, If the business registration has a registration interface for the external service, then the registration interface of the external service is called one by one to enable the external service to process the business, and the business processing result of the external service is called back, including: When the registration of the external service on the business is an asynchronous queue registration, if the business has a registration interface for the external service, then the registration interface of the external service is called one by one so that the external service can process the business and the business processing result of the external service is called back.

3. The method according to claim 1, characterized in that, If the business registration has a registration interface for the external service, then the registration interface of the external service is called one by one to enable the external service to process the business, and the business processing result of the external service is called back, including: When the external service is registered with the business as a synchronous queue registration, if the business has a registration interface for the external service, then the registration interface of the external service is called one by one so that the external service can process the business and the business processing result of the external service is called back. Determine whether to continue executing the business based on the business processing result.

4. The method according to claim 1, characterized in that, The method further includes: When the service is triggered, determine whether the service has registered an external service registration interface; If the service has not registered an interface for the external service, then the service will continue to be executed or terminated.

5. A business callback device, characterized in that, The services include a registration interface and an unbinding interface, both of which are provided using a hook service. The device includes: A registration module is used to allow external services to register with the service throughout its entire lifecycle via the registration interface; and / or, The registration / unbinding module allows external services to register and unbind on the service throughout its entire lifecycle via the unbinding interface. The device also includes: The business processing module is used for: When the service is triggered, determine whether the service has registered an external service registration interface; If the business registration has the registration interface of the external service, then the registration interface of the external service is called one by one so that the external service can process the business and the business processing result of the external service is called back; The registration of the external service with the business includes asynchronous queue registration and synchronous queue registration; the asynchronous queue registration is used to obtain the business processing result of the external service for the business, and the synchronous queue registration is used to perform process control on the business based on the business processing result of the external service; According to the timing, the hook services are divided into pre-hook services, mid-hook services, and post-hook services. The pre-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration before the service starts. The mid-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration during the service execution. The post-hook service is used to register or unbind the service using asynchronous queue registration and synchronous queue registration after the service execution starts.

6. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method for carrying out dynamic access control based on encryption attribute under operating system

    CN118378284A

  • Method and system for static task to flat dynamic thread

    CN119003119A