martinweiler opened a new pull request, #7276: URL: https://github.com/apache/incubator-kie/pull/7276
Closes: https://github.com/apache/incubator-kie/issues/7275 Node events (`ENTER`, `EXIT`, `ABORTED`, etc.) of nodes that complete synchronously inside their trigger carry the same timestamp, even when the node took a long time to execute. For a process with a `Rest` work item node whose endpoint takes 20 seconds to respond, the script logs show the correct times: ``` 15:43:17 - Rest1 started 15:43:37 - Rest1 exit ``` However, the data-audit log shows both events at the same time: ``` "2026-11-06 15:43:37.424" "ENTER" ... "Rest1" "WorkItemNode" "2026-11-06 15:43:37.424" "EXIT" ... "Rest1" "WorkItemNode" ``` **Root cause** - `UnitOfWorkProcessEventListener` records node events in `afterNodeTriggered` and `afterNodeLeft`. For `ENTER`, that happens only after `internalTrigger(...)` returns. - `AbstractDataEventAdapter.toProcessInstanceNodeEvent(...)` stamps the event body `eventDate` with `new Date()`. - It does not set the CloudEvent `time`, so `AbstractDataEvent` defaults it to `now()` when the event is built. - `JPADataAuditStore` persists `event.getTime()` as the event date. - For `WorkItemNodeInstance`, the handler runs inline and blocks inside `internalTrigger`. The `ENTER` event is therefore converted after the node has finished, at the same moment as `EXIT`. - Wait states such as timers and user tasks return from `internalTrigger` almost immediately, so they are not visibly affected. **Proposed fix:** in `AbstractDataEventAdapter`, take the timestamp from the node instance. `ENTER` uses `getTriggerTime()`. Exit-type events (`EXIT`, `ABORTED`, `SKIPPED`, `OBSOLETE`, `ERROR`) use `getLeaveTime()`. It falls back to `new Date()` when those are unavailable and for `UPDATED`. The same value is set on both the body `eventDate` and the CloudEvent `time`. A unit test, `NodeEventDateTest`, is included. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
