If you are just beginning to design your state machine, here are
some suggestions on how to proceed.
A state machine is an event driven business transaction in which
external operations trigger changes that guide the transaction from one discrete
mode, or state, to another. Here are the steps, in order, that we recommend
you follow when building your state machine.
- Determine your operations.
These are the
messages that travel between the state machine and each of its partners.
Some
common examples are:
- The message from the client that triggers the creation of the state machine.
- The messages sent by the state machine to other partners (to delegate
tasks) and the response from these partners.
- Any message sent from the client to update the state of the process.
- Any message sent from the client to cancel the process.
- Define the states.
In a basic state machine,
each incoming operation has a corresponding state. For example, in this diagram,
each incoming operation (create, cancel, response) drives the state machine
into a new state (started, waiting, done).

- Look for loops
A loop occurs when an operation
returns the state machine to a previous state as shown here:

- Configure the transitions.
The transition
from one state to another may be qualified by one or more of the following
attributes that you set on the transition itself:
- Timeout
- A timeout is either an expiration or a duration that is used to ensure
that a state will not be maintained indefinitely while waiting for an operation
that may never occur.
- Conditions
- A condition will only allow the transition to the next state if it evaluates
to 'True'. Otherwise the current state is maintained.
- Actions
- An action is an activity of some kind that is invoked when
this transition is fired. There are three types of actions:
- invokes
- java snippets
- visual snippets