< Previous | Next >

Introduction

This sample emulates a vending machine that can dispense up to three separate items.

A state machine is an event driven business transaction in which external operations trigger changes that guide the transaction from one discrete mode to another. Each mode is an individual state, and this mode determines what activities and operations can occur.

If you are new to state machines, then we recommend that you consult the instructions for the state machine editor first.

To launch the help in the product, click Help > Help Contents from the main menu. To find the documentation for the state machine editor, expand WebSphere Integration Developer > Developing integration applications > Building state machines.

To familiarize yourself with the editor, go to Creating a state machine > Business state machine editor, and to learn about some of the objects that you will work with in the editor, go to The building blocks of the state machine editor.

Expected results

At the completion of this sample, you will have the following business state machine in your editor:
SaleOrderTransactionStateMachine

Here is a brief description of the functionality that this diagram represents.

When the state machine begins at the Ready state, the first operation is on, and it makes the vending machine operational by displaying a welcome message that shows what items are available.

The state machine then enters the Idle state where it will wait for an event to happen. There are two operations that this state can react to. The first is the off operation, which will shut the state machine down. The second is the deposit event that signals the arrival of a coin. This event moves the state machine to the Depositing state while checking to make sure that it is a real coin and calculating its value.

The primary purpose of the Depositing state is to keep track of how much money has been deposited. There are several transitions out of the state, and one that cycles back into it. If the user enters another coin, then a transition checks the validity of the coin, updates the total and returns the state machine to the Depositing state. If the user makes a selection, then another transition confirms that the total amount of money is sufficient to dispense the item, and moves the state machine to the Idle state. Another transition has a timeout that determines if a transaction has taken too long to complete, and moves the state machine into the Idle state. The last transition is followed when and if the user decides to cancel the transaction outright.

< Previous | Next >





Feedback



This information center is powered by Eclipse technology. (http://www.eclipse.org)