Event processing method, device and system and electronic equipment

Through the subscription mechanism between event consumers and event middleware, the relationship between event producers and consumers is established, and the problem of poor ease of use of existing message middleware is solved, and the flexibility and high reliability of event delivery and processing are achieved. , suitable for a variety of business scenarios.

CN119172432APending Publication Date: 2024-12-20NETSUNION CLEARING CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310729124.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

When existing message middleware ensures high and reliable transmission of messages, it has poor ease of use. The complex parameter configuration makes it more difficult to use, and lacks flexibility and ease of use.

Method used

Through event consumers send event subscription requests to event middleware, establish the association between business events and event consumers, realize communication and processing between event producers and event consumers, simplify parameter settings, and improve ease of use.

Benefits of technology

In distributed scenarios, it realizes the flexibility of event delivery and processing, supports business scenarios such as fault alarms and data synchronization, and does not require complex parameter settings, which improves the ease of use of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172432A_ABST
    Figure CN119172432A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an event processing method, device and system and electronic equipment. Event transmission and processing with usability and flexibility can be achieved. The event processing method comprises the steps that an event producer produces a target business event based on event parameters of the target business event and sends the target business event to event middleware; the event consumer sends an event subscription request about the target service event to the event middleware; the event middleware adds an event consumer to an event consumer list of a target business event based on an event subscription request of the event consumer about the target business event, receives the target business event produced by an event producer, and provides the target business event for the event consumer in the event consumer list; the event consumer executes the target business event and returns an execution result of the target business event to the event middleware; and the event middleware sends the obtained execution result to the event producer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of computer technology, and in particular to an event processing method, device, system and electronic device. Background Art

[0002] Events between different applications are usually transmitted through message middleware. Existing message middleware, such as Kafka and Rocket MQ, simply provides a channel for message transmission. If you need to ensure high reliability of message transmission, you also need to cooperate with complex parameter configuration, which is not easy to use.

[0003] Therefore, there is an urgent need for an event processing solution that is easy to use. Summary of the invention

[0004] The embodiments of this specification aim to provide an event processing method, device, system and electronic device, which can realize event transmission and processing with both ease of use and flexibility.

[0005] In order to achieve the above purpose, the embodiments of this specification adopt the following technical solutions:

[0006] In a first aspect, an event processing method is provided, which is applied to event middleware, and the method comprises:

[0007] The event producer produces the target business event based on the event parameters of the target business event, and sends the target business event to the event middleware;

[0008] The event consumer sends an event subscription request about the target business event to the event middleware;

[0009] The event middleware adds the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer regarding the target business event, receives the target business event produced by the event producer, and provides the target business event to the event consumers in the event consumer list;

[0010] The event consumer executes the target business event, and returns the execution result of the target business event to the event middleware;

[0011] The event middleware sends the acquired execution result to the event producer.

[0012] In a second aspect, an event processing method is provided, which is applied to event middleware, and the method includes:

[0013] Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event;

[0014] Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list;

[0015] The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

[0016] In a third aspect, an event processing system is provided, including: event middleware, event producer and event consumer;

[0017] The event producer is used to produce the target business event based on the event parameters of the target business event, send the target business event to the event middleware, and receive the execution result of the target business event returned by the event middleware;

[0018] The event consumer is used to send an event subscription request about the target business event to the event middleware, receive and execute the target business event provided by the event middleware, and return the execution result of the target business event to the event middleware;

[0019] The event middleware is used to add the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer regarding the target business event, receive the target business event produced by the event producer, provide the target business event to the event consumers in the event consumer list, and receive the execution result of the target business event returned by the event consumers in the event consumer list, and return the received execution result to the event producer.

[0020] In a fourth aspect, an event processing device is provided, which is applied to event middleware, and the device includes:

[0021] A first adding unit, based on an event subscription request of an event consumer for a target business event, adds the event consumer to an event consumer list of the target business event;

[0022] A first sending unit, based on the target business event generated by the event producer, provides the target business event to the event consumers in the event consumer list;

[0023] The second sending unit sends the execution result of the target business event returned by the event consumer in the event consumer list to the event producer.

[0024] In a fifth aspect, an electronic device is provided, including:

[0025] Processor; and

[0026] a memory arranged to store computer executable instructions which, when executed, cause the processor to:

[0027] Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event;

[0028] Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list;

[0029] The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

[0030] In a sixth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following operations:

[0031] Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event;

[0032] Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list;

[0033] The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

[0034] The scheme of the embodiments of this specification enables the event middleware to associate business events with event consumers by having the event consumer send an event subscription request to the event middleware. When the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby achieving communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided by the embodiments of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0036] Figure 1 A schematic diagram of an implementation environment involved in the embodiments of this specification;

[0037] Figure 2 A flowchart of an event processing method on the event middleware side provided for one embodiment of this specification;

[0038] Figure 3 A flowchart of an event processing method on the event consumer side provided for one embodiment of this specification;

[0039] Figure 4 An embodiment of this specification provides a flowchart of an event processing method on the event producer side;

[0040] Figure 5 A flowchart of an event processing method provided for one embodiment of this specification;

[0041] Figure 6 A schematic diagram of the structure of an event processing device on the event middleware side provided for one embodiment of this specification;

[0042] Figure 7 A schematic diagram of the structure of an electronic device provided for one embodiment of the present specification. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.

[0044] As mentioned above, event transmission between different applications is usually achieved through message middleware. Existing message middleware, such as Kafka and Rocket MQ, simply provides a channel for message transmission. If you need to ensure high reliability of message transmission, you also need to cooperate with complex parameter configuration, which is not easy to use.

[0045] Based on this, the embodiments of this specification are intended to propose an event processing solution, whereby the event consumer sends an event subscription request to the event middleware, so that the event middleware can associate the business event with the event consumer, and then when the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing the communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided by the embodiments of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0046] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0047] First, an exemplary description is given of the implementation environment involved in the embodiments of this specification.

[0048] See also Figure 1 The implementation environment involved in the embodiments of this specification includes event middleware and applications.

[0049] Among them, the event middleware uses the event delivery mechanism to realize the business event delivery between different applications, and maintains the delivery and storage and forwarding mechanism of business events. Specifically, the event middleware can add the event consumer to the event consumer list of the subscribed event according to the event subscription request of the event consumer, and when the event producer triggers the business event, the event message of the business event is sent to the event consumer in the event consumer list, so that the event consumer who subscribes to the event executes the business event. For example, the business event that the event consumer requests to subscribe to is the data of the synchronized data source. When the event producer detects that the data of the data source has changed, it will trigger the corresponding business event and publish the business event to the event middleware based on the data change information of the data source. The event middleware then sends the business event to the event consumer who subscribes to the business event, and the event consumer synchronizes the data of the target object based on the received business event.

[0050] More specifically, event middleware is a middleware system with a unified external interface and rich event communication mechanism developed on the basis of native middleware. It has the function of docking with event producers and event consumers, and also has the function of docking with native middleware. For example, event middleware can receive business events published by event producers and write them into the business queue of native middleware, and also provide business events to event consumers of business events for event consumers to perform corresponding processing. In this way, in a distributed scenario, communication between different systems (that is, producers and consumers at the user layer, event producers and event consumers in the event middleware) is realized through event middleware, so that the event communication mechanism has the characteristics of low coupling and strong flexibility.

[0051] In order to achieve the connection with multiple external event producers and event consumers, multiple system-level producers and multiple system-level consumers are set in the event middleware, and different system-level producers and system-level consumers are connected with different types of event producers and event consumers. Taking one system-level producer and one system-level consumer as an example, the system producer can receive the business events sent by the event producer and write them into the business queue of the native middleware; the system-level consumer can obtain the subscribed business events by consuming the business queue and provide them to the event consumer, and the event consumer processes the business event.

[0052] Furthermore, the event middleware has functions such as channel application, event definition, event log, consumption log and notification template, etc. These functions can be configured by relevant personnel through the control interface of the event middleware or directly set in the code of the event middleware, and this specification embodiment does not specifically limit this. The configuration information of the above functions can be stored in the configuration library, and then when a certain function needs to be used, the configuration information of the function can be directly read from the configuration library, and the function can be configured based on the configuration information.

[0053] Through the channel application function, the event middleware can create one or more event channels and use different event channels to transmit event messages of different events. Event channels can include event queues.

[0054] The event definition function can unify the formats of event messages for different business events, making it easier for event consumers to format and parse business events.

[0055] Through the event log function, the event middleware can record business events and the processing status of business events. Specifically, the event middleware can determine the processing status of business events based on the execution results of business events returned by event consumers, and store business events and the processing status of business events in the event library.

[0056] Through the subscription log function, the event middleware can record and maintain the event consumer list of different business events, so that when the event producer triggers a business event, the business event is sent to the event consumer in the event consumer list of the business event, completing the transmission of the business event between the event producer and the event consumer.

[0057] Through the notification template function, the event middleware can send business events to event consumers of business events and call back the processing status of business events to event producers of business events based on notification templates.

[0058] Applications can act as event producers and publish business events to event middleware. Specifically, applications can trigger events in response to user operations, and generate business events based on event parameters (such as event name, attributes, and content) of business events according to predetermined event definitions, and send events to business queues through the event publishing interface (Application Programming Interface, API) provided by the event middleware, thus completing the publishing of business events. Of course, business events can also be published on a scheduled basis.

[0059] Applications can also act as event consumers and subscribe to events from event middleware. After receiving an event, the application executes the event. Specifically, the application can retrieve the subscribed business event from the business queue through the event subscription interface provided by the event middleware, and call the corresponding processing function to execute the business event based on the event parameters carried in the business event, thereby completing the subscription and consumption of the business event.

[0060] Furthermore, when acting as an event consumer, the application can also return the execution result of the business event to the business queue or a separately created status queue. The event middleware is responsible for recording the processing status of the business event based on the execution result of the business event, and delivering the processing status of the business event to the application that initiated the business event (ie, the event producer), thereby completing the event callback.

[0061] Furthermore, the application can publish and subscribe to business events through the corresponding software development kit (SDK). In addition, when publishing or subscribing to business events, business event filtering and permission control can be performed.

[0062] Based on the above implementation environment, the embodiment of this specification provides an event processing solution. The technical solution provided by the embodiment of this specification is described in detail below in conjunction with the accompanying drawings.

[0063] See also Figure 2 , is a flow chart of an event processing method provided by an embodiment of this specification, the method can be Figure 1The event middleware in is executed. Figure 2 As shown, the method comprises the following steps:

[0064] S202: Based on the event subscription request of the event consumer for the target business event, add the event consumer to the event consumer list of the target business event.

[0065] In the above S202, the system layer producer in the event middleware may add the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer for the target business event.

[0066] In the embodiments of this specification, the target business event can be any business event, and the event subscription request for the target business event refers to an event subscription request for requesting to subscribe to the target business event. The event subscription request can carry subscription configuration information corresponding to the event consumer, specifically, the subscription configuration information includes identification information and / or event parameters of the event channel to be subscribed.

[0067] The identification information of the event channel is used to uniquely locate the event channel. Since the business events produced by the event producer are transmitted through the event channel, by specifying the identification information of the event channel to be subscribed in the subscription configuration information, the subscription to the events transmitted in the event channel can be realized. More specifically, the identification information of the event channel can be the name, address, etc. of the event channel.

[0068] Among them, the event parameters may include, for example, but are not limited to, at least one of the name, attributes, and content of the business event. The name of the business event is used to uniquely locate the business event. By carrying the name of the target business event in the event subscription request, all subscribed business events can be directly specified to the event middleware. The attributes of the business event are used to filter events. A business event can have multiple attributes. The values ​​of different attributes can be of any appropriate type, such as enumeration type, numeric type, etc. In specific implementation, by specifying the value ranges of different attributes, subscription to business events that meet the value ranges of different attributes can be achieved. The content of the business event can be defined in any appropriate way. For example, the content of the business event can be defined in JSON format. By specifying the content of the business event, subscription to business events that meet the content can be achieved.

[0069] It should be noted that the subscription configuration information carried in the event subscription request can be pre-set through the operation interface provided by the console of the event middleware, or can also be specified in the relevant code of the event consumer. For example, the event channel can be specified through the .getConsumerBuilder() method, the name of the business event can be specified through the .withEventType() method, the attributes of the business event can be specified through the .withExtAttr() method, the content of the business event can be specified through the .withData() method, and so on. The embodiments of this specification do not make specific limitations on this.

[0070] It can be seen that the event middleware can determine the target business event that the event consumer wants to subscribe to through the subscription configuration information carried in the event subscription request sent by the event consumer. Therefore, before S202, the event processing method on the event middleware side provided in the embodiment of this specification may also include: receiving the event subscription request sent by the event consumer, and determining the business event that the event subscription request requests to subscribe to based on the subscription configuration information carried in the event subscription request. Further, the event middleware can determine whether the event subscription request is an event subscription request for the target business event through the event subscription request sent by the event consumer.

[0071] The event middleware can maintain a list of event consumers corresponding to different events based on the business events requested to be subscribed by the received event subscription request, so that when a business event published by an event producer is received, the business event can be sent to all event consumers who have subscribed to the event, and the event consumers can process the event.

[0072] S204: Based on the target business event produced by the event producer, provide the target business event to the event consumers in the event consumer list.

[0073] The target business event is used for the event consumer to execute. In the above S204, the system layer producer can receive the target business event produced by the event producer and write it into the business queue; the system layer consumer consumes the business queue and provides the acquired target business event to the event consumers in the event consumer list.

[0074] Specifically, the target business event is the event producer of the target business event. After the target business event is triggered, it is generated based on the event parameters of the target business event and sent to the event middleware. The target business event carries the event parameters of the target business event, so that the corresponding event consumer can call the corresponding event function to execute the target business event based on the event parameters of the target business event and return the execution result of the target business event.

[0075] As an implementation method, the subscription configuration information carried in the event subscription request for the target business event received by the event middleware may also include an event notification method. Accordingly, the event middleware may provide the target business event to each event consumer based on the event notification method specified by each event consumer in the event consumer list of the target business event. The event notification method may include, for example, but is not limited to, at least one of the following methods: SMS, email, Webhook, remote script, etc.

[0076] S206: Send the execution result of the target business event returned by the event consumer in the event consumer list to the event producer.

[0077] Specifically, the event middleware can add the execution result of the received target business event to the state queue, so that the producer of the target business event can obtain the execution result of the target business event from the state queue. For example, the system producer can receive the execution result of the target business event returned by the event consumer and write it into the state queue, and the system layer consumer consumes the state queue and sends the obtained execution result to the event producer.

[0078] The event processing method provided in the above embodiments of this specification is described below by taking different scenarios as examples.

[0079] Scenario 1: Fault Alarm

[0080] The fault detection party can detect whether the object under test has a fault. When the object under test has a fault, the fault detection party can act as an event producer, trigger an alarm event and publish it to the event middleware. The event middleware sends the alarm event to the fault maintenance party (i.e., event consumer) that subscribes to the alarm event, and the fault maintenance party performs the corresponding maintenance operation to handle the alarm event. In this way, automatic fault handling in this scenario is realized, solving the problem that traditional message middleware can only transmit alarm messages and can only "see" alarm messages.

[0081] Scenario 2: Data Synchronization

[0082] The data source can detect whether its own data has changed. If so, it can act as an event producer, trigger a change event based on the data change information, and publish the change event to the event middleware. The event middleware will subscribe to the target object (i.e., event consumer) of the relevant events of the data source, and the target object will synchronize the data change information of the data source to the local, thereby completing the data synchronization between the data source and the target object. It can be seen that through the event processing method provided in the embodiment of this specification, the event middleware does not need to transmit the full amount of data of the data source at regular intervals, but only needs to transmit the event message of the change event, which not only reduces the amount of data transmitted, but also can trigger the target object to perform data synchronization operations in a timely manner, thereby improving the timeliness of data synchronization.

