Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for usage around ancestorElementInstanceKey in modifyProcessInstance #134

Closed
gijun19 opened this issue Apr 16, 2024 · 7 comments
Closed
Assignees

Comments

@gijun19
Copy link

gijun19 commented Apr 16, 2024

SDK Component

This is related to Zeebe. We have an error handler process to retrying task that threw an error.

Expected Behavior

When an error is thrown, we expect that when we call modifyProcessInstance with the process instance key of the failed task, it completes successfully and the task that threw the error is retried successfully.

Current Behavior

We had a case where an task failed within a parallel gateway process instance and the modify process instance call completed successfully but we saw no task get retriggered.

We had a case in a normal step where the following error was thrown.

Expected to modify process instance but no process instance found with key '6755399460000502`

Possible Solution

Judging by how its behaving differently in certain scenarios I have to believe its due to a configuration issue? At first glance it seems like ancestorElementInstanceKey is something we need to tweak on a case by case, but I'm struggling to find docuemntation around this and what exactly an

Steps to Reproduce

  1. Task errors out and output variable is passed to Error Handler process
  2. Error handler task runs and calls modify process instance task
await zbc.modifyProcessInstance({
    processInstanceKey, 
    activateInstructions: [
        {
            variableInstructions: [],
            elementId,
            ancestorElementInstanceKey: '-1',
        },
    ],
});

Context (Environment)

Documentation around these parameters being passed would prove useful to developers that are trying to adopt Camunda. It would be useful to be able to process errored tasks as expected per the documentation.

@jwulf jwulf self-assigned this Apr 16, 2024
@jwulf
Copy link
Member

jwulf commented Apr 16, 2024

Thanks for using the SDK and the feedback.

Any chance of a minimal reproducer repo that I can work with that demonstrates this issue?

@jwulf
Copy link
Member

jwulf commented Apr 16, 2024

This is the integration test for ModifyProcessInstance:

Does that help you at all?

@gijun19
Copy link
Author

gijun19 commented Apr 17, 2024

Hi @jwulf, thanks for getting back to me. The unit test uses ancestorElementInstanceKey with a value of -1. I guess the question here would be how do we use this property field? I'm not sure how we're supposed to configure ancestorElementInstanceKey on the fly so we can properly determine the scope in which the new element instance is created. I'm assuming this property needs to be tweaked based on where the process instance lives in the process hierarchy?

Here's a scenario, what is the difference between if i do -1 vs 0 for example? Or 1 vs -1?

In regards to a small reproducable repo it's kind of difficult. We use the SDK for my company github repos and those are private and can't be shared.

@jwulf
Copy link
Member

jwulf commented Apr 26, 2024

The ancestorElementInstanceKey is going to be either -1 or some element instance key, which will be a uid.

The grpc protocol doc comment is:

	/**
	 * the key of the ancestor scope the element instance should be created in;
	 * set to -1 to create the new element instance within an existing element
	 * instance of the flow scope
	 */

@jwulf
Copy link
Member

jwulf commented Apr 26, 2024

This documentation from Camunda 7 may help understand the conceptual design of the feature, because it will follow the Camunda 7 ideas in principle:

https://docs.camunda.org/manual/7.21/user-guide/process-engine/process-instance-modification/#ancestor-selection-for-instantiation

If you could give me a minimal reproducer that would help - like you create the most simple model the demonstrates the scenario, in a repo with some code that attempts to do the process modification, then we could work together on that.

@jwulf
Copy link
Member

jwulf commented May 3, 2024

Hi @gijun19, how are you going with this? Did you solve this?

@jwulf jwulf closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants