I have number of service tasks which executes in a sequential order. In normal scenario when there are no exceptions in any of the service tasks, on completing all the tasks I can see the steps logged in the database with Process Instance ID, Start Time, End Time etc for each Service Tasks. But when there is an Exception for whatever reason in any of the Service Task. There are no entries in the Database for any of the Service Task which as already completed before the Exception occurred. There is no trace of Process start, completed tasks or failed task. My requirement is to show at which step the Process as stopped executing a service task due to Errors. I have integrated Spring with Activiti and using PostgresSQl DB. Is this something to do with Transaction Manager? Below are my Spring configuration files.
As I remember, all these subsequent service tasks will be handled in a single transaction for performance reasons that's why you don't see in the DB the progress. if you want to demarcate the transactions even more granular then you have to use async flag for your tasks. Probably you need a new transaction for every service in the flow and catch all exception.
Instead of handling the exception, throw it to the function which is calling it. In this way, you get the exception out and you will have its details. I did the same and now I know where exactly the exception has occurred.
I mean if you are using a wrapper in between Activiti and your application, throwing the exception from the wrapper makes more sense. If there is no wrapper, when you get the exception, you can always log it to know where it has occurred.