A state machine is an event driven business application in which external operations trigger changes that guide the state machine from one discrete mode to another. Each mode is an individual state, and this mode determines what activities and operations can occur.
The WebSphere® Integration Developer tools have been designed so that users can easily compose integrative business solutions without programming skills. To this end, you can easily create and develop business state machines in an intuitive graphical programming environment called the business state machine editor.
In the previous example, a user went through the appropriate steps to purchase a can of soda from a vending machine. The machine did not respond until money was deposited, and even then, did not proceed to the next state until the amount of money was sufficient. In each of the states in this example, the actions that the customer could perform were unique from any other state. For example, when it was in the primary state waiting for money, the customer could press buttons, but it would have no effect on the transaction.
Real life business transactions, such as the one shown above, can be modelled using a business state machine. The previous example was fairly simple, but in a typical business, the same type of business transaction will be repeated with multiple customers, often at the same time. With so much going on, it is easy to lose track of the status of these interactions, so the state machine uses correlation sets to distinguish the parties in their initial interaction so that they can recognize each other in the future. A correlation set is the record that is used to keep track of multiple participants in the same business transaction.
In this example, a customer goes to the vendor's store looking for a specific item that is ultimately sold out. Accordingly, the vendor issues a rain-check to the customer so that when there is sufficient stock, the customer can return and the vendor will be able to pick up the business transaction where it left off. The vendor is essentially assigning a token to the customer that is used to identify the customer when the transaction resumes.
It is important to note that the vendor is able to manage multiple tasks, and does not suspend business waiting for this one transaction to conclude. Instead, while they are waiting for the object to arrive, the vendor conducts similar business, using the same business process, with other customers.
A timeout is an expiration that is imposed upon a state. It is used to ensure that a state will not be maintained indefinitely while waiting for an operation that may never occur.
In this version of the example, the completion of the state machine is interrupted by a lack of funds. The customer leaves to get more money, leaving the vending machine waiting in a single state. In this machine, a timeout duration has been set on this state, and after waiting in vain for a specified period of time, the existing money is returned, the current state is cancelled, and the machine returns to the initial state.