Hi trademak,
Thanks for the advice.
Actually instead of using a call activity and sub-process, I finally went with the original receive task. Here's why I did it:
When an error occurs in the external VM process, we do not want the activity to proceed to the next task, but stay on the same task which triggered the external process. Except that we want the same task to remain in an "Error State". In Activiti there is no concept of putting a "task" in an error state (based on what I have read in docs). The ONLY option is to use an "Error End Event" or "Error Boundary Event", which would mean that the state of the task would proceed from the erroneous task to the error event.
Hope the above is clear enough since I think my above description is quite convoluted.
So here's what I ended up with:
1. When the Java receive task starts an external VM process, and the external process ends up in error, I am catching the exception in the external process and then setting process variable indicating an error state and full exception details.
2. Next I signal the receive task and a listener on the "end" event of the task checks for the "error" process variable. The listener, gets the error details from the process variable and logs the error in DB with reference to the "process instance ID". This logging helps me to indicate that a certain process is in Error state and allows us to produce a "report" of processes in error.
3. Next when the external process exceptions are fixed, the external process again sends a new signal to the receive task without "error" process variable and the process proceeds to the next task.
Hope this will be useful to other people who have a similar use case.
trademak thanks again for your help!
Bhushan.