Event processing method and device

Through the combination of event channels and event storage connectors, target events are monitored and processed in real time, solving the problem of low event processing efficiency in the existing technology and achieving a more efficient event processing process.

CN116074379BActive Publication Date: 2025-04-25北京东方通软件有限公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310028730.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-09
Publication Date
2025-04-25
Estimated Expiration
2043-01-09

AI Technical Summary

Technical Problem

In the prior art, the process of handling events during the process of sending published events to the subscription end is inefficient.

Method used

The target event is sent to the event storage connector through the event channel, and the event storage connector is used to store the target event in the corresponding storage device. The event storage connector is controlled by the sentry thread inside the event channel to monitor events in the storage device in real time. When the target event is monitored, the event subscriber is triggered through the event channel and the target event is sent to the second application, so that it completes the business logic corresponding to the target event.

Benefits of technology

The efficiency of handling events during the process of sending published events to the subscription end is improved, and the problem of inefficiency in the prior art is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074379B_ABST
    Figure CN116074379B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of communication technology, and provides an event processing method and device. The method includes: when receiving a target event published by a first application through an event publisher, locating the corresponding event channel according to the application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; sending the target event to the event storage connector through the event channel, and using the event storage connector to store the target event in the corresponding storage device; controlling the event storage connector through the sentinel thread inside the event channel to monitor the events in the storage device in real time; when the sentinel thread inside the event channel monitors the target event, triggering the event subscriber through the event channel according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to an event processing method and device. Background Art

[0002] Traditional event processing systems send published events directly to the subscribing end. However, in the actual processing process, direct sending will face various problems and may even be infeasible. For example, when a large number of events need to be processed, it will have a huge impact on the system, resulting in low efficiency in the final event processing.

[0003] In the process of implementing the concept of the present disclosure, the inventors found that there are at least the following technical problems in the related art: the problem of low efficiency in processing events in the process of sending published events to the subscriber. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide an event processing method, device, electronic device and computer-readable storage medium to solve the problem of low efficiency in processing events in the process of sending published events to subscribers in the prior art.

[0005] A first aspect of an embodiment of the present disclosure provides an event processing method, including: when a target event published by a first application through an event publisher is received, locating a corresponding event channel according to application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; sending the target event to an event storage connector through the event channel, and storing the target event in a corresponding storage device using the event storage connector; controlling the event storage connector through a sentinel thread inside the event channel to monitor events in the storage device in real time; when a sentinel thread inside the event channel monitors the target event, triggering an event subscriber through the event channel according to the application topic information in the target event to send the target event to a second application, so that the second application completes the business logic corresponding to the target event.

[0006] According to a second aspect of an embodiment of the present disclosure, an event processing device is provided, including: a publishing module, configured to locate a corresponding event channel according to application topic information in the target event when receiving a target event published by a first application through an event publisher, wherein the application topic information is composed of relevant information of the first application; a storage module, configured to send the target event to an event storage connector through an event channel, and store the target event in a corresponding storage device using the event storage connector; a monitoring module, configured to control the event storage connector through a sentinel thread inside the event channel to monitor events in the storage device in real time; and a subscription module, configured to trigger an event subscriber through an event channel according to application topic information in the target event when a sentinel thread inside the event channel monitors the target event, so as to send the target event to a second application, so that the second application completes the business logic corresponding to the target event.

[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0008] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0009] Compared with the prior art, the disclosed embodiment has the following beneficial effects: when receiving a target event published by a first application through an event publisher, the corresponding event channel is located according to the application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; the target event is sent to the event storage connector through the event channel, and the target event is stored in the corresponding storage device using the event storage connector; the event storage connector is controlled by the sentinel thread inside the event channel to monitor the events in the storage device in real time; when the sentinel thread inside the event channel monitors the target event, the event subscriber is triggered through the event channel according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event. The above technical means are adopted to solve the problem of low efficiency in processing events in the process of sending the published events to the subscriber in the prior art, thereby improving the efficiency of processing events. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0011] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure;

