Service callback method and device

By providing dynamic registration and unbinding interfaces in the distributed registration callback system and supporting asynchronous and synchronous queue registration, the existing system is not flexible enough in registration and callbacks, and flexibility and process control are achieved during the business life cycle, meeting complex business needs.

CN119743515AActive Publication Date: 2025-04-01CHINA TELECOM CLOUD TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411762824.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-04-01
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

The existing distributed registration callback system is not flexible enough in terms of registration and callback to meet various complex business needs.

Method used

Provides a business callback method and device, which allows external services to register and unbind by providing registration interfaces and unbind interfaces throughout the life cycle of the business, supports asynchronous queue registration and synchronous queue registration, and realizes process control and data changes.

Benefits of technology

It realizes flexible registration and unbinding of services throughout its life cycle, meets various business needs, can perform single business plug-ins and plugging operations at any time according to actual conditions, and improves the flexibility and scalability of the system through process control and data change functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743515A_ABST
    Figure CN119743515A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a service callback method and device, a service comprises a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided by adopting a hook service, and the method comprises the following steps: allowing an external service to register on the service in the whole life cycle of the service through the registration interface; and or allowing the external service to register and unbind on the service in the whole life cycle of the service through the unbinding interface. According to the service provided by the embodiment of the invention, the external service can be allowed to be flexibly registered and unbound in the whole life cycle, so that the plugging operation of a single service can be carried out at any time according to the actual service requirement, and various service requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention 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 Art

[0002] In specific implementation, the distributed registration callback system is a mechanism for managing and processing events and callbacks in distributed systems. The distributed registration callback system allows external services to call back external services to process their services after they have registered their services. However, the registration and callback of the existing distributed registration callback system are not flexible enough to meet a variety of business needs. Summary of the invention

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

[0004] In a first aspect of the implementation of the present invention, a service callback method is first provided, wherein the service includes a registration interface and an unbinding interface, wherein the registration interface and the unbinding interface are provided by a hook service, and the method includes:

[0005] Allowing external services to register with the service through the registration interface throughout the service lifecycle; and or,

[0006] External services are allowed to register and unbind from the service through the unbinding interface throughout the service life cycle.

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

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

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

[0010] In one embodiment of the present invention, 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 process control on the business according to the business processing result of the external service.

[0011] In an embodiment of the present invention, if the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to process the business, and the business processing result of the external service processing the business is called back, including:

[0012] When the registration of the external service on the business is an 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 enable the external service to process the business, and the business processing result of the external service processing the business is called back.

[0013] In an embodiment of the present invention, if the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to process the business, and the business processing result of the external service processing the business is called back, including:

[0014] 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 services 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;

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

[0016] In one embodiment of the present invention, the method further comprises:

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

[0018] If the service has not registered the registration interface of the external service, the service continues to be executed or ends.

[0019] In one embodiment of the present invention, the hook service is divided into a front hook service, a mid hook service and a post hook service according to the timing; the front hook service is used to register or unbind the service by using asynchronous queue registration and synchronous queue registration before the service starts; the mid hook service is used to register or unbind 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 the service by using asynchronous queue registration and synchronous queue registration after the execution of the service starts.

[0020] The embodiment of the present invention further discloses a service callback device, wherein the service includes a registration interface and an unbinding interface, wherein the registration interface and the unbinding interface are provided by a hook service, and the device includes:

[0021] a registration module for allowing external services to register with the service through the registration interface throughout the service lifecycle; and or,

[0022] The registration and unbinding module is used to allow external services to register and unbind the service through the unbinding interface during the entire life cycle of the service.

[0023] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any of the above-mentioned service callback methods.

[0024] In another aspect of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned service callback methods.

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

[0026] In an embodiment of the present invention, a service in a distributed registration callback system may include a registration interface and an unbinding interface, which are provided by a hook service, and may allow an external service to register with the service through the registration interface throughout the service life cycle, and or may allow an external service to register and unbind with the service through the unbinding interface throughout the service life cycle. The service of an embodiment of the present invention may allow an external service to flexibly register and unbind throughout its life cycle, so that a single service may be plugged and unplugged at any time according to actual service needs, thereby meeting a variety of service needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.

[0028] Figure 1 A schematic diagram of a distributed registration callback system's process for registering callbacks;

[0029] Figure 2 A flowchart of registering callbacks for another distributed registration callback system;

