47. Deploy

Deploy is an example how state machine concepts can be used with an uml modeling to provide a generic error handling state. This state machine is a relatively complex example of how various features can be used to provide a centralized error handling concept.

model deployer
[Note]Note

Above statechart is designed using Eclipse Papyrus Plugin Chapter 32, Eclipse Modeling Support and imported into Spring StateMachine via its uml model file. Actions and Guards defined in a model are resolved from a Spring Application Context.

In this state machine scenario we have two different behaviors, DEPLOY and UNDEPLOY what user tries to execute.

What is happening a above statechart:

Let’s get into actual demo. Run the boot based sample application:

# java -jar spring-statemachine-samples-deploy-1.2.9.RELEASE.jar

In a browser you see something like:

sm deploy 1
[Important]Important

As we don’t have a real install, start or stop functionality we simulate failures by checking existence of particular message headers.

Now you can start to send event to a machine and choose various message headers which will drive a different functionality.