Add docs for ordershipping sample

- Relates to #219
This commit is contained in:
Janne Valkealahti
2016-05-14 18:02:48 +01:00
parent dbb510a9d3
commit c8cc2b1ba4
5 changed files with 51 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@@ -34,6 +34,8 @@ normal build cycle. Samples in this chapter are:
<<statemachine-examples-deploy>> Deploy.
<<statemachine-examples-ordershipping>> Order Shipping.
[source,text]
----
@@ -1374,3 +1376,52 @@ 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.
[[statemachine-examples-ordershipping]]
== Order Shipping
Order Shipping is an example how state machine concepts can be used
with a process of building a simple order processing system.
Below you can see a statechart driving this order shipping sample.
image::images/sm-ordershipping-1.png[width=1000]
What is happening a above statechart:
* Machine enters `WAIT_NEW_ORDER` default state.
* Event `PLACE_ORDER` transitions into state `RECEIVE_ORDER` and entry
action `entryReceiveOrder` is executed.
* If order is _OK_ machine goes into two regions one handling order
production and one handling user level payment, else machine goes
into `CUSTOMER_ERROR` final state.
* Machine will loop in a lower region to remind user of a payment
until `RECEIVE_PAYMENT` is sent successfully to indidate correct
payment.
* Both regions will go into waiting states `WAIT_PRODUCT` and
`WAIT_ORDER` to be joined before parent orthogonal state
`HANDLE_ORDER` is exited.
* Finally machine goes via `SHIP_ORDER` into its final state
`ORDER_SHIPPED`.
Lets get into actual demo. Run the boot based sample application:
[source,text,subs="attributes"]
----
# java -jar spring-statemachine-samples-ordershipping-{revnumber}.jar
----
In a browser you see something shown above. You can start by choosing
customer and order and create a machine.
image::images/sm-ordershipping-2.png[width=1000]
Machine for particular order is now created and you can start to play
with placing an order and sending a payment. Other settings like
_makeProdPlan_, _produce_ and _payment_ allows you to control how
machine works.
image::images/sm-ordershipping-3.png[width=1000]
Finally you can see what machine does by refressing a page.
image::images/sm-ordershipping-4.png[width=1000]