Asynchronous event notification method and device, storage medium and electronic device

By using a combination of event encapsulation and pipelines in asynchronous event notifications, the problem of inefficient processing in asynchronous event notifications is solved, and more efficient event monitoring and reporting is achieved.

CN114090282BActive Publication Date: 2025-05-02QINGDAO HAIER TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111243765.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-25
Publication Date
2025-05-02
Estimated Expiration
2041-10-25

AI Technical Summary

Technical Problem

In asynchronous event notification, the prior art has the problem of low processing efficiency, especially in the event monitoring and reporting process, frequent timed inquiries are required, resulting in inefficiency.

Method used

By encapsulating the event notification library and pipeline in the event encapsulation, and connecting the event encapsulation and the target application according to the system type of the target application, establishing the association relationship between the target event and the target pipeline, thereby receiving event notifications when a target event occurs in the target application, avoiding frequent timed inquiries.

Benefits of technology

Improve the efficiency of asynchronous event processing, and receive notifications of asynchronous events in the application through event encapsulation, reducing unnecessary inquiry interactions, and improving the efficiency of event notifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114090282B_ABST
    Figure CN114090282B_ABST
Patent Text Reader

Abstract

The present invention discloses an asynchronous event notification method and device, a storage medium and an electronic device. The method comprises: when an event encapsulation requests to connect a target application, connecting the event encapsulation with the target application according to the system type of the target application, wherein the event encapsulation encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event; establishing an association relationship between the target event and the target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event; when the target event occurs in the target application, the event encapsulation receives an event notification of the target event. The present invention solves the technical problem of low processing efficiency in asynchronous event notification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to an asynchronous event notification method and device, a storage medium and an electronic device. Background Art

[0002] During platform development, it is often necessary to implement asynchronous event processing, including local asynchronous events and network asynchronous events. Local asynchronous events can be implemented through PipeLine, while network asynchronous events need to be implemented through Socket. The usual practice is to maintain an event loop through the distribution function provided by the registration system to implement event monitoring and reporting. After the event is triggered, the event needs to be removed and the corresponding resources released. The event monitoring and reporting based on the event loop is implemented through the method of scheduled active inquiry until the event is queried. During the process of scheduled inquiry, it is necessary to continuously perform inquiry interaction, resulting in low event notification efficiency.

[0003] Moreover, different platforms have different event dispatch functions and corresponding event loop mechanisms. Therefore, even if the same function is implemented for different platforms, it is necessary to encode based on the event dispatch functions of different platforms. As a result, there is a large amount of repeated coding, and the event notification efficiency is also low due to the low code utilization.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide an asynchronous event notification method and device, a storage medium and an electronic device, so as to at least solve the technical problem of low processing efficiency in asynchronous event notification.

[0006] According to one aspect of an embodiment of the present invention, an asynchronous event notification method is provided, comprising: in the case where an event encapsulation requests connection to a target application, connecting the event encapsulation with the target application according to the system type of the target application, wherein the event encapsulation encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event; establishing an association relationship between the target event and the target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event; in the case where the target event occurs in the target application, the event encapsulation receives an event notification of the target event.

[0007] According to another aspect of an embodiment of the present invention, an asynchronous event notification device is also provided, including: a connection unit, used to connect the above-mentioned event package with the above-mentioned target application according to the system type of the above-mentioned target application when the event package requests to connect the target application, wherein the above-mentioned event package encapsulates an event notification library and at least one pipeline, and the target event is registered in the above-mentioned event notification library; an association unit, used to establish an association relationship between the above-mentioned target event and the target pipeline, wherein the above-mentioned association relationship indicates that the above-mentioned target pipeline is used to monitor the above-mentioned target event; a receiving unit, used for, when the above-mentioned target event occurs in the above-mentioned target application, the above-mentioned event package receives the event notification of the above-mentioned target event.

[0008] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned asynchronous event notification method when running.

[0009] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the asynchronous event notification method through the computer program.

