A service task is run asynchronously when user task is completed
I am new to BPM. I have a simple flow consisting of a user task and service task - see attachment. Looks like when complete is called on the task on name="Enter user details", the service task is run asynchronously and I have no way of sending back the outcome of the service task to the client.
The step is as follow: I have REST endpoint which invokes complete user task ( name="Enter user details") Even though an exception is thrown in the service Task "User details Task service", there is no way for the REST endpoint to send back the outcome to the client. I am catching the exception as the service task user and throwing BPMNError, but this doesn't help. What I have also noticed is that the rollback of the current transaction is not happening, such that the execution tracks back to the user task and the user task is still present in the database. The execution moves straight to the next task.
Have you got the right set up? Would it be possible to block at a complete task and query the outcome of the service task? I don't like blocking anywhere in the code, though.
Re: A service task is run asynchronously when user task is completed
Your description in the 2nd paragraph doesn't really align with what you have attached, so I may be a little off in my suggestions - but anyway:
It sounds like you're looking for a way to capture the data that the service task is retrieving or modifying, in order to utilize it within the next step, correct? The Java Service Task and Web Service Task sections of the User Guide both show the jist of how to store the response data of a service task - such that you wouldn't need to block anything to get that information, it would be stored within the process.
Think of a process in terms of a 'context'; within the process, there can be variables and data stored that you can either allow or disallow a task to access and edit. Generally, you'll want to maintain some of those essential bits of data within the process for utilization - so if you map the output of a service into a data object, it will then be accessible within the process.
Rollbacks aren't really a thing in this particular case; Activiti goes about storing all process information, even when a process errors out, is manually cancelled, or breaks for whatever reason. (In general with BPM) The intention is to create an accurate database of all process transactions with the system, especially when things break, in order to track success and metrics of a process.
I don't believe that you have anything setup wrong; just checkout the ways Activiti says to map the output of a service task into process data. If you could expand a little bit on the exception you're getting - that might help too.