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

[incubator-kie-issues-1550] Add Transaction error handling when transaction is enabled #3740

Merged
merged 18 commits into from
Nov 1, 2024

Conversation

elguardian
Copy link
Contributor

@@ -293,6 +295,9 @@ protected Collection<GeneratedFile> internalGenerate() {

// first we generate all the data classes from variable declarations
for (WorkflowProcess workFlowProcess : processes.values()) {
if (isTransactionEnabled(this, context())) {
((WorkflowProcessImpl) workFlowProcess).setMetaData(WorkflowProcessParameters.WORKFLOW_PARAM_TRANSACTIONS.getName(), "true");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't something similar be needed for WORKFLOW_PARAM_MULTIPLE_CONNECTIONS to read the property from applications.properties and set it in the process metadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately we set the transaction in global application.properties and not in the bpmn.

@apache apache deleted a comment from kie-ci3 Oct 22, 2024
@elguardian elguardian force-pushed the incubator-kie-issues-1550 branch from 087abc7 to 4ddf47b Compare October 29, 2024 15:36
@apache apache deleted a comment from kie-ci3 Oct 29, 2024
@apache apache deleted a comment from kie-ci3 Oct 30, 2024
@apache apache deleted a comment from kie-ci3 Oct 30, 2024
@apache apache deleted a comment from kie-ci3 Oct 30, 2024
@apache apache deleted a comment from kie-ci3 Oct 30, 2024
@apache apache deleted a comment from kie-ci3 Oct 30, 2024
@apache apache deleted a comment from kie-ci3 Oct 31, 2024
Copy link
Contributor

@martinweiler martinweiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elguardian great work!

I tested the change with a script node that performs a failing operation (divison by zero), here are my results:

  1. kogito.transactionEnabled=false
  • Process halted in the executed node
  • Process state: ERROR
  • Logs:
2024-10-31 13:34:52,270 mweiler-ibm-com ERROR [org.jbpm.workflow.instance.impl.NodeInstanceImpl:255] (executor-thread-1) Node instance causing process instance error in id a802b3fe-f080-4f63-a843-4baed7e257a5 in a non transactional environment
2024-10-31 13:34:52,271 mweiler-ibm-com ERROR [org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl:1184] (executor-thread-1) Unexpected error while executing node added node in process instance d202e0e2-6e5d-4f9a-bfff-8dd0c7eb0d33: org.jbpm.workflow.instance.WorkflowRuntimeException: [modified:d202e0e2-6e5d-4f9a-bfff-8dd0c7eb0d33 - added node:[uuid=_10B17284-9CB6-4B80-9BE0-EE862F9E7178]] -- / by zero
	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:289)
	at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:61)
  1. kogito.transactionEnabled=true
  • Process halted in the last persisted state
  • Process state: ACTIVE
  • Logs:
2024-10-31 13:31:46,798 mweiler-ibm-com ERROR [org.jbpm.workflow.instance.impl.NodeInstanceImpl:259] (executor-thread-1) Node instance causing process instance error in id 0cc1d0fc-6cc3-49b5-9d40-10d5ab20b945 in a transactional environment (Wrapping)

I think the error handling works as expected.

The only thing that could be improved is that the ERROR message raised in the tx scenario does not contain the original error, nor the stacktrace.

@porcelli porcelli merged commit 912c470 into apache:main Nov 1, 2024
5 of 6 checks passed
rgdoliveira pushed a commit to rgdoliveira/kogito-runtimes that referenced this pull request Nov 7, 2024
…action is enabled (apache#3740)

* [incubator-kie-issues-1550] Add Transaction error handling when transaction is enabled

* ProcessGenerationIT fix tests

* clean up exception handling

* add exception handler

* handlers creation for spring boot and quarkus

* fix throwable

* fix compilation errors

* fix ProcessGenerationIT

* fix java standalone no tx

* fix quarkus exceptions handling

* ProcessResourceGeneratorTest fix

* fix resources

* fix quarkus error handling

* fix spring boot unitof work

* fix transactions templates

* fix template class name

* fix

* fix composed messages based on the exceptions processed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Transaction error handling when transaction is enabled
3 participants