[0010] In an embodiment of the present invention, an event encapsulation is connected to a target application according to a system type of a target application, and an association relationship between a target event registered in an event notification library in the event encapsulation and a pipeline in the event encapsulation is established, so that the target pipeline is used to monitor the target event, so that when the target event occurs in the target application, an event notification of the target event occurring in the target application is received. By using event encapsulation applicable to various system types and registering events in the event encapsulation to monitor the occurrence of events in the application, when an event occurs, a notification of the event occurrence is received, thereby avoiding the problem of low efficiency of asynchronous event notification caused by actively initiating event inquiries at time intervals, and achieving the purpose of receiving event notifications of asynchronous events occurring in the application through event encapsulation, thereby achieving the technical effect of improving the efficiency of asynchronous event processing, and further solving the technical problem of low processing efficiency in asynchronous event notifications. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0012] Figure 1 is a schematic diagram of an application environment of an optional asynchronous event notification method according to an embodiment of the present invention;

[0013] Figure 2is a flow chart of an optional asynchronous event notification method according to an embodiment of the present invention;

[0014] Figure 3 is a flow chart of an optional asynchronous event notification method according to an embodiment of the present invention;

[0015] Figure 4 is a flow chart of an optional asynchronous event notification method according to an embodiment of the present invention;

[0016] Figure 5 is a flow chart of an optional asynchronous event notification method according to an embodiment of the present invention;

[0017] Figure 6 is a schematic diagram of an event life cycle of an optional asynchronous event notification method according to an embodiment of the present invention;

[0018] Figure 7 is a schematic structural diagram of an optional asynchronous event notification device according to an embodiment of the present invention;

[0019] Figure 8 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] According to one aspect of an embodiment of the present invention, an asynchronous event notification method is provided. Optionally, the asynchronous event notification method can be applied to, but is not limited to, Figure 1 In the environment shown in FIG. 1 , a target application 104 and an event package 106 are installed in a terminal device 102. The terminal device 102 interacts with a server 112 via a network 110. The target application 104 sends the application's running data to the server 112 via the network 110, and the database 114 stores the running data and processes the processing engine 116 to obtain application data for feedback, and then feeds the application data back to the target application 104 via the network 110.

[0023] The notification of asynchronous events occurring in the target application 104 running in the terminal device 102 is not limited to being implemented by sequentially executing S102 to S106. Connect the event package with the target application. In the case where the event package requests to connect to the target application, the event package is connected to the target application according to the system type of the target application, and the event package encapsulates an event notification library and at least one pipeline, and the target event is registered in the event notification library. Establish an association relationship between the target event and the target pipeline. The association relationship indicates that the target pipeline is used to monitor the target event. The event package receives an event notification of the target event. In the case where the target event occurs in the target application, the event package receives an event notification of the target event.

[0024] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a client of the target application, and may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an IOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client may be a video client, an instant messaging client, a browser client, an education client, etc. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and this embodiment does not impose any limitation on this.

[0025] As an optional implementation, Figure 2 As shown, the above asynchronous event notification method includes:

[0026] S202: When the event package requests to connect to the target application, connect the event package to the target application according to the system type of the target application.

[0027] In the above S202, the event package encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event. The event package is connected to the target application to establish a communication and data transmission link between the event package and the target application. The target event is not limited to any type of asynchronous event.

[0028] In the case of monitoring asynchronous events in the target application through event encapsulation, a connection request for connecting the target application to the event encapsulation is triggered. Event encapsulation is not limited to encapsulating multiple communication protocols to connect applications of various system types. The threshold of the number of asynchronous events registered in the event notification library is not limited here.

[0029] S204, establishing an association relationship between the target event and the target pipeline.

[0030] In the above S204, the association relationship indicates that the target pipeline is used to monitor the target event. The target event is monitored using the pipeline in the event package, so as to receive a notification of the occurrence of the target event when the target event occurs in the target application.

[0031] S206: When a target event occurs in the target application, the event package receives an event notification of the target event.

[0032] Optionally, when a target event occurs in the target application, the time notification is received by a target pipeline that monitors the target event.

[0033] In an embodiment of the present application, an event encapsulation is connected to a target application according to the system type of the target application, and an association relationship between a target event registered in an event notification library in the event encapsulation and a pipeline in the event encapsulation is established, so that the target pipeline is used to monitor the target event, so that when the target event occurs in the target application, an event notification of the target event occurring in the target application is received. By using event encapsulation applicable to various system types and registering events in the event encapsulation to monitor the occurrence of events in the application, when the event occurs, a notification of the event occurrence is received, thereby avoiding the problem of low efficiency of asynchronous event notification caused by actively initiating event inquiries at time intervals, and achieving the purpose of receiving event notifications occurring asynchronously in the application through event encapsulation, thereby achieving the technical effect of improving the efficiency of asynchronous event processing, and further solving the technical problem of low processing efficiency in asynchronous event notifications.

