Buildap Component Based Model Exception handling
Exception handling in asynchronous component based and event based models is one of challenges. Components are isolated sometime distributed, so runtime error in one of the components should not kill the whole application/system. At the same time some measures should be taken in response to the exception event otherwise it may malfunction without warning. One of the possible ways is to handle such situations via a standard Exception or Error outpin, which every part must have and which will be fired by the framework when any runtime exception happen in the part.
Because typical remedy to recover the part is to restart it (e.g. because of some memory leaks or buffer overflows) we can add a standard Restart inpin, which will restart/reinstantiate the part. It will clean the instance from the memory and will create new instance of the part.
In contrast to other inpins, these 2 pins – Exception outpin and Restart inpin events are events from and to the framework and are not produced or consumed by the part. Framework also may log all Exceptions and Restarts for future diagnostic.
The typical scenario will be that if an exception happen then we can simply link it with restart inpin – so it will just restart the part and if need reconfigure it again. Certainly the architecture design should contain other checks otherwise it will create endless loop. Buildap Model explicitly will show how the error recovery or warning will take place in the application.