[jboss-dev-forums] [Design of JBoss jBPM] - Re: Failure handling
tom.baeyens@jboss.com
do-not-reply at jboss.com
Thu Aug 2 04:10:41 EDT 2007
i think you already got the first part, but i'll reformulate to build up the complete response.
whenever an exception comes out of a process execution, the process instance can be in an invalid state. so you (read: the client) *must* rollback your transaction.
every exception that is thrown into the engine, comes back out at the client side (usually wrapped in a JbpmException)
exception handlers only can 'overwrite' exceptions that occur in user code and cause the process execution to continue even when an exception occurred.
in case you want to rollback the workflow transaction and do something else, there is only one option: you start a new transaction as indicated before in this thread. but note that it is not a good idea to start working on the process execution directly in this thread. as the failing transaction will probably still have database locks on the process execution rows. therefor, i think the best way to handle this is by sending a new command as a job over the async messaging queue to the job executor. the command will do what you want to do (set variables as bill mentioned or take a 'failure' transition,...) in yet another (3rd) transaction.
in jee, you might want to send the command job in the afterCompletion of a synchronization. in that case, you're sure that the database locks of the failing transaction are released when the async job executor executes the 3rd transaction with the fail-action.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069967#4069967
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069967
More information about the jboss-dev-forums
mailing list