Post event processing

Post processing for a node after an event process cycle

Introduction

The goal is to provide nodes a method of resetting state after each event cycle.

Nodes are effectively memory caches that store intermediate and permanent results of event processing. Child nodes can refer to cached values of parent nodes to perform calculations. Some of the cached values may need resetting at the end of an event cycle, and others are stored permanently. Fluxtion provides two annotations that mark a method for post event cycle processing.

Annotation

Behaviour

Marks a method to be called when event processing has completed. This is for any event regardless if the containing instance is on the execution path. These methods will always be executed after an event cycle.

Marks a method to be called when event processing has completed. Only for node instances that are on the active execution path will be invoked.

Event post processing methods are invoked in reverse topological order. The SEP will automatically invoke post processing methods after an event cycle.

OnEventComplete methods will execute before AfterEvent methods

Example

The example demonstrates both post processing annotations. The code for the example is located here.

The node classes:

public class ResetAfterEvent {
    
    private final Object parent;
        
    @AfterEvent
    public void afterEvent(){}
}

public class ResetDataEvent {
    private final DataEventHandler handler;
    
    @OnEvent
    public void eventUpdate() {}
    
    @OnEventComplete
    public void dataEventReset(){}
}

public class ResetGlobal {

    private final ResetDataEvent global;

    @EventHandler
    public void conifgUpdate(ConfigEvent cfgEvent){}
    
    @OnEvent
    public void eventUpdate() {}
    
    @AfterEvent
    public void afterEvent(){}
    
    @OnEventComplete
    public void eventComplete(){}
}

Generated SEP

The generated solution implements unique post processing for each event defined with @OnEventComplete, located at the end of each event handler method. The final call in the event handler method is to afterEvent(), where the @AfterEvent methods are invoked.

Generated png

The png generated by the Fluxtion ESC.

Sample SEP demonstrating post event processing

Last updated

Was this helpful?