[0030] Figure 3 A flowchart of a service callback method provided in an embodiment of the present invention;

[0031] Figure 4 A schematic diagram of a dynamic registration and dynamic unbinding process provided in an embodiment of the present invention;

[0032] Figure 5A schematic diagram of a flow chart of a hook service provided in an embodiment of the present invention;

[0033] Figure 6 A schematic diagram of a pre-hook process provided in an embodiment of the present invention;

[0034] Figure 7 A schematic diagram of a flow chart of a middle hook provided in an embodiment of the present invention;

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

[0036] Fig. 9 A schematic diagram of a post-hook process provided in an embodiment of the present invention;

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

[0038] Fig.11 The present invention is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0040] The existing distributed registration callback system can be roughly divided into two implementation schemes. Figure 1 The first solution is to implement it in a hard-coded way. The order and stage of the business are confirmed through the early solution preview, and then the callback method of the business of interest is registered in the code in advance, and then the production environment is released and launched. This method has high requirements for solution preview and lacks flexibility, sacrificing the smooth scalability of the microservice architecture, and each change needs to be re-released and launched. Figure 2 The second solution is to implement the registration callback mechanism through some intermediary media (message middleware, database, etc.). For example, the registration of message middleware means that the consumer subscribes to the topic of a middleware. When the producer publishes a message to the topic, the consumer consumes these messages asynchronously to complete the business. The callback is completed by attaching a callback address to the message. Although the second solution is more flexible than the first solution, it lacks process control, that is, it cannot decide whether to continue the business execution based on the callback result of the dependent service.

[0041] In view of the above problems, the embodiment of the present invention proposes a new registration and callback solution, which retains the original registration and callback basic functions and adds many new capabilities, including but not limited to dynamic registration, process control, data change, etc. Due to the low deployment cost, flexibility, and easy expansion, the embodiment of the present invention can be applied to a wider range of businesses in practical applications and has lower R&D costs.

[0042] Reference Figure 3 , is a flowchart of a service callback method provided in an embodiment of the present invention, such as Figure 3 As shown, the service includes a registration interface and an unbinding interface, and the registration interface and the unbinding interface are provided by using a hook service. The method may specifically include the following steps:

[0043] Step 201, allowing external services to register with the service through the registration interface throughout the service life cycle; and or,

[0044] Step 202: Allow external services to register and unbind from the service through the unbinding interface during the entire life cycle of the service.

[0045] In an embodiment of the present invention, the business (event) in the distributed registration callback system may include a dynamic registration interface and an unbinding interface, wherein the registration interface and the unbinding interface are provided by a hook service. Specifically, in the computer field, hook, also known as a hook, is a programming technique for intercepting function calls, message transmission, event transmission, etc. between software modules, thereby modifying or extending the behavior of these modules. Therefore, based on the registration interface and unbinding interface provided by the hook service, registration and registration unbinding can be performed dynamically according to business needs throughout the life cycle of the business. Callback is a programming technique that refers to passing a function as a parameter to another function, and calling this function by another function when a certain event (business) occurs.

[0046] In an embodiment of the present invention, a variety of services may be involved in the distributed registration callback system, such as bare metal activation services, order processing services, payment processing services, bandwidth services, and authentication services. During the entire life cycle of a certain service, that is, before, during, and after the start of the service, one or more external services may be allowed to register with the dynamic registration interface of the service to achieve registration and callback of external services, or one or more external services may be allowed to register with the dynamic unbinding interface of the service to achieve registration and unbinding of external services. Subsequently, the external service will no longer call back the service.

[0047] In the above service callback method, the service in the distributed registration callback system may include a registration interface and an unbinding interface, which are provided by a hook service, and may allow an external service to register on the service through the registration interface throughout the service life cycle, and or, may allow an external service to register and unbind on the service through the unbinding interface throughout the service life cycle. The service of the embodiment of the present invention may allow an external service to flexibly register and unbind throughout its life cycle, so that a single service may be plugged and unplugged at any time according to actual service needs, thereby meeting a variety of service needs.

[0048] In one embodiment of the present invention, after allowing the external service to register on the service through the registration interface throughout the service life cycle, the method further includes:

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

[0050] If the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to 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 an 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 enable the external service to 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 a 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 enable the external service to process the business, and the business processing result of the external service processing the business is called back; determine whether to continue executing the business based on the business processing result.

[0052] In one embodiment of the present invention, 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 process control on the business according to the business processing result of the external service.

