Implementations of this interface are used to generate error result Events. When one of the timeouts in the ChainedEvaluationFunction was raised, the implementation of this interface is called.

Code example :

StateErrorExtractor extractor = (StateErrorExtractor) (events, ex, context) -> 
    context.collect(
        context.getEventBuilder()
            .withEvent("NAME_OF_ERROR_RESULT_EVENT")
            .withSource(context.get().getSource())
            .withTimestamp(context.get().getTimestamp())
            .withParameter("exception", ex == null ? "none" : ex.getMessage())
            .withParameter("state1Result", events.get("state1") == null ? "none" : events.get("state1").getParameter("result"))
            .withParameter("state2Result", events.get("state2") == null ? "none" : events.get("state2").getParameter("result"))
            .withParameter("state3Result", events.get("state3") == null ? "none" : events.get("state3").getParameter("result"))
            .withParameter("state4Result", events.get("state4") == null ? "none" : events.get("state4").getParameter("result"))
            .build();    
    );

When there was a exception, its message is set in the resulting Event, otherwise the value “none” is entered.

In this example the ChainedEvaluationFunction has at least 4 states, which are returning Events with the names “state1Result”, “state2Result” …

When a state was successful executed the result is not null and can be set, otherwise the value “none” is set.

The resulting error Event is passed to the context.

Back to top

Reflow Maven skin by Andrius Velykis.