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

Add DecisionInstanceID to API response for evaluating a DRD #2749

Open
2 tasks
ThorbenLindhauer opened this issue Apr 26, 2022 · 5 comments
Open
2 tasks

Add DecisionInstanceID to API response for evaluating a DRD #2749

ThorbenLindhauer opened this issue Apr 26, 2022 · 5 comments
Assignees
Labels
scope:core-api Changes to the core API: engine, dmn-engine, feel-engine, REST API, OpenAPI type:feature Issues that add a new user feature to the project.

Comments

@ThorbenLindhauer
Copy link
Member

ThorbenLindhauer commented Apr 26, 2022

This issue was imported from JIRA:

Field Value
JIRA Link CAM-14608
Reporter @toco-cam
Has restricted visibility comments true

User Story (Required on creation):

As a Software Developer, I want to see the instance ID of a DRD when executing it as a standalone DRD. This allows me to evaluate a DRD independent of a process with a processID as reference.

Functional Requirements (Required before implementation):

Technical Requirements (Required before implementation):

Limitations of Scope (Optional):

Hints (optional):

Discussion and a solution for Java from Bernd - <Retrieving decision instance id - Camunda Platform 7 Process Engine - Camunda Platform Forum>(https://forum.camunda.io/t/retrieving-decision-instance-id/6039/3)

Links:

Pull requests

Preview Give feedback
  1. kmannuru
  2. ci:default-build ci:h2 ci:migration ci:rest-api ci:rolling-update ci:spring-boot ci:webapp-integration
    yanavasileva
@kmannuru
Copy link

kmannuru commented Feb 9, 2024

I'm working on this requirement. Can someone please help assign the issue to me.

Goal for the request

Update Evaludate Decision API to include decisionInsanceId in the response.
Current API that evaluates DMN decision : POST /decision-definition/key/{aKey}/evaluate
Current Response:
image

Proposed Solution

Add decisionInsanceId as the response parameter

Current api evaluates decision from ACT_RU_DECISION_DEF table for a specific key.
So we will have to join ACT_HI_DECINST table on DEC_DEF_ID_ column to get the decisionInstanceId and include in the api response.

Links
https://forum.camunda.io/t/retrieving-decision-instance-id/6039/11

@HarishMalavade
Copy link
Contributor

HarishMalavade commented Feb 23, 2024

@kmannuru based on the current logic it may not be just id_ retrieval from ACT_HI_DECINST table because the history events are published post evaluation and persisted on the listener which is when the decision instance id gets generated.
We may need to generate the id before the events are fired along with other attributes like decision def id, definition key etc. then we can return the same id as part of evaluationResult which will ensure the decision instance id can be used to track history of what was evaluated through API as required
@ThorbenLindhauer @yanavasileva interested in your perspective on this

@yanavasileva
Copy link
Member

Hi @kmannuru,

I'm working on this requirement. Can someone please help assign the issue to me.

Thank you for your interest in working on this. The tickets are being process by the team and assigned to team members only, no need for an action here . When you are ready raise a PR, put the ticket number to the description. A team member will pick up the PR for a review.

Current api evaluates decision from ACT_RU_DECISION_DEF table for a specific key.
So we will have to join ACT_HI_DECINST table on DEC_DEF_ID_ column to get the decisionInstanceId and include in the api response.

I dig into the code and I don't think this is a good idea.

@HarishMalavade is on the right track:

the history events are published post evaluation and persisted on the listener which is when the decision instance id gets generated.

Let me know if you need details about the above but I also encorage you to clone the repository and try it out yourself.
Further:

We may need to generate the id before the events are fired

On top of my head, I don't think it's a good idea, the id is the primary key in ACT_HI_DECINST so it's get assigned automatically during the persistence. I can't remember if we do such thing anywhere else.

Other thing to keep in mind is we are talking about history, an option exist that this history is not persisted. (ACT_HI_DECINST is not populated when history level is different from full. ACT_RU_DECISION_DEF is a runtime table.)

At the moment, it's not clear (even after reading the complete forum post), the complete use case where/when the decision instance id will be used after retrieving it. Nevertheless, I imagine without breaking the current design of DMN evaluation and data persistence, the HistoryDecisionEvaluationListener can be extended to log/track the id, similar to the suggestion that Bernd made in the forum post.

Here is reference to the relevant classes if you want to have a look:

Best,
Yana

@kmannuru
Copy link

Thanks Yana for your feedback. I'll work on the changes and share the draft PR for your review. Thank you.

@kmannuru
Copy link

kmannuru commented Mar 21, 2024

@yanavasileva I've raised the PR to fix the issue. Please help with the PR review : #4197

@yanavasileva yanavasileva self-assigned this Mar 22, 2024
@yanavasileva yanavasileva added the scope:core-api Changes to the core API: engine, dmn-engine, feel-engine, REST API, OpenAPI label Mar 25, 2024
@yanavasileva yanavasileva removed their assignment May 22, 2024
@yanavasileva yanavasileva self-assigned this May 29, 2024
@yanavasileva yanavasileva removed their assignment Jul 15, 2024
@yanavasileva yanavasileva self-assigned this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:core-api Changes to the core API: engine, dmn-engine, feel-engine, REST API, OpenAPI type:feature Issues that add a new user feature to the project.
Projects
None yet
Development

No branches or pull requests

4 participants