[0083] Of course, the event processing method provided in the embodiments of this specification can also be applied to more business scenarios, which will not be described in detail here.

[0084] Through the event processing method provided in the embodiment of this specification, the event consumer sends an event subscription request to the event middleware, so that the event middleware can associate the business event with the event consumer, and then when the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing the communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided in the embodiment of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0085] Optionally, after S206, the event processing method provided in the embodiment of the present specification may further include: saving the execution result of the target business event and / or the target business event returned by the event consumer in the event subscription consumption list to a preset database, wherein the preset database may be, for example, Figure 1 As shown in the event library, the parties involved in the event middleware can query the relevant information of the target business event from the database at any time to obtain information such as the processing progress of the target business event.

[0086] See also Figure 3 , is a flow chart of an event processing method provided by an embodiment of this specification, the method can be Figure 1 The event consumer in is executed. Figure 3 As shown, the method comprises the following steps:

[0087] S302: Send an event subscription request for a target business event to the event middleware.

[0088] The event subscription request is used to request the event middleware to add the event consumer to the event consumer list of the target business event.

[0089] Optionally, before S302, the method may further include: generating an event subscription request for a target business event based on predetermined subscription configuration information, wherein the subscription configuration information includes identification information of an event channel and / or event parameters of the target business event.

[0090] The identification information of the event channel is used to uniquely locate the event channel. Since the business events produced by the event producer are transmitted through the event channel, the event consumer can subscribe to the business events transmitted in the event channel by specifying the identification information of the event channel to be subscribed in the subscription configuration information. More specifically, the identification information of the event channel can be the name, address, etc. of the event channel.

[0091] Among them, the event parameters may include, for example, but are not limited to, at least one of the name, attributes, and content of the business event. The name of the business event is used to uniquely locate the business event. The event consumer can directly specify all subscribed business events to the event middleware by carrying the name of the target business event in the event subscription request. The attributes of the business event are used to filter business events. A business event can have multiple attributes, and the values ​​of different attributes can be of any appropriate type, such as enumeration type, numeric type, etc. In specific implementation, by specifying the value ranges of different attributes, it is possible to subscribe to business events that meet the value ranges of different attributes. The content of the business event can be defined in any appropriate way. For example, the content of the business event can be defined in JSON format. By specifying the content of the business event, it is possible to subscribe to business events that meet the content.

[0092] It should be noted that the subscription configuration information carried in the event subscription request can be pre-set through the operation interface provided by the console of the event middleware, or can also be specified in the relevant code of the event consumer. For example, the event channel can be specified through the getConsumerBuilder() method, the name of the business event can be specified through the withEventType() method, the attributes of the business event can be specified through the withExtAttr() method, the content of the business event can be specified through the withData() method, and so on. The embodiments of this specification do not make specific limitations on this.

[0093] It can be understood that by pre-setting the subscription configuration information, the event consumer generates an event subscription request for the target business event through the predetermined subscription configuration information, thereby improving the flexibility and ease of use of event subscription.

[0094] S304, receiving and executing the target business event provided by the event middleware.

[0095] Specifically, the event consumer may call the corresponding event function to execute the target business event based on the event parameters carried in the received target business event, thereby realizing the processing of the target business event.

[0096] S306: Return the execution result of the target business event to the event middleware.

[0097] Specifically, event consumers can return the execution results of target business events to the event middleware through the event subscription interface provided by the event middleware.

[0098] Through the event processing method provided in the embodiment of this specification, the event consumer sends an event subscription request to the event middleware, so that the event middleware can associate the business event with the event consumer, and then when the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing the communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided in the embodiment of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0099] See also Figure 4 , is a flow chart of an event processing method provided by an embodiment of this specification, the method can be Figure 1 The event producer in executes. Figure 4 As shown, the method comprises the following steps:

[0100] S402, in response to the triggering of the target business event, based on the event parameters of the target business event, the target business event is sent to the event middleware, so that the target business event is provided to the event consumers in the event consumer list of the target business event through the event middleware, so that the event consumers can execute the target business event.