[0034] As an optional implementation, Figure 3 As shown, the above-mentioned connection event encapsulation and target application according to the system type of the target application include:

[0035] S302, determining a system type of a target application, wherein the system type is used to indicate a basic type of application development of the target application;

[0036] S304, calling the communication interface corresponding to the system type in the event package to connect to the target application.

[0037] Optionally, the application development basic type is used to indicate the system framework of application development, which is not limited to one of Android, IOS, Windows, Linux, and Unix. Communication interfaces corresponding to the above-mentioned multiple system frameworks are encapsulated in the event encapsulation. Multiple system communication interfaces are encapsulated in the event encapsulation, and the event encapsulation is connected with multiple types of applications to realize asynchronous event notification of types of applications.

[0038] In the embodiment of the present application, by encapsulating communication interfaces corresponding to multiple communication protocols in event encapsulation, event encapsulation is applicable to applications of various system types, the application restrictions of event encapsulation are reduced, and the application convenience of event encapsulation is improved.

[0039] As an optional implementation, Figure 4 As shown, the above-mentioned establishment of the association relationship between the target event and the target pipeline includes:

[0040] S402, registering a target listening event in a target pipeline, wherein the target listening event is used to receive event notifications;

[0041] S404, associating the target monitoring event with the target event.

[0042] Optionally, the listening event registered in the target pipeline is used to receive event notifications of associated events to determine the occurrence of a target event in the application.

[0043] As an optional implementation manner, the above-mentioned associating the target listening event with the target event includes: configuring the event type and callback function of the target event in the target listening event.

[0044] The event reading function and event writing function corresponding to the event type of the target event are configured in the target listening event. At the same time, the callback function of the target event is configured to realize the reading and writing of the target event through the callback function.

[0045] As an optional implementation manner, after the event encapsulation receives the event notification of the target event, the method further includes: reading the event data of the target event from the target pipeline through a callback function.

[0046] As an optional implementation, after reading the event data of the target event, the method further includes: upon receiving a removal instruction, removing the target event registered in the event notification library, and releasing the association between the target event and the target pipeline.

[0047] When there is no need to continue monitoring the occurrence of the target event in the target application, the target event is removed from the event notification library, and the association between the target event and the target pipeline is released, and the target pipeline is released. Disassociating the target event from the target pipeline is not limited to deleting the target listening event in the target pipeline.

[0048] As an optional implementation, before connecting the event encapsulation with the target application according to the system type of the target application, the above also includes: initializing the event encapsulation, wherein the event encapsulation starts an event distribution thread after being initialized, and the event distribution thread is used to distribute the registered asynchronous events to the pipeline.

[0049] Event encapsulation includes, but is not limited to, an event distribution thread, which is used to distribute asynchronous events registered in the event notification library to the pipeline. Taking libevent2 as an example, the asynchronous event notification process is not limited to the following: Figure 5 As shown. Event encapsulation mainly includes three processing modules: ServletEventController (event controller), ActionDispatcher (execution dispatcher), and EventDispatcher (event dispatcher). ServletEventController is used for event multi-channel distribution and event registration and removal. ActionDispatcher is used as an extension and is not used in this embodiment. EventDispatcher provides a connection interface between event encapsulation and the target application, and receives event registration and removal instructions. EventDispatcher holds ServletEventController and ActionDispatcher. ServletEventController holds pipelines, and events are registered to the event dispatcher, which manages and distributes registered events.

[0050] S500, instantiate ServletEventController, and jump to S510 after completion;

[0051] S510, pipeline (readFd and writeFd) initialization, after completion jump to S512;

[0052] S512, libevent2 initialization, jump to S514 after completion;

[0053] S514, associate event source, jump to S516 after completion;

[0054] S516, add event type, and jump to S518 after completion;

[0055] S518, start the event distribution thread, and the pipeline configuration is now complete, jumping to S520.