[0012] Figure 2 It is a flowchart of an event processing method provided by an embodiment of the present disclosure;

[0013] Figure 3 is a structural diagram of an event processing device provided by an embodiment of the present disclosure;

[0014] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0015] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0016] An event processing method and device according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0017] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario may include terminal devices 101, 102 and 103, a server 104 and a network 105.

[0018] The terminal devices 101, 102 and 103 can be hardware or software. When the terminal devices 101, 102 and 103 are hardware, they can be various electronic devices with display screens and supporting communication with the server 104, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers; when the terminal devices 101, 102 and 103 are software, they can be installed in the above electronic devices. The terminal devices 101, 102 and 103 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on the terminal devices 101, 102 and 103, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0019] The server 104 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 104 may be a single server, a server cluster consisting of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.

[0020] It should be noted that the server 104 can be hardware or software. When the server 104 is hardware, it can be various electronic devices that provide various services for the terminal devices 101, 102, and 103. When the server 104 is software, it can be multiple software or software modules that provide various services for the terminal devices 101, 102, and 103, or it can be a single software or software module that provides various services for the terminal devices 101, 102, and 103, and the embodiments of the present disclosure are not limited to this.

[0021] The network 105 may be a wired network connected by coaxial cables, twisted pairs, and optical fibers, or a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.

[0022] The user can establish a communication connection with the server 104 via the network 105 through the terminal devices 101, 102 and 103 to receive or send information, etc. It should be noted that the specific types, quantities and combinations of the terminal devices 101, 102 and 103, the server 104 and the network 105 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.

[0023] Figure 2It is a flowchart of an event processing method provided by an embodiment of the present disclosure. Figure 2 The event handling method can be Figure 1 The terminal device or server executes. Figure 2 As shown, the event handling method includes:

[0024] S201, when receiving a target event published by a first application through an event publisher, locating a corresponding event channel according to application topic information in the target event, wherein the application topic information is composed of relevant information of the first application;

[0025] S202, sending the target event to the event storage connector through the event channel, and using the event storage connector to store the target event in a corresponding storage device;

[0026] S203, controlling the event storage connector through the sentinel thread inside the event channel to monitor the events in the storage device in real time;

[0027] S204, when the sentinel thread inside the event channel monitors the target event, the event subscriber is triggered through the event channel according to the application topic information in the target event to send the target event to the second application, so that the second application completes the business logic corresponding to the target event.

[0028] The above event processing method can be understood as being applied to the event management center, which is equivalent to providing a processing method between the first application that publishes the event and the second application that subscribes to the event. The prior art is often a process of sending the published event to the subscriber (the second application). The embodiment of the present disclosure creatively adds an event management center, which improves the efficiency of processing events in the process of sending the published event to the subscriber through the event management center.

[0029] The event management center has multiple event channels, each of which corresponds to an application topic information.

[0030] The target event includes application topic information and target event body. The target event body is used to explain the business logic of the target event. The application topic information is composed of the relevant information of the first application. The application topic information is also called Topic. Topic is the transmission medium between the event publisher and the subscriber, and has the function of identification. The sentinel thread guards the parent thread of the thread and can be regarded as the sentinel of the thread to be executed, so it is called the sentinel thread.

[0031] The sentinel thread inside the event channel controls the event storage connector to monitor the events in the storage device in real time, which can be understood as monitoring whether the target event occurs.

[0032] The disclosed embodiments can be applied to any scenario of publishing and subscribing events, such as the interaction between the cloud and the local end, specifically the interaction between a first application on a refrigerator and a second application on the cloud.

[0033] It should be noted that the first application may also serve as an event subscriber, and the second application may also serve as an event publisher. The specific method is the same as that in the embodiment of the present disclosure and will not be repeated herein.

[0034] According to the technical solution provided by the embodiment of the present disclosure, when a target event is received from a first application through an event publisher, the corresponding event channel is located according to the application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; the target event is sent to the event storage connector through the event channel, and the target event is stored in the corresponding storage device using the event storage connector; the event storage connector is controlled by the sentinel thread inside the event channel to monitor the events in the storage device in real time; when the sentinel thread inside the event channel monitors the target event, the event subscriber is triggered through the event channel according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event. The above-mentioned technical means are adopted to solve the problem of low efficiency in processing events in the process of sending the published events to the subscriber in the prior art, thereby improving the efficiency of processing events.

[0035] When a target event published by a first application through an event publisher is received, before locating the corresponding event channel according to the application topic information in the target event, the method also includes: registering the first application with the event publisher according to the application topic information, and determining the event channel corresponding to the application topic information, so that the first application can publish the event to the event channel through the event publisher; sending the application topic information to the second application, and registering the second application with the event subscriber according to the application topic information, so that the second application can subscribe to the events monitored by the event channel through the event subscriber.

[0036] If the first application is an event subscriber and the second application is an event publisher, then the second application needs to be registered with the event publisher and the first application needs to be registered with the event subscriber. At this time, the application topic information is composed of the relevant information of the second application.

[0037] Define the data structure of events and topics in events, where events include: topics and event bodies; define event containers and event channels; define event publishers, event listeners, event subscribers, and event storage connectors; define the relationships between event channels and event publishers, event listeners, and event subscribers, respectively.

[0038] Topic is the same as application topic information.

[0039] Defining event containers and event channels includes: defining event containers, where the event containers are used to provide functions of registering and unbinding event listeners and creating event channels; defining event channels, where the event channels are used to provide functions of pulling and delivering events.

[0040] Define event publishers, event listeners, event subscribers and event storage connectors, including: define event publishers, where the event publisher is used to provide the function of publishing events in the application to the event management center; define event listeners, where the event listeners are used to provide the function of listening to events; define event subscribers, where the event subscribers are used to provide the function of sending events in the event management center to applications that subscribe to events; define event storage connectors, where the event storage connectors are used to provide the function of reading and writing events.

[0041] Define the relationship between event channels and event publishers, event listeners and event subscribers, including: each event channel corresponds to the application topic information corresponding to an application, and each event channel pulls and delivers events under its corresponding application topic information; the relationship between event channels and event publishers, event listeners and event subscribers, including: based on the application topic information corresponding to each event channel, the event publisher publishes the events under the application topic information to the event management center, the event listener listens to the events under the application topic information, and the event subscriber sends the events under the application topic information in the event management center to the application that subscribes to the event.

[0042] In an optional embodiment, the first application publishes the target event and the second application subscribes to the target event in an asynchronous processing manner.

[0043] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0044] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0045] Figure 3 FIG. 1 is a schematic diagram of an event processing device provided by an embodiment of the present disclosure. Figure 3 As shown, the event processing device includes:

[0046] The publishing module 301 is configured to locate the corresponding event channel according to the application topic information in the target event when receiving the target event published by the first application through the event publisher, wherein the application topic information is composed of the relevant information of the first application;

[0047] The storage module 302 is configured to send the target event to the event storage connector through the event channel, and store the target event in a corresponding storage device using the event storage connector;

[0048] The monitoring module 303 is configured to control the event storage connector to monitor the events in the storage device in real time through the sentinel thread inside the event channel;

[0049] The subscription module 304 is configured to trigger the event subscriber through the event channel when the sentinel thread inside the event channel monitors the target event according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event.

[0050] The above event processing method can be understood as being applied to the event management center, which is equivalent to providing a processing method between the first application that publishes the event and the second application that subscribes to the event. The prior art is often a process of sending the published event to the subscriber (the second application). The embodiment of the present disclosure creatively adds an event management center, which improves the efficiency of processing events in the process of sending the published event to the subscriber through the event management center.

[0051] The event management center has multiple event channels, each of which corresponds to an application topic information.

[0052] The target event includes application topic information and target event body. The target event body is used to explain the business logic of the target event. The application topic information is composed of the relevant information of the first application. The application topic information is also called Topic. Topic is the transmission medium between the event publisher and the subscriber, and has the function of identification. The sentinel thread guards the parent thread of the thread and can be regarded as the sentinel of the thread to be executed, so it is called the sentinel thread.

[0053] The sentinel thread inside the event channel controls the event storage connector to monitor the events in the storage device in real time, which can be understood as monitoring whether the target event occurs.

[0054] The disclosed embodiments can be applied to any scenario of publishing and subscribing events, such as the interaction between the cloud and the local end, specifically the interaction between a first application on a refrigerator and a second application on the cloud.

[0055] It should be noted that the first application may also serve as an event subscriber, and the second application may also serve as an event publisher. The specific method is the same as that in the embodiment of the present disclosure and will not be described in detail.

[0056] According to the technical solution provided by the embodiment of the present disclosure, when a target event is received from a first application through an event publisher, the corresponding event channel is located according to the application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; the target event is sent to the event storage connector through the event channel, and the target event is stored in the corresponding storage device using the event storage connector; the event storage connector is controlled by the sentinel thread inside the event channel to monitor the events in the storage device in real time; when the sentinel thread inside the event channel monitors the target event, the event subscriber is triggered through the event channel according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event. The above-mentioned technical means are adopted to solve the problem of low efficiency in processing events in the process of sending the published events to the subscriber in the prior art, thereby improving the efficiency of processing events.

[0057] Optionally, the publishing module 301 is also configured to register the first application with the event publisher based on the application topic information, and determine the event channel corresponding to the application topic information, so that the first application can publish events to the event channel through the event publisher; send the application topic information to the second application, and register the second application with the event subscriber based on the application topic information, so that the second application can subscribe to events monitored by the event channel through the event subscriber.

[0058] If the first application is an event subscriber and the second application is an event publisher, then the second application needs to be registered with the event publisher and the first application needs to be registered with the event subscriber. At this time, the application topic information is composed of the relevant information of the second application.

[0059] Optionally, the publishing module 301 is also configured to define event containers and event channels; define event publishers, event listeners, event subscribers and event storage connectors; and define the relationships between event channels and event publishers, event listeners and event subscribers, respectively.

[0060] Topic is the same as application topic information.

[0061] Optionally, the publishing module 301 is further configured to define an event container, wherein the event container is used to provide functions of registering and unbinding event listeners and creating event channels; define an event channel, wherein the event channel is used to provide functions of pulling and delivering events.

[0062] Optionally, the publishing module 301 is also configured to define an event publisher, wherein the event publisher is used to provide the function of publishing events in the application to the event management center; define an event listener, wherein the event listener is used to provide the function of listening to events; define an event subscriber, wherein the event subscriber is used to provide the function of sending events in the event management center to applications that subscribe to events; define an event storage connector, wherein the event storage connector is used to provide the function of reading and writing events.

[0063] Optionally, the publishing module 301 is also configured so that each event channel corresponds to the application topic information corresponding to an application, and each event channel pulls and delivers events under its corresponding application topic information; the relationship between the event channel and the event publisher, event listener and event subscriber respectively includes: based on the application topic information corresponding to each event channel, the event publisher publishes the events under the application topic information to the event management center, the event listener listens to the events under the application topic information, and the event subscriber sends the events under the application topic information in the event management center to the application that subscribes to the event.

[0064] In an optional embodiment, the first application publishes the target event and the second application subscribes to the target event in an asynchronous processing manner.

[0065] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0066] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present disclosure. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0067] Exemplarily, the computer program 403 may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete the present disclosure. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 403 in the electronic device 4.

[0068] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0069] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0070] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Further, the memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device. The memory 402 may also be used to temporarily store data that has been output or is to be output.

[0071] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

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

[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.

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

[0075] 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.

[0076] In addition, each functional unit in each embodiment of the present disclosure 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.

[0077] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0078] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. An event processing method, characterized in that: Applied to an event management center, the method comprises: When receiving a target event published by a first application through an event publisher, locating a corresponding event channel according to application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; Sending the target event to an event storage connector through the event channel, and storing the target event in a corresponding storage device using the event storage connector; Controlling the event storage connector to monitor events in the storage device in real time through a sentinel thread inside the event channel; When the sentinel thread inside the event channel monitors the target event, the event subscriber is triggered through the event channel according to the application topic information in the target event to send the target event to the second application, so that the second application completes the business logic corresponding to the target event; Before the event management center is used to process the event, the method further includes: A data structure defining an event and a topic in the event, wherein the event comprises: the topic and an event body; defining an event container and said event channel; Define the event publisher, event listener, event subscriber and event storage connector; The relationships between the event channel and the event publisher, event listener and event subscriber are defined respectively.

2. The method according to claim 1, characterized in that: When receiving a target event published by the first application through the event publisher, before locating the corresponding event channel according to the application topic information in the target event, the method further includes: According to the application topic information, register the first application to the event publisher, and determine the event channel corresponding to the application topic information, so that the first application can publish events to the event channel through the event publisher; The application topic information is sent to the second application, and the second application is registered with the event subscriber according to the application topic information, so that the second application can subscribe to the events monitored by the event channel through the event subscriber.

3. The method according to claim 1, characterized in that: The defining of the event container and the event channel includes: Define the event container, wherein the event container is used to provide the functions of registering and unbinding the event listener and creating the event channel; The event channel is defined, wherein the event channel is used to provide functions of pulling and delivering events.

4. The method according to claim 1, characterized in that: The defining of the event publisher, the event listener, the event subscriber and the event storage connector includes: Defining the event publisher, wherein the event publisher is used to provide a function of publishing events in the application to the event management center; Defining the event listener, wherein the event listener is used to provide a function of monitoring events; Defining the event subscriber, wherein the event subscriber is used to provide a function of sending events in the event management center to applications that subscribe to events; The event storage connector is defined, wherein the event storage connector is used to provide event reading and writing functions.

5. The method according to claim 1, characterized in that The defining of the relationship between the event channel and the event publisher, the event listener and the event subscriber respectively includes: Each of the event channels corresponds to application topic information corresponding to an application, and each of the event channels pulls and delivers events under the corresponding application topic information; Based on the application topic information corresponding to each of the event channels, the event publisher publishes the events under the application topic information to the event management center, the event listener listens to the events under the application topic information, and the event subscriber sends the events under the application topic information in the event management center to the application that subscribes to the event.

6. The method according to claim 1, characterized in that include: The first application publishes the target event and the second application subscribes to the target event in an asynchronous processing manner.

7. An event processing device, characterized in that: Applied to an event management center, the device comprises: a publishing module configured to, when receiving a target event published by a first application through an event publisher, locate a corresponding event channel according to application topic information in the target event, wherein the application topic information is composed of relevant information of the first application; A storage module, configured to send the target event to an event storage connector through the event channel, and store the target event in a corresponding storage device using the event storage connector; A monitoring module, configured to control the event storage connector to monitor events in the storage device in real time through a sentinel thread inside the event channel; A subscription module is configured to trigger an event subscriber through the event channel when the sentinel thread inside the event channel monitors the target event according to the application topic information in the target event, so as to send the target event to the second application, so that the second application completes the business logic corresponding to the target event; Before using the event management center to process events, the publishing module is also configured to: define the data structure of events and topics in the events, wherein the events include: the topics and event bodies; define event containers and event channels; define the event publishers, event listeners, event subscribers and event storage connectors; and define the relationships between the event channels and the event publishers, event listeners and event subscribers, respectively.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Page display method, device and equipment and storage medium

    CN111680232A

  • Environmental management system

    WO2020250007A1