KIE Demo Workbench :: RuntimeManager & RuntimeEngine

 

RuntimeManager:
  • manages RuntimeEngines
  • there cannot be two RuntimeManagers with the same id active at the same time
  • implements runtime strategies that provides certain management capabilities to reduce manual work needed to control ksession behavior:
    • Singleton – there is only one, always active ksession for the manager, access to it is thread safe that is achieved by synchronization which applies to both ksession and task service
    • PerRequest – new ksession and task service instances will be returned for every invocation of the getRuntimeEngine(Context) method. Important to know is same instance of RuntimeEngine will be returned through out transaction to avoid issues with persistence context.
    • PerProcessInstance – most advanced strategy that keeps track of which ksession was used to work with given process instance. It lives as long as process instance is alive and is destroyed when process instance is completed/aborted.

Strategy

RuntimeEngine
RuntimeManager has been introduced to simplify the configuration of KieBase and KieSession. Its main duty is to manage and create instances of RuntimeEngine according to predefined strategies. RuntimeEngine is an encapsulation of a kie session and a task service. RuntimeEngine is the main entry point to interact with the process engine and task service. It’s responsibility is to ensure that process engine and task service are properly configured and know about each other which eliminate the need to manually setup the integration between these two. RuntimeEngines are always produced by RuntimeManager and thus shall never be created manually. RuntimeManager provides all required information to build and bootstrap the RuntimeEngine so it is configured and ready to be used regardless of when it is invoked.

 

Leave a Reply