Interaction with other FSMs

In order to understand an FSM, it is usually necessary to understand the interactions between it and other FSMs. It can be difficult to gain this understanding by looking at just the FSMs. It is often easier to start with the detailed sequence diagrams, because they indicate when inter-object interactions occur.

Something that occurs several times in the sample application is the sending of external request/response interactions by means of external services. In this scenario, an action is called something like "Send something somewhere" and the object goes into a "waiting for response" state. While in the "waiting for response" state, the generic outbound transaction and transmission FSMs are used to send the transmission out and then the generic inbound acknowledgment transaction FSM is used to handle the response.

  • The "Send to" action merely creates a separate outbound transaction and raises an event to signal that the transaction has been created.
  • The generic outbound transaction FSM takes responsibility for invoking the mapper, sending the transmission and creating the transmission objects.
  • After the request has been sent, the outbound transaction remains in a state waiting for the response to be received. This waiting state may move to an alert state if a timeout is exceeded.
  • The response from the external service is received as another separate inbound transaction (generic inbound acknowledgment transaction FSM). This response transaction is correlated with the matching outbound (request) transaction.
  • After successful correlation an event is raised. This event is used to change the state of the outbound (request) transaction. This state change raises one of the following events:
    E_OutTxnComplete
    If completion was successful.
    E_OutTxnFailed
    If completion was unsuccessful.
    The main payment FSM in the sample application reacts to these events.