JBoss Community

Re: Using jBPM as state machine engine - is it a good idea?

created by Zdenek Hrib in jBPM - View the full discussion

Well maybe I got it all wrong so I start with a bit of context ... I understand that the main focus of jBPM is to coordinate a business process covering several B2B interactions with several systems (notifying the external system and also being notified by the external system) and also including some direct human tasks (click the button to approve, etc ...). But I would like to do something different - I would like to use jBPM inside just one system and use it to manage the state transition logic for my records (to make it even more simple it is just a single type of record stored in one table in the database). I would like to use the decision points driven by rules after each record update, but possibly in the future I would like to extend the process definition (state diagram of the record) with some notifications or some other automated tasks in case of some transitions - all of that using the nice tooling of jBPM :-)

 

In this case the state of the process/record is represented by the values of the record fields. One of the fields is called "state" and this is the name of the current state of the record. So this is basically the persistence schema of my process runtime. But the jBPM has its own schema as shown on http://docs.jboss.org/jbpm/v5.3/userguide/ch.core-persistence.html#d0e3334

I do not want the process runtime state to be stored on two separate locations. I would like the jBPM to use my existing process runtime state storage, which is represented by my table in the database. This table should replace the ProcessInstanceInfo table in the jBPM database schema. If I look at the specific fields of the ProcessInstanceInfo table:

 

instanceid - I got primary key in the table already

lastmodificationdate - I got that lastModifiedDate in the table already

lastreaddate - this should be easy to add

processid - all the records are processed by the same process definition so this could be set somewhere else for the whole table

processinstancebytearray - instead of this BLOB I would like to use the values the fields (columns) of the record (database table row)

startdate - this looks like the date, when the row was inserted/created

state - I got this field in the database already

optlock - this should be easy to add

 

It looks to me like I would have to implement something like my own variant of JPAKnowledgeService to use my database table with my columns instead of the original jBPM ProcessInstanceInfo table. This is what I ment by "custom persistence module" in the earlier post. Also I would have to somehow configure the jBPM engine to use this MyOwnKnowledgeService instead of the original jBPM JPAKnowledgeService.

Reply to this message by going to Community

Start a new discussion in jBPM at Community