Hi,
I have the below code where some value is saved in camunda execution as a process variable input-work-request
and then a service call is made. If service call is successful then I can see the process variable in camunda cockpit but if the service call fails then I can see only the process variables “employee-details”, “salary-details” but not “input-work-request”. Why?
public class StartWorkDelegate implements JavaDelegate {
private final CreateWorkService createWorkService;
@Override
public void execute(final DelegateExecution execution) {
final var employeeDetails = (EmployeeDetails) execution.getVariable("employee-details");
final var salaryDetails = (SalaryDetails) execution.getVariable("salary-details");
final var workRequest = createWorkRequest(employeeDetails, salaryDetails);
execution.setVariable("input-work-request", workRequest);
final var response = createWorkService.createWork(workRequest); //this call will fail. then "input-work-request" is not available in camunda cockpit
execution.setVariable("response-id", response.getId());
}
When the service call is made using createWorkService
then an error is generated. Camunda retries the code for 2 more times and then displays the error in camunda cockpit. But when the incident is generated in camunda cockpit then the process variable “input-work-request” is not available.
If I comment out the service call i.e there is no error then the process variable is displayed in the camunda cockpit. How do I make sure that “input-work-request” camunda variable is available in cockpit incase the service call fails?