This article covers how to configure a custom error handler for Flux. There may be many different reasons for making custom error handler. You may want an email to be mailed to an Operations team if a flow chart fails, you may want certain actions to occur if your flow chart fails or perhaps you want your flow chart to fail and not retry any actions in the event of an error.
Configuring a custom error handler in Flux can be done in two ways, through the engine configuration file or through code. The first of these two methods is through your Flux engine configuration file (.fec), and the second is through your engine configuration in code.
First, you will need to create a runtime configuration file for the flux engine to use.
In the file "YourConfiguration.properties" file, add the following line:
/namespace/DEFAULT_FLOW_CHART_ERROR_HANDLER=C:/pathTo/YourErrorFlowChart.ffc
Note: Flux respects Java conventions when it comes to slashes. If you need to specify a Windows path you will either need to escape the '\', so '
' or use the '/'.
For instance:
C:/pathTo/YourErrorFlowChart.ffc or C:\\pathTo\\YourErrorFlowChart.ffc
When exporting your flowchart to the engine make sure to specify the namespace you want your flow chart to exist in, so the correct error handler is used. The namespace gives you the ability to assign different error handlers to different flowcharts based on their fully qualified name.
Flux Engine Configuration (.fec)
In your .fec (Flux Engine Configuration) file, the following line needs to be added to the configuration in order for Flux to use your newly created runtime configuration file.
runtime_configuration_file=C:/flux-7-3-1/config/YourConfiguration.properties
Configuration through Code
If you would prefer to configure your engine through code, you have two choices: to configure your engine by point to a runtime configuration file or to build a RuntimeConfiguration object.
The following is an example of how to configure custom error handlers in your engine configuration through code.
configuration.setRuntimeConfigurationFile("C:/flux-7-3-1/config/YourConfiguration.properties");
Alternately, you could configure a RuntimeConfiguration object like:
RuntimeConfigurationFactory runtimeConfigFactory = factory.makeRuntimeConfigurationFactory();
RuntimeConfigurationNode root = runtimeConfigFactory.makeRuntimeConfiguration();
root.setDefaultFlowChartErrorHandler(makeDefaultErrorHandler());
Where makeDefaultErrorHandler() returns a FlowChart object.
Once this is done you should have a working custom error handler.