Catch Process Engine Errors in Camunda Workflow during execution

In Camunda Workflows, we can catch error or signal events thrown from service tasks with the help of different error or signal events.

Let’s take a scenario like - Workflows are executing on Camunda Process Engine and somehow Process Engine ended with faults or errors. Here, How to catch the process engine faults or errors in workflow ???

The process engine will roll back to the last known wait state and create an incident.
Feel free to watch this video tutorial on error handling to understand more

Thanks for your reply.

Yes process engine will roll back to the last known wait state w.r.to workflow.

But in a workflow, if we have couple of service tasks (java delegate) with business logic implementation and during execution of java delegate… there is process engine faulted and here how to capture the fault in java delegate in middle of business logic ?

This is required to revert the changes done so far w.r.to business logic implementation in java delegate for a service task in workflow.

this is default behavior

Yes but my question is - how to catch process engine fault/error in a java delegate ?

Why would you want to do this?
And what error would you expect the engine to have?

Here, couple of things -

  1. We will write some business logic in java delegate linked with service task in camunda workflow. Lets take a scenario that java delegate execution suddenly stopped in middle due to process engine faults/error. Now, if process engine roll back to the last known wait state then there is no way to identify where exactly it stopped in business logic execution.

  2. Update the user or operations team, if Java delegate module identify the process engine exception to take necessary further steps to roll back or fuzzy logic stuff in business logic

  3. To implement or record the environment faults to act accordingly in business logic implementation

simple question - Is there a way to catch the exception or fault in java delegate when process engine down or errors ?

This feature is implemented in the newest version - you can read about it it on this blog post.

I don’t know what you mean by this

You can do that with an error event, which is detailed in the video i posted a link to earlier.

I think I have an idea what he is talking about - with my solution I think it would help:
I start each of my Delegates like this, by doing this, I can see which delegate executes and what the process businesskey is responsible for the execution (and failure if it happens).

@Override
public void execute(DelegateExecution execution) throws Exception {
log.info("{}", act(execution));

Then in my act method (and just to be fancy I added color to my logs):

public static String act(DelegateExecution act) {
    return ANSI_GREEN + act.getCurrentActivityName() + ANSI_RESET + "|" + ANSI_RED + act.getProcessBusinessKey() + ANSI_RESET + "|";
}

Nothing to do with the reply but here is the color constants I used above.
public static final String ANSI_RESET = “\u001B[0m”;
public static final String ANSI_RED = “\u001B[31m”;
public static final String ANSI_GREEN = “\u001B[32m”;