Call State Machine Resource
To call a state machine from another state machine, at design time you add a Call State Model node. You insert the node like any other state in a state model and link it to other states using transitions.
When configuring a Call State Model node, you can specify any state model that is owned by the same concept as the main state model, or that is owned by any concept higher in that concept’s inheritance chain (but not lower in the chain).
The concepts in an inheritance chain can own state models that have the same name. You can define the call as an explicit or virtual call. The Call Explicitly checkbox determines which of these same-named state models TIBCO BusinessEvents calls at runtime.
- Explicit Call: (Call Explicitly box checked.) TIBCO BusinessEvents makes an explicit call—it calls the state model specified (and at the level of the hierarchy specified.
- Virtual Call: (Call Explicitly box unchecked.) TIBCO BusinessEvents makes a virtual call—it calls the state model specified at the level of the asserted concept instance. If none is found at that level, then TIBCO BusinessEvents searches upwards in the concept hierarchy until it finds a state model of the specified name and it runs the first one it finds. This call is similar to the behavior of a Java or C++ virtual function.
You can use a Call State Model node even if you do not have concept inheritance relationship. In case of single concept, it does not matter if you check or uncheck the Call Explicitly check box.
Example of Explicit Call
In the following figure, Concept AB represents a concept instance that has been asserted at runtime. It inherits from Concept A. Concept ABC is another concept, lower in the inheritance chain than concept AB.
Concept A defines Thelma, a main state model and Louise, a state model that is explicitly called from the Thelma main state machine.
Note that Concept AB has no main state machine. It inherits the main state machine of Concept A.
At runtime, TIBCO BusinessEvents starts the Thelma main state machine for Concept AB. The Thelma state machine explicitly calls the Louise state machine defined for Concept A, and so TIBCO BusinessEvents starts the Louise state machine that is defined for Concept A.
If the call to Louise had not been defined as an explicit call, TIBCO BusinessEvents would have started the Louise state machine that was defined for Concept AB, because Concept AB is the concept that was asserted, and because it has a state machine of the same name as the one specified in the Thelma state machine.
Under no circumstances, however, would TIBCO BusinessEvents create an instance of ABC.Louise because it is below the concept instance in the inheritance chain.