[0053] For example, refer to Figure 4, is a flow diagram of dynamic registration and dynamic unbinding provided in an embodiment of the present invention. Specifically, the flow of dynamic registration and dynamic unbinding based on hook is: the external service (for example, service 1 and service 2) can register the business interface that the external service needs to access through the dynamic registration interface (provided by the hook service), and the hook service can provide two queues for the external service to choose, one is the form of synchronous queue (synchronous queue registration or synchronous queue unbinding), and the second is the form of asynchronous queue (asynchronous queue registration or asynchronous queue unbinding). The external service selects the queue to be registered on demand, among which the registration form of the synchronous queue can be used for process control, and the asynchronous queue registration only focuses on whether the event (business) itself occurs, that is, it only needs to obtain the business processing result of the external service on the business. Of course, when unbinding is required, the external service (for example, service 1 and service 2) can be unbound through the dynamic unbinding interface.

[0054] In an embodiment of the present invention, the registration interface and the unbinding interface are divided into a front hook service (front hook), a mid hook service (mid hook) and a post hook service (post hook) according to the triggering timing; specifically, the front hook service is used to register or unbind the service by using asynchronous queue registration and synchronous queue registration before the service starts; the mid hook service is used to register or unbind 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 the service by using asynchronous queue registration and synchronous queue registration after the execution of the service starts.

[0055] For example, refer to Figure 5 , is a flow diagram of a hook service provided in an embodiment of the present invention. Taking a bare metal provisioning service (Ebm Create Request) as an example, hooks are mainly divided into three opportunities, namely, pre-hook, mid-hook, and post-hook, involving the following services:

[0056] Api Service (hereinafter referred to as API): Aggregation service, mainly used to integrate the data returned by the back-end microservices and provide a stable interface to the front-end.

[0057] Ebm Service (hereinafter referred to as ebm): Bare metal business microservice, mainly handles the screening and application of bare metal resources, and is the business service that actually implements bare metal activation.

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

[0059] The role of the pre-hook: Before executing a specific business, if process control is required, the interface provided by the registration service can be called in the form of a synchronous queue, and the business process can be terminated based on the returned business processing result. If process control is not required, the interface provided by the registration service can be called in the form of an asynchronous queue. Pre-hook is commonly used for permission or data verification.

[0060] The role of the middle hook: At the beginning of the execution of a specific business, if process control is required, the interface provided by the registration service can be called in the form of a synchronous queue, and the business process can be terminated based on the returned business processing results. If process control is not required, the interface provided by the registration service can be called in the form of an asynchronous queue. Among them, the middle hook is also often used for data changes, and the parameter service passed can be added or deleted by itself.

[0061] The role of post-hook: After the execution of a specific business, if process control is required, the interface provided by the registration service can be called in the form of a synchronous queue, and the business process can be terminated based on the returned business processing result. If process control is not required, the interface provided by the registration service can be called in the form of an asynchronous queue. Among them, post-hook is often used to send business execution results, mostly in the form of an asynchronous queue.

[0062] Reference Figure 6 , is a flow diagram of a pre-hook provided in an embodiment of the present invention. Taking a pre-hook of a bare metal provisioning service (Ebm Create Request) as an example, there are the following services using the pre-hook:

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

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

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

[0066] Specifically, the API calls the uavs service synchronously to perform permission verification, and then decides whether the business process can continue based on the result of the permission verification. The API also calls rivs synchronously to determine whether the business process can continue based on the result of the inventory verification. However, for lrs logging, it can be called asynchronously because the success or failure of logging does not affect the progress of the overall business process.

[0067] In the above example of the pre-hook, the role of the hook mechanism in process control also realizes its easy scalability in a distributed architecture. Other services can access the pre-hook at any time through dynamic registration, and can also exit at any time through dynamic unsubscription.

[0068] Reference Figure 7 , is a flow diagram of a middle hook provided in an embodiment of the present invention. Taking a middle hook of a bare metal provisioning service (Ebm Create Request) as an example, there are the following services using the middle hook:

[0069] Bandwidth Service (hereinafter referred to as bs): bandwidth product service, mainly dealing with bandwidth-related services

