Alfie Kirkpatrick [
https://community.jboss.org/people/alfiekirkpatrick] created the
discussion
"Simple state machine with transitions"
To view the discussion, visit:
https://community.jboss.org/message/821954#821954
--------------------------------------------------------------
We have an existing (bespoke) workflow engine in our product and we are looking at options
to bring it up-to-date using jBPM or similar.
Each asset type in our system has a state machine that defines the lifecycle of the asset.
For each state there are a number of transitions to other states (or back to the same
state). These can be triggered by users of the system or through an API.
It's important that the people doing the configuration for a project can easily define
the state machine for a particular asset type. This is currently done through a
non-graphical web form as a complex kind of table (not pretty but it works).
Additionally, we can define which user roles can execute each transition and therefore
control who can shift assets from one state to another. Since 'save' and
'view' are actually transitions internally, this provides a good level of access
control.
There's more functionality such as custom actions on transitions and transition
parameters but you get the basic idea.
I'm new to jBPM (I did some work on jBPM 4 but for a different scenario). It seems
this scenario would typically be handled by a combination of user task (or manual task)
and a gateway. The steps might be:
- Define a task connected to a gateway
- Before completing the task, set process variable to the path to follow, eg.
transition="save"
- Place a constraint on each outgoing flow on the gateway, eg. return
"save".equals(transition)
It seems the mapping of task output to variable could be handled in the BPMN also, though
I've not looked at that in detail.
The main issue I see is that this is tricky and error prone to set up for a complex
scenario, so I am trying to think of ways to simplify it for projects.
One idea would be to define a simpler XML format expressing the states/transitions
involved and then transform it to BPMN for jBPM before loading.
Another idea would be to add a new SemanticModule to the PackageBuilderConfiguration, to
allow different elements in the process that give the "higher level" definition
we're after.
A third idea would be to give up on BPMN and use the underlying state machine in
jBPM/Drools, ie. handle things at a lower level. It seems that the SemanticModule for BPMN
ends up transforming to some lower level XML, and maybe this is where we should be
looking.
Sorry for the long post, but any general thoughts on which way to proceed, or areas to
investigate much appreciated!
Alfie.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/821954#821954]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]