I\'m a beginner with WF, but I\'ve read a book and done a lot of googling. I want to write an inventory management service. The inventory is made up of individual items whic
I think we need to understand couple of things here.
State Machines - Will focus on representing a particular state your entity is in.
WorkFlow - Will define the processes you are following for moving your entity from initial state to final state.
In your case as your overall process is revolving around a single entity and its current status at any given point of time is singleton, I would recommend to go for a state machine.
Recommendation: Apache Commons SCXML provides a lightweight, embeddable state machine engine which can easily be configured and customized at runtime within your application.
Key point here is you have to define your scxml in such a way that between the state transitions of your entity - You can specify the workflows you want to perform using 'actions' or 'listeners'.
SAMPLE PROGROM: https://www.javacodegeeks.com/2012/06/apache-commons-scxml-finite-state.html
MORE ABOUT Commons SCXML 2.0 https://events.linuxfoundation.org/sites/events/files/slides/ApacheConUS2014%20-%20Apache%20Commons%20SCXML%202.0.pdf