[0070] Specifically, before entering EBM to officially activate bare metal, there is usually a bandwidth product accompanying the activation of bare metal, but EBM certainly does not handle the logic related to bandwidth products. Therefore, at this time, the business interface registered by BS in the central hook can be used to handle the logic related to the bandwidth product business. After the processing is completed, the bandwidth product information passed in by the original API layer is replaced with the newly activated bandwidth instance ID. For example Figure 8 , "bandWidth id":0" is replaced with "bandWidth id":10", and then returned to ebm through the response. After ebm gets it and writes it to the database, it can use the bandwidth instance id to establish an association between the bare metal and bandwidth product instances that have been opened. It can be seen that the middle hook can realize the powerful function of data management in the middle process of the business process. With the flexible registration and unbinding of the hook, it can achieve the purpose of generating different data streams at different times. The interface call of bs here should also be synchronous, because if the bandwidth instance fails to be created, the bare metal instance should not be created. Here, the process control of the hook solution can be realized again.

[0071] Reference Fig. 9 , is a flow chart of a post-hook provided in an embodiment of the present invention, taking a post-hook of a bare metal provisioning service (Ebm Create Request) as an example ( Figure 8 ), there are the following services using the middle hook

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

[0073] Data Statistics Service (hereinafter referred to as DSS): Statistics service, mainly handles data statistics related business

[0074] Specifically, after EBM completes the bare metal instance activation, the entire resource activation process has been completed. At this time, the OS service needs to be notified to mark the order completed, so the OS service can register the processing function of the relevant business through the post-hook. This call should also be completed in a synchronous form to ensure that the order process can be completed normally. Since the DSS service is for data statistics, the post-hook can be used to asynchronously record the results of this activation, because the success or failure of the data statistics record does not affect the execution of the entire business process.

[0075] In one embodiment of the present invention, the method may further include:

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

[0077] If the service has not registered the registration interface of the external service, the service continues to be executed or ends.

[0078] In an embodiment of the present invention, when a service is triggered, it can be determined whether the service has been registered with a registration interface for an external service. If it is determined that the service has been registered with a registration interface for an external service, the registration node is used to call the external service to process the service and return the service processing result. The process can be controlled according to the queue registration form of the external service (asynchronous queue registration or synchronous queue registration) or the processing result can be directly returned and saved. If it is determined that the service has not been registered with a registration interface for an external service, the service can continue to be executed according to the original process or the service can be terminated.

[0079] It can be seen that the application of the embodiments of the present invention can achieve at least the following advantages: 1. Dynamic registration process, according to actual business needs, the plug-in and unplug-out operations of a single event (business) can be performed at any time (that is, the external business can be called or stopped at any time); 2. The process is controllable, and whether the business process can be executed further can be controlled based on the callback results of the external service; 3. Easy to expand, and new extended external services can be connected on demand according to business needs; 4. Process data change control, the screening and change of data changes can be added to the business process.

[0080] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0081] Reference Fig.10 , is a structural block diagram of a service callback device provided in an embodiment of the present invention, such as Fig.10 The services shown include a registration interface and an unbinding interface, and the registration interface and the unbinding interface are provided by using a hook service. The device may specifically include the following modules:

[0082] A registration module 1001, for allowing external services to register with the service through the registration interface throughout the service life cycle; and or,

[0083] The registration and unbinding module 1002 is used to allow external services to register and unbind the service through the unbinding interface during the entire life cycle of the service.

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

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

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

[0087] In one embodiment of the present invention, 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 process control on the business according to the business processing result of the external service.

[0088] In one embodiment of the present invention, the service processing module is used to:

[0089] When the registration of the external service on the business is an 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 enable the external service to process the business, and the business processing result of the external service processing the business is called back.

[0090] In one embodiment of the present invention, the service processing module is used to:

[0091] 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 services 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;

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

[0093] In one embodiment of the present invention, the service processing module is used to:

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

[0095] If the service has not registered the registration interface of the external service, the service continues to be executed or ends.

[0096] In one embodiment of the present invention, the hook service is divided into a front hook service, a mid hook service and a post hook service according to the timing; the front hook service is used to register or unbind the service by using asynchronous queue registration and synchronous queue registration before the service starts; the mid hook service is used to register or unbind 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 the service by using asynchronous queue registration and synchronous queue registration after the execution of the service starts.

[0097] In an embodiment of the present invention, a service in a distributed registration callback system may include a registration interface and an unbinding interface, which are provided by a hook service, and may allow an external service to register with the service through the registration interface throughout the service life cycle, and or may allow an external service to register and unbind with the service through the unbinding interface throughout the service life cycle. The service of an embodiment of the present invention may allow an external service to flexibly register and unbind throughout its life cycle, so that a single service may be plugged and unplugged at any time according to actual service needs, thereby meeting a variety of service needs.

