-
Notifications
You must be signed in to change notification settings - Fork 213
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
Conversation
@@ -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"); | |||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
087abc7
to
4ddf47b
Compare
There was a problem hiding this 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:
- 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)
- 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.
…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
Closes: apache/incubator-kie-issues#1550