[0056] S520, instantiate ServletElement, including instantiating ActionDispatcher and EventDispatcher, and jump to S522 after completion;

[0057] S522, EventDispatcher registers read, write, and timer events, sets callback functions, and jumps to S524 after completion;

[0058] S524, EventDispatcher implements event callback notification, and jumps to S526 after completion;

[0059] S526, send data to writeFd of the pipeline, and jump to S528 after completion;

[0060] S528, the multi-channel distribution center detects the write event, and jumps to S530 after completion;

[0061] S530, the callback function is called, and after completion, jumps to S532;

[0062] S532, the event callback is triggered, and after completion, jump to S534;

[0063] S534, read data from the pipeline's readFd.

[0064] In asynchronous event notification, the life cycle of an event and the transitions between different states of an event in its life cycle are not limited to the following: Figure 6 As shown. The cycle states of the event life cycle include: initialization, non-pending, pending, and triggered (active). There are two ways to initialize an event: initialize an uninitialized event through event_assign() and create an initialized event through event_new(). When the event is initialized, the setting of the callback function is completed. The initial state of the event is non-pending, which means that the event will not be triggered. When the event is in the triggered (active) state, the callback function is executed. When the callback function is executed, the event exits the triggered (active) state and returns to the pending state.

[0065] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0066] According to another aspect of the embodiment of the present invention, there is also provided an asynchronous event notification device for implementing the asynchronous event notification method. Figure 7 As shown, the device comprises:

[0067] A connecting unit 702 is used to connect the event package with the target application according to the system type of the target application when the event package requests to connect the target application, wherein the event package encapsulates an event notification library and at least one pipeline, and the event notification library registers the target event;

[0068] An association unit 704, configured to establish an association relationship between a target event and a target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event;

[0069] The receiving unit 706 is used for, when a target event occurs in a target application, event encapsulation to receive an event notification of the target event.

[0070] Optionally, the connecting unit 702 includes:

[0071] A determination module, used to determine a system type of a target application, wherein the system type is used to indicate a basic type of application development of the target application;

[0072] The calling module is used to call the communication interface corresponding to the system type in the event encapsulation to connect to the target application.

[0073] Optionally, the association unit 704 includes:

[0074] A registration module, used to register a target listening event in a target pipeline, wherein the target listening event is used to receive event notifications;

[0075] The association module is used to associate the target listening event with the target event.

[0076] Optionally, the above association module is also used to configure the event type and callback function of the target event in the target listening event.

[0077] Optionally, the asynchronous event notification device further comprises a reading unit, which is used to read the event data of the target event from the target pipeline through a callback function after the event encapsulation receives the event notification of the target event.

[0078] Optionally, the asynchronous event notification device further comprises a removal unit for removing the target event registered in the event notification library and releasing the association between the target event and the target pipeline after reading the event data of the target event and receiving a removal instruction.

[0079] Optionally, the above-mentioned asynchronous event notification device also includes an initialization unit, which is used to initialize the event package before connecting the event package with the target application according to the system type of the target application, wherein the event package starts an event distribution thread after being initialized, and the event distribution thread is used to distribute the registered asynchronous events to the pipeline.

[0080] In an embodiment of the present application, an event encapsulation is connected to a target application according to the system type of the target application, and an association relationship between a target event registered in an event notification library in the event encapsulation and a pipeline in the event encapsulation is established, so that the target pipeline is used to monitor the target event, so that when the target event occurs in the target application, an event notification of the target event occurring in the target application is received. By using event encapsulation applicable to various system types and registering events in the event encapsulation to monitor the occurrence of events in the application, when the event occurs, a notification of the event occurrence is received, thereby avoiding the problem of low efficiency of asynchronous event notification caused by actively initiating event inquiries at time intervals, and achieving the purpose of receiving event notifications occurring asynchronously in the application through event encapsulation, thereby achieving the technical effect of improving the efficiency of asynchronous event processing, and further solving the technical problem of low processing efficiency in asynchronous event notifications.

[0081] According to another aspect of the embodiment of the present invention, an electronic device for implementing the asynchronous event notification method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.

[0082] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0083] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0084] S1, in the case where an event encapsulation requests to connect to a target application, connecting the event encapsulation to the target application according to the system type of the target application, wherein the event encapsulation encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event;

