Customizable state-machine-based event processing
Aspects of the subject technology include receiving a request to generate an event-based workflow associated with a first event type, which includes a state machine that includes at least a state and an associated transition and receiving an event including a second event type and an event attribute. Aspects also include determining whether the event attribute satisfies the triggering condition of the transition associated with the state, in response to determining that the second event type corresponds to the first event type, and when a current state of the event-based workflow corresponds to the state. Aspects also include performing the transition action of the transition and updating the current state based at least in part on the performed transition action, in response to determining that the event attribute satisfies the triggering condition of the transition associated with the state.
1 . A method comprising:
providing, by a server to a client device, for display at a graphical user interface of the client device, an interface illustrating one or more state machines associated with event-based workflows for processing events received by the server, the one or more state machines each including one or more states, corresponding transitions between the one or more states, and triggering conditions associated with each of the corresponding transitions, the graphical user interface including one or more drag-and-drop elements, wherein the triggering conditions specify when one state transitions to another state and provide one or more actions to be performed by the server that correspond to the transitioning, wherein the one or more states and the corresponding transitions are associated with respective code snippets for automatic code generation;
receiving, by the server from the client device via the graphical user interface, prioritized transition actions corresponding to the one or more actions to be performed by the server, wherein a prioritization of the prioritized transition actions are determined by an order of the one or more drag-and-drop elements;
receiving a request, from the client device via the provided interface, to generate an event-based workflow associated with a first event type, wherein the event-based workflow comprises a state machine that includes at least a state and an associated transition to a next state, the transition comprising a user-defined triggering condition and a transition action, wherein the user-defined triggering condition is generated via the provided interface for customizing at least one of the corresponding triggering conditions by a no-code modification of the triggering conditions using the one or more drag-and-drop elements of the graphical user interface;
generating and storing the event-based workflow comprising the state machine based at least in part on the request by translating the one or more states and the corresponding transitions into executable computer code using the respective code snippets;
receiving, by the server, an event including an event type and an event attribute; and
in accordance with determining that the event type corresponds to the first event type of the event-based workflow and that the event attribute satisfies the user-defined triggering condition associated with a current state of the event-based workflow, and when the current state of the event-based workflow corresponds to the state, performing the transition action of the transition, the transition action including offloading at least part of the event to another device for distributed processing, and updating the current state of the event-based workflow to the next state based at least in part on the performed transition action.
2 . The method of claim 1 , further comprising:
receiving a second request to generate and add a new transition to the state machine, wherein the new transition is associated with a second state of the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generating and adding the new transition to the state machine based at least in part on the second request.
3 . The method of claim 1 , further comprising:
receiving a second request to modify the transition, wherein the second request is provided via the graphical user interface of the client device; and
modifying the transition based at least in part on the second request.
4 . The method of claim 1 , further comprising:
receiving a second request to generate and add a new state to the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generating and adding the new state to the state machine based at least in part on the second request.
5 . The method of claim 1 , further comprising:
receiving a second request to modify the state of the state machine, wherein the second request is provided via the graphical user interface of the client device; and
modifying the state of the state machine based at least in part on the second request.
6 . The method of claim 1 , wherein the transition action comprises generating a second event and transmitting the second event to a remote device.
7 . The method of claim 1 , wherein the transition action comprises:
transmitting a second request to a remote device based on the event; and
receiving a second event from the remote device.
8 . The method of claim 1 , wherein the user-defined triggering condition comprises a conditional expression corresponding to a no-code input by a user via the graphical user interface.
9 . The method of claim 1 , further comprising:
translating, by the server, the user-defined triggering condition into machine-executable code based on code snippets associated with graphical elements of the interface.
10 . An electronic device comprising:
a memory; and
a processor configured to:
provide, for display at a graphical user interface of a client device, an interface illustrating one or more state machines associated with event-based workflows for processing events received by the electronic device, the one or more state machines each including one or more states, corresponding transitions between the one or more states, and triggering conditions associated with each of the corresponding transitions, the graphical user interface including one or more drag-and-drop elements, wherein the triggering conditions specify when one state transitions to another state and provide one or more actions to be performed by the electronic device that correspond to the transitioning, wherein the one or more states and the corresponding transitions are associated with respective code snippets for automatic code generation;
receive, from the client device via the graphical user interface, prioritized transition actions corresponding to the one or more actions to be performed by the electronic device, wherein a prioritization of the prioritized transition actions are determined by an order of the one or more drag-and-drop elements;
receive a request, from the client device via the provided interface, to generate an event-based workflow associated with a first event type, wherein the event-based workflow comprises a state machine that includes at least a state and an associated transition to a next state, the transition comprising a user-defined triggering condition and a transition action, wherein the user-defined triggering condition is generated via the provided interface for customizing at least one of the corresponding triggering conditions by a no-code modification of the triggering conditions using the one or more drag-and-drop elements of the graphical user interface;
generate and store the event-based workflow comprising the state machine based at least in part on the request by translating the one or more states and the corresponding transitions into executable computer code using the respective code snippets;
receive an event including an event type and an event attribute; and
in accordance with determining that the event type corresponds to the first event type of the event-based workflow and that the event attribute satisfies the user-defined triggering condition associated with a current state of the first event-based workflow, and when the current state of the event-based workflow corresponds to the state, perform the transition action of the transition, the transition action including offloading at least part of the event to another device for distributed processing, and update the current state of the event-based workflow to the next state based at least in part on the performed transition action.
11 . The electronic device of claim 10 , wherein the processor is further configured to:
receive a second request to generate and add a new transition to the state machine, wherein the new transition is associated with a second state of the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generate and add the new transition to the state machine based at least in part on the second request.
12 . The electronic device of claim 10 , wherein the processor is further configured to:
receive a second request to modify the transition, wherein the second request is provided via the graphical user interface of the client device; and
modify the transition based at least in part on the second request.
13 . The electronic device of claim 10 , wherein the processor is further configured to:
receive a second request to generate and add a new state to the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generate and add the new state to the state machine based at least in part on the second request.
14 . The electronic device of claim 10 , wherein the processor is further configured to:
receive a second request to modify the state of the state machine, wherein the second request is provided via the graphical user interface of the client device; and
modify the state of the state machine based at least in part on the second request.
15 . The electronic device of claim 10 , wherein the user-defined triggering condition comprises a conditional expression corresponding to a no-code input by a user via the graphical user interface.
16 . A non-transitory computer-readable medium comprising:
computer-readable instructions that, when executed by a processor, cause the processor to perform one or more operations comprising:
providing, for display at a graphical user interface of a client device, an interface illustrating one or more state machines associated with event-based workflows for processing events received by a server, the one or more state machines each including one or more states, corresponding transitions between the one or more states, and triggering conditions associated with each of the corresponding transitions, the graphical user interface including one or more drag-and-drop elements, wherein the triggering conditions specify when one state transitions to another state and provide one or more actions to be performed by the server that correspond to the transitioning, wherein the one or more states and the corresponding transitions are associated with respective code snippets for automatic code generation;
receiving, from the client device via the graphical user interface, prioritized transition actions corresponding to the one or more actions to be performed by the server, wherein a prioritization of the prioritized transition actions are determined by an order of the one or more drag-and-drop elements;
receiving a request, from the client device via the provided interface, to generate an event-based workflow associated with a first event type, wherein the event-based workflow comprises a state machine that includes at least a state and an associated transition to a next state, the transition comprising a user-defined triggering condition and a transition action, wherein the user-defined triggering condition is generated via the provided interface for customizing at least one of the corresponding triggering conditions by a no-code modification of the triggering conditions using the one or more drag-and-drop elements of the graphical user interface;
generating and storing the event-based workflow comprising the state machine based at least in part on the request by translating the one or more states and the corresponding transitions into executable computer code using the respective code snippets;
receiving, by the server, an event including an event type and an event attribute; and
in accordance with determining that the event type corresponds to the first event type of the event-based workflow and that the event attribute satisfies the user-defined triggering condition associated with a current state of the event-based workflow, and when the current state of the event-based workflow corresponds to the state, performing the transition action of the transition, the transition action including offloading at least part of the event to another device for distributed processing, and updating the current state of the event-based workflow to the next state based at least in part on the performed transition action.
17 . The non-transitory computer-readable medium of claim 16 , further comprising:
receiving a second request to generate and add a new transition to the state machine, wherein the new transition is associated with a second state of the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generating and adding the new transition to the state machine based at least in part on the second request.
18 . The non-transitory computer-readable medium of claim 16 , further comprising:
receiving a second request to modify the transition, wherein the second request is provided via the graphical user interface of the client device; and
modifying the transition based at least in part on the second request.
19 . The non-transitory computer-readable medium of claim 16 , further comprising:
receiving a second request to generate and add a new state to the state machine, wherein the second request is provided via the graphical user interface of the client device; and
generating and adding the new state to the state machine based at least in part on the second request.
20 . The non-transitory computer-readable medium of claim 16 , wherein the user-defined triggering condition comprises a conditional expression corresponding to a no-code input by a user via the graphical user interface.