Startup and shutdown rule functions are rule functions that are configured to execute during normal system startup and shutdown, respectively. There is more to say about startup rule functions and most of this section focuses on them.
Startup rule functions are optional and are used to initialize the system. For example they can provide initial values for scorecards. Startup rule functions can be used to perform more "expensive" operations so that the system is more efficient at runtime. For example, in a startup rule function for a query agent, you can create a query definition that you then reference in other rule functions. As another example, in BusinessEvents-ActiveMatrix BusinessWorks integration projects, you can call the
BusinessWorks.init() function in a startup action.
Startup rule functions may trigger rule actions. However, note that BusinessEvents executes all startup rule functions before it begins the first RTC cycle, which completes when all rules eligible to execute have executed and no more actions remain.
Shutdown rule functions are optional and are used to perform various actions during a normal shutdown, for example, they can send events to external systems.
Startup rule functions execute whenever an active node starts This includes failback to a failed node that has restarted. If you want to execute startup rule functions on only one node in a deployment, use programming logic to do so. For example, first perform a check that determines if the function has already executed using a
try catch block.
Startup (and shutdown) rule functions execute in all active agents. Startup rule functions can be used to create entities, for example, for static reference data. When multi-engine functionality is used, ensure that multiple agents do not attempt to create the same entity. For example, use a try catch block, as is done
BE_HOME/examples/FraudDetectionCache example.
In ActiveMatrix BusinessWorks integration projects, if ActiveMatrix BusinessWorks is running as the container, do not specify any startup actions that result in starting or invoking an ActiveMatrix BusinessWorks process. See
Design Considerations.
Note that after the ActiveMatrix BusinessWorks engine is initialized, processes that invoke BusinessEvents rule functions will fail if the BusinessEvents engine has not finished starting up. For example, an ActiveMatrix BusinessWorks process that listens to a JMS queue may attempt to invoke a BusinessEvents rule function before the BusinessEvents engine has started up.