[0085] S2, establishing an association relationship between a target event and a target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event;

[0086] S3, when a target event occurs in the target application, the event encapsulation receives an event notification of the target event.

[0087] Alternatively, a person skilled in the art may understand that: Figure 8 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 8 The structure of the electronic device is not limited. Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations shown.

[0088] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the asynchronous event notification method and device in the embodiment of the present invention. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, realizing the above-mentioned asynchronous event notification method. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely arranged relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks and combinations thereof. Among them, the memory 802 can be specifically used, but not limited to, to store event encapsulation, event notification libraries, pipelines, event data and other information. As an example, such as Figure 8 As shown, the memory 802 may include but is not limited to the connection unit 702, the association unit 704 and the receiving unit 706 in the asynchronous event notification device. In addition, it may also include but is not limited to other module units in the asynchronous event notification device, which will not be repeated in this example.

[0089] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0090] In addition, the electronic device further includes: a display 808 for displaying the event notification; and a connection bus 810 for connecting various module components in the electronic device.

[0091] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.

[0092] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the asynchronous event notification described above. The computer program is configured to execute the steps of any of the above method embodiments when it is run.

[0093] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0094] S1, in the case where an event encapsulation requests to connect to a target application, connecting the event encapsulation to the target application according to the system type of the target application, wherein the event encapsulation encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event;

[0095] S2, establishing an association relationship between a target event and a target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event;

[0096] S3, when a target event occurs in the target application, the event encapsulation receives an event notification of the target event.

[0097] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0098] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0099] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.

[0100] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0101] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0102] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0103] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0104] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An asynchronous event notification method, characterized in that: include: In the case where the event package requests to connect to the target application, connecting the event package with the target application according to the system type of the target application, wherein the event package encapsulates an event notification library and at least one pipeline, and the event notification library registers the target event; Establishing an association relationship between the target event and a target pipeline, wherein the association relationship indicates that the target pipeline is used to monitor the target event; When the target event occurs in the target application, the event package receives an event notification of the target event; Wherein, connecting the event package with the target application according to the system type of the target application includes: Determining the system type of the target application, wherein the system type is used to indicate an application development base type of the target application; The communication interface corresponding to the system type in the event package is called to connect to the target application.

2. The method according to claim 1, characterized in that: The establishing of the association relationship between the target event and the target pipeline includes: Registering a target listening event in the target pipeline, wherein the target listening event is used to receive event notification; The target listening event is associated with the target event.

3. The method according to claim 2, characterized in that The associating the target listening event with the target event comprises: The event type and callback function of the target event are configured in the target listening event.

4. The method according to claim 3, characterized in that After the event package receives the event notification of the target event, the method further includes: The event data of the target event is read from the target pipeline through the callback function.

5. The method according to claim 4, characterized in that After reading the event data of the target event, the method further includes: When a removal instruction is received, the target event registered in the event notification library is removed, and the association between the target event and the target pipeline is released.

6. The method according to any one of claims 1 to 5, characterized in that: Before connecting the event package with the target application according to the system type of the target application, the method further includes: Initialize the event encapsulation, wherein the event encapsulation starts an event distribution thread after being initialized, and the event distribution thread is used to distribute the registered asynchronous events to the pipeline.

7. An asynchronous event notification device, characterized in that: include: a connecting unit, configured to connect the event package with the target application according to a system type of the target application when the event package requests to connect the target application, wherein the event package encapsulates an event notification library and at least one pipeline, and the event notification library registers a target event; an associating unit, configured to establish an associating relationship between the target event and a target pipeline, wherein the associating relationship indicates that the target pipeline is used to monitor the target event; A receiving unit, configured to receive, by the event encapsulation, an event notification of the target event when the target event occurs in the target application; The connection unit is further used to determine the system type of the target application, wherein the system type is used to indicate a basic type of application development of the target application; and to call a communication interface corresponding to the system type in the event encapsulation to connect the target application.

8. A computer-readable storage medium, the computer-readable storage medium comprising a stored program, characterized in that: When the program is executed, the method described in any one of claims 1 to 6 is executed.

9. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Linux interprocess communication method and apparatus, and process exit monitoring method

    CN106293969A