[0101] In the embodiments of this specification, the event producer may send the target business event to the event middleware in any appropriate manner, thereby achieving event publishing that takes into account both ease of use and flexibility.

[0102] As an implementation method, the event producer may publish the target business event via SDK. Specifically, the above S402 includes:

[0103] Step A1: Create an event template corresponding to the target business event.

[0104] For example, the eventTemplate.newBuilder() method may be used to create an event template corresponding to a target business event.

[0105] Step A2: adding event parameters of the target business event to the event template according to the predetermined event definition.

[0106] In the embodiment of this specification, the target business event can be defined by event parameters such as name, attribute and content.

[0107] For example, the withExtAttr() method can be used to specify the attributes of the target business event in the event template, the withData() method can be used to specify the content of the target business event in the event template, the withEventType() method can be used to specify the name of the target business event in the event template, and so on.

[0108] Step A3: Generate a target business event based on the event template after adding event parameters.

[0109] For example, a build() method may be used to generate a target business event.

[0110] Step A4: Send target business event information to the event middleware through the publishing interface function in the SDK.

[0111] For example, the send() method may be used to send the target business event to the event center, thereby completing the publication of the target business event.

[0112] It can be understood that in this implementation, after applying through the console of the event middleware, the message can be published through the SDK, which is simple and easy to use.

[0113] As another implementation method, the event producer may publish the target business event through a HyperText Transfer Protocol (HTTP) call. Specifically, the above S402 includes:

[0114] Step B1: construct a JSON string for describing the target business event according to a predetermined event definition and event parameters of the target business event.

[0115] Step B2: Generate a target business event based on the JSON string.

[0116] Step B3: Send the target business event to the Uniform Resource Locator (URL) corresponding to the target business event of the event middleware.

[0117] It is understandable that, compared with the above-mentioned method of publishing through SDK, publishing target business events through HTTP calls does not require specification in the code, which further simplifies the event publishing process.

[0118] S404, receiving the execution result of the target business event returned by the event consumer and forwarded by the event middleware.

[0119] As an implementation method, the event middleware can add the execution result of the target business event to the status queue, and the event producer can obtain the execution result of the target business event from the status queue, thereby knowing the processing progress of the target business event.

[0120] Through the event processing method provided in the embodiment of this specification, the event consumer sends an event subscription request to the event middleware, so that the event middleware can associate the business event with the event consumer, and then when the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing the communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided in the embodiment of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0121] See also Figure 5 , is a flow chart of an event processing method provided by an embodiment of this specification, which describes the interaction process between event middleware, event producers and event consumers. Figure 5 As shown, the method comprises the following steps:

[0122] S502: The event producer produces a target business event based on event parameters of the target business event.

[0123] Optionally, the above S502 includes: creating an event template corresponding to the target business event; adding event parameters of the target business event to the event template according to a predetermined event definition; and sending the target business event to the event middleware through the publishing interface function in the software development toolkit SDK based on the event template after adding the event parameters.

[0124] Optionally, the above S502 includes: constructing a JSON string for describing the target business event according to a predetermined event definition and event parameters of the target business event; based on the JSON string, sending the target business event to the uniform resource locator URL corresponding to the target business event of the event middleware.

[0125] S504, the event producer sends the target business event to the event middleware.

[0126] S506: The event consumer sends an event subscription request regarding the target business event to the event middleware.

[0127] Optionally, the event consumer generates an event subscription request for the target business event based on the predetermined subscription configuration information, and the event subscription request carries the subscription configuration information. The subscription configuration information includes the identification information of the event channel and / or event parameters.

[0128] Optionally, the subscription configuration information further includes an event notification method. Accordingly, S506 includes: providing the target service event to event consumers in the event consumer list based on the event notification method.

[0129] S508: The event middleware adds the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer for the target business event.

[0130] Specifically, the system layer producer in the event middleware adds the event consumer to the event consumer list of the target business event based on the event consumer's event subscription request for the target business event.

[0131] Optionally, before the above S508, the event processing method provided by the embodiment of the present application may also include: the event middleware receives an event subscription request sent by the event consumer, and determines the target business event requested to be subscribed by the event subscription request based on the subscription configuration information.

[0132] S510, the event middleware receives a target business event produced by an event producer, and provides the target business event to event consumers in an event consumer list.

[0133] For example, the system layer producer in the event middleware receives the target business event generated by the event producer and stores the target business event in the business queue. The system layer consumer in the event middleware consumes the business queue and provides the acquired target business event to the event consumers in the event consumer list.

[0134] S512, the event consumer receives and executes the target business event.

[0135] S514, the event consumer returns the execution result of the target business event to the event middleware.

[0136] S516, the event middleware sends the acquired execution result to the event producer.

[0137] For example, the system layer producer in the event middleware receives the acquired execution result and stores it in the state queue, and the system layer consumer consumes the state queue and sends the acquired execution result to the event producer.

[0138] Optionally, the event processing method provided by the embodiment of the present application may further include: the event middleware saves the event message of the target business event and / or the execution result of the target business event returned by the event consumer in the event consumer list into a preset database.

[0139] It should be noted that the implementation methods of the above steps can refer to the above Figures 2 to 4 The description of the corresponding steps in the illustrated method embodiment will not be repeated here.

[0140] Through the event processing method provided in the embodiment of this specification, the event consumer sends an event subscription request to the event middleware, so that the event middleware can associate the business event with the event consumer, and then when the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing the communication between the event producer and the event consumer in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided in the embodiment of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0141] In addition, Figure 2 Corresponding to the event processing method shown, the embodiment of this specification also provides an event processing device. Figure 6 is a schematic diagram of the structure of an event processing device 600 provided in an embodiment of the present specification. The device 600 can be applied to event middleware. The device 600 includes:

[0142] A first adding unit 610, based on an event subscription request of an event consumer for a target business event, adds the event consumer to an event consumer list of the target business event;

[0143] A first sending unit 620 provides the target business event to event consumers in the event consumer list based on the target business event generated by the event producer;

[0144] The second sending unit 630 sends the execution result of the target business event returned by the event consumer in the event consumer list to the event producer.

[0145] The event processing device provided in the embodiment of this specification enables the event middleware to associate business events with event consumers by sending event subscription requests from event consumers. When the event producer produces the business event, the business event can be provided to the event consumer of the business event, and the business event is executed by the event consumer, thereby realizing communication between event producers and event consumers in a distributed scenario, and the transmission and processing of business events are more flexible. In addition, the event processing method provided in the embodiment of this specification provides functional support for business scenarios such as fault alarms and data synchronization. Compared with the existing message middleware, it does not require complex parameter settings, which improves ease of use.

[0146] Obviously, the event processing device in the embodiment of this specification can be used as the above Figure 2 The execution body of the event handling method shown in Figure 2 The functions realized are as follows. Since the principles are the same, they will not be described here.

[0147] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this specification. Figure 7 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0148] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0149] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0150] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming an event processing device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0151] Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event;

[0152] Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list;

[0153] The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

[0154] The above is as in this manual Figure 2 The method performed by the event processing device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this specification can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of this specification can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0155] It should be understood that the electronic device of the embodiment of this specification can implement the event processing device in Figure 2Functions of the embodiments shown. Since the principles are the same, the embodiments of this specification will not be described in detail here.

[0156] Of course, in addition to software implementation, the electronic device of this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0157] The embodiment of the present specification also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 2 The method of the embodiment shown is specifically used to perform the following operations:

[0158] Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event;

[0159] Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list;

[0160] The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

[0161] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0162] In short, the above description is only a preferred embodiment of this specification and is not intended to limit the protection scope of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the protection scope of this specification.

[0163] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer.

[0164] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0165] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0166] Each embodiment in this specification is described in a progressive 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.

Claims

1. An event processing method, characterized in that: The method comprises: The event producer produces the target business event based on the event parameters of the target business event, and sends the target business event to the event middleware; The event consumer sends an event subscription request about the target business event to the event middleware; The event middleware adds the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer regarding the target business event, receives the target business event produced by the event producer, and provides the target business event to the event consumers in the event consumer list; The event consumer executes the target business event, and returns the execution result of the target business event to the event middleware; The event middleware sends the acquired execution result to the event producer.

2. The method according to claim 1, characterized in that: The event consumer sends an event subscription request about the target business event to the event middleware, including: The event consumer generates an event subscription request for a target business event based on the predetermined subscription configuration information, wherein the event subscription request carries the subscription configuration information, and the subscription configuration information includes identification information of the event channel and / or event parameters; Before the event middleware adds the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer for the target business event, the method further includes: The event middleware receives an event subscription request sent by an event consumer; The event middleware determines the target business event to be subscribed to by the event subscription request based on the subscription configuration information.

3. The method according to claim 2, characterized in that The subscription configuration information also includes event notification method; Providing the target business event to the event consumers in the event consumer list includes: Based on the event notification method, the target business event is provided to event consumers in the event consumer list.

4. The method according to any one of claims 1 to 3, characterized in that Also includes: The event middleware saves the event message of the target business event and / or the execution result of the target business event returned by the event consumer in the event consumer list into a preset database.

5. The method according to claim 1, characterized in that The event producer produces a target business event based on the event parameters of the target business event, and sends the target business event to the event middleware, including: Creating an event template corresponding to the target business event; According to a predetermined event definition, adding event parameters of the target business event to the event template; Based on the event template after adding the event parameters, the target business event is sent to the event middleware through the publishing interface function in the software development toolkit SDK.

6. The method according to claim 1, characterized in that The event producer produces a target business event based on the event parameters of the target business event, and sends the target business event to the event middleware, including: Constructing a JSON string for describing the target business event according to a predetermined event definition and event parameters of the target business event; Based on the JSON string, the target business event is sent to a uniform resource locator URL corresponding to the target business event of the event middleware.

7. The method according to claim 1, characterized in that The event middleware includes a system layer producer, a system layer consumer, a business queue and a status queue; The event middleware adds the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer for the target business event, receives the target business event produced by the event producer, and provides the target business event to the event consumers in the event consumer list, including: The system layer producer adds the event consumer to the event consumer list of the target business event based on the event consumer's event subscription request for the target business event, and receives and stores the target business event produced by the event producer through the business queue; The system layer consumer consumes the business queue and provides the acquired target business events to event consumers in the event consumer list; The event middleware sends the acquired execution result to the event producer, including: The system layer producer receives and stores the acquired execution result through the status queue; The system layer consumer consumes the state queue and sends the acquired execution result to the event producer.

8. An event processing method, characterized in that: Applied to event middleware, the method includes: Based on an event subscription request of an event consumer for a target business event, adding the event consumer to an event consumer list of the target business event; Based on the target business event generated by the event producer, providing the target business event to the event consumers in the event consumer list; The execution result of the target business event returned by the event consumer in the event consumer list is sent to the event producer.

9. An event processing system, characterized in that: include: Event middleware, event producers, and event consumers; The event producer is used to produce the target business event based on the event parameters of the target business event, send the target business event to the event middleware, and receive the execution result of the target business event returned by the event middleware; The event consumer is used to send an event subscription request about the target business event to the event middleware, receive and execute the target business event provided by the event middleware, and return the execution result of the target business event to the event middleware; The event middleware is used to add the event consumer to the event consumer list of the target business event based on the event subscription request of the event consumer regarding the target business event, receive the target business event produced by the event producer, provide the target business event to the event consumers in the event consumer list, and receive the execution result of the target business event returned by the event consumers in the event consumer list, and return the received execution result to the event producer.

10. An event processing device, characterized in that: Applied to event middleware, the device comprises: A first adding unit, based on an event subscription request of an event consumer for a target business event, adds the event consumer to an event consumer list of the target business event; A first sending unit, based on the target business event generated by the event producer, provides the target business event to the event consumers in the event consumer list; The second sending unit sends the execution result of the target business event returned by the event consumer in the event consumer list to the event producer.