[0098] As for the above-mentioned device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0099] It should be noted that the embodiments of the present invention may involve the use of user data. In actual applications, user-specific personal data can be used in the scheme described herein within the scope permitted by applicable laws and regulations, subject to the requirements of applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).

[0100] The embodiment of the present invention further provides an electronic device, such as Fig.11 As shown, it includes 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 communicate with each other through the communication bus 504.

[0101] Memory 503, used for storing computer programs;

[0102] The processor 501 is used to implement any of the service callback methods described in the above embodiments when executing the program stored in the memory 503:

[0103] Allowing external services to register with the service through the registration interface throughout the service lifecycle; and or,

[0104] External services are allowed to register and unbind from the service through the unbinding interface throughout the service life cycle.

[0105] Optionally, after allowing the external service to register with the service through the registration interface throughout the service life cycle, the method further comprises:

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

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

[0108] Optionally, if the business is registered with a registration interface of the external service, calling the registration interfaces of the external services one by one to enable the external services to process the business, and calling back the business processing result of the external services processing the business, including:

[0109] When the registration of the external service on the business is an 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 enable the external service to process the business, and the business processing result of the external service processing the business is called back.

[0110] Optionally, if the business is registered with a registration interface of the external service, calling the registration interfaces of the external services one by one to enable the external services to process the business, and calling back the business processing result of the external services processing the business, including:

[0111] 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 services 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;

[0112] Determine whether to continue executing 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 an external service;

[0115] If the service has not registered the registration interface of the external service, the service continues to be executed or ends.

[0116] The communication bus mentioned in the above terminal 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 ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

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

[0118] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0119] The above-mentioned processor 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 of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the service callback method described in any one of the above embodiments.

[0121] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the service callback method described in any one of the above embodiments.

[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part 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 process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. 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 by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). 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 or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0123] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or still includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

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

[0125] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A service callback method, characterized in that: The service includes a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided by using a hook service, and the method includes: Allowing external services to register with the service through the registration interface throughout the service lifecycle; and or, External services are allowed to register and unbind from the service through the unbinding interface throughout the service life cycle.

2. The method according to claim 1, characterized in that After allowing external services to register with the service through the registration interface throughout the service life cycle, the method further includes: When the service is triggered, determining whether the service is registered with a registration interface of an external service; If the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to process the business, and the business processing result of the external service processing the business is called back.

3. The method according to claim 2, characterized in that 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 process of the business according to the business processing result of the external service.

4. The method according to claim 3, characterized in that If the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to process the business, and the business processing result of the external service processing the business is called back, including: When the registration of the external service on the business is an 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 enable the external service to process the business, and the business processing result of the external service processing the business is called back.

5. The method according to claim 3, characterized in that: If the business is registered with the registration interface of the external service, the registration interfaces of the external services are called one by one to enable the external service to process the business, and the business processing result of the external service processing the business is called back, including: 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 services 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; Determine whether to continue executing the service according to the service processing result.

6. The method according to claim 2, characterized in that The method further comprises: When the service is triggered, determining whether the service is registered with a registration interface of an external service; If the service has not registered the registration interface of the external service, the service continues to be executed or ends.

7. The method according to claim 3, characterized in that According to the timing, the hook service is divided into pre-hook service, mid-hook service and post-hook service; the pre-hook service is used to register or unbind the service by asynchronous queue registration and synchronous queue registration before the service starts; the mid-hook service is used to register or unbind the service by asynchronous queue registration and synchronous queue registration during the execution of the service; the post-hook service is used to register or unbind the service by asynchronous queue registration and synchronous queue registration after the execution of the service starts.

8. A service callback device, characterized in that: The service includes a registration interface and an unbinding interface, the registration interface and the unbinding interface are provided by using a hook service, and the device includes: a registration module for allowing external services to register with the service through the registration interface throughout the service lifecycle; and or, The registration and unbinding module is used to allow external services to register and unbind the service through the unbinding interface during the entire life cycle of the service.

9. 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, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Application software development method and device, computer equipment and readable storage medium

    CN112764729A

  • Request processing method and device, computer system and readable storage medium

    CN112783969A

  • Method for realizing real-time perception of service provider instance offline by Eureka

    CN117453434A

  • 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