Custom Handlers
Custom handlers can be created and added to runners to build highly specialized actions, if needed.
Creating Event Handlers
package com.example.handler;
import java.util.Map;
import com.rierino.core.message.Event;
import com.rierino.core.util.HotException;
import com.rierino.runner.EventRunner;
import com.rierino.handler.EventHandler;
public class MyEventHandler extends EventHandler{
{
/**
* actionMap provides a mapping between action names
* (as used in sagas) and the functions called in handlers.
* It is recommended to use universally unique action names
* across handlers to allow easy customization of UIs by action.
* Any number of entries can be added to actionMap, in case the
* handler will support more than one actions.
*/
actionMap.put("MyAction", this::myAction);
}
/**
* Constructor with provided "alias", event runner which owns the handler
* as well as all the configurations available to the runner
*/
public MyEventHandler (String name, EventRunner runner, Map<String, String> config) {
super(name, runner, config);
}
/**
* Action function that is mapped to "MyAction" in actionMap, processing
* an inputEvent and returning a produced outputEvent.
* The function can simply throw a HotException for errors,
* which is automatically handled to return an event with failed status.
* Within the function, other runner elements (such as state managers)
* can be accessed for accessing configuration details.
*/
public Event myAction(Event inputEvent) throws HotException {
//TODO: utilize inputEvent to produce and return an outputEvent
}
}Creating Role Handlers
Optional Functions
Optional Commands
Supporting Features
Variable Injection
Output Caching
Input / Output Mapping
Input Mapping
Output Mapping
Access to Data Sources
During Configuration
During Actions
Access to System Configurations
Last updated
