JBoss Community

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

created by Zdenek Hrib in jBPM - View the full discussion

Hi,

 

I usualy have a database oriented application, which stores records, where one field of the record (one column in a row in database) stores something called "state" - eg. record is "new", "revised", "waiting for approval" or "cancelled". The state of the record should change automatically according to changes in other fields of the record - eg. if someone changes a description of a "new" record, it should be changed to "revised" but if amount > 100 than it should go to "waiting for approval" instead. I would like to have some library where I could in case of record update do something like this (pseudo-code):

 

Process process = createProcesFromDefinition("mydefinition.process");

process.setCurrentState(getStateFromDatabase());

process.setOldRecord(getRecordFromDatabase());

process.setNewRecord(getRecordWhichIsToBeSaved());

State state = process.computeResultingState();

storeStateToDatabase(state);

 

I would like to have the process definition in some kind of XML format, and the rules for decision about the resulting transition in MVEL (or something else supported by Drools/JBoss Rules).

 

Is it possible to use jBPM in this way - just as a state machine engine? Could someone point me in the right direction, which classes should I explore in the jBPM API to do this?

 

I have seen some examples, but they always start the process from the beginning - but I would like to "fast forward" the process in some other state, provide some data, and let the engine&rules to choose the next state.

 

Thank you

Reply to this message by going to Community

Start a new discussion in jBPM at Community