Skip to content

add workflow system event listener demo#1037

Open
ivy-lgi wants to merge 3 commits intorelease/12.0from
system-events-demo
Open

add workflow system event listener demo#1037
ivy-lgi wants to merge 3 commits intorelease/12.0from
system-events-demo

Conversation

@ivy-lgi
Copy link
Copy Markdown
Member

@ivy-lgi ivy-lgi commented Mar 24, 2026

I can also give you a live demo if you wish 😉

workflow-system-event-demo

@ivy-lgi ivy-lgi force-pushed the system-events-demo branch from b4f09e6 to 43e1ad7 Compare March 24, 2026 06:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 24, 2026

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 3441ba7. ± Comparison against base commit 828c402.

♻️ This comment has been updated with latest results.

@ivy-lgi ivy-lgi force-pushed the system-events-demo branch from 43e1ad7 to 35fa7f3 Compare March 24, 2026 07:08
@ivy-lgi ivy-lgi marked this pull request as ready for review March 24, 2026 07:18
@ivy-lgi ivy-lgi requested a review from Copilot March 24, 2026 07:19
@ivy-lgi
Copy link
Copy Markdown
Member Author

ivy-lgi commented Mar 24, 2026

This demo shows how workflow system events can trigger processes. For that, a ProcessStartEventBean has been implemented that can be used with a program start element (see WorkflowSystemEventListenerBean). The bean triggers the process whenever the configured event is detected.

In this example, the processes execute logic when

  • a new task has been assigned (has activator)
  • a task has been delegated (activator has changed)

Of course, any custom logic can be implemented to react to workflow system events.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new workflow demo that starts processes in response to workflow system events (task/case created/changed), including a reusable ProcessStartEventBean and a corresponding example process with test coverage.

Changes:

  • Introduce WorkflowSystemEventListenerBean (a ProcessStartEventBean) that registers an ISystemEventListener for workflow system events and starts a process on matching events.
  • Add a new demo process model + dataclass to showcase reacting to task created/changed events and executing follow-up logic.
  • Add a new BPM test for the demo and adjust a few existing tests / CI Maven args.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
workflow/workflow-demos/src/ch/ivyteam/ivy/system/event/WorkflowSystemEventListenerBean.java New start-event bean that registers/unregisters a workflow system event listener and starts a process with event parameters.
workflow/workflow-demos/processes/WorkflowSystemEvent/WorkflowSystemEventListeners.p.json New demo process wiring program-starts to workflow events and scripts that filter/act on task IDs.
workflow/workflow-demos/dataclasses/WorkflowSystemEvent/WorkflowSystemEventListenersData.d.json Data class for passing workflow system event parameters + collected task IDs through the demo process.
workflow/workflow-demos-test/src_test/test/bpm/TestWorkflowSystemEventListeners.java New automated test asserting executions triggered by workflow system events.
workflow/workflow-demos-test/src_test/test/bpm/TestProcurementRequestUserTask.java Formatting changes + adjust how end data is retrieved from executed task.
workflow/workflow-demos-test/src_test/test/bpm/TestProcurementRequest.java Formatting changes + adjust how end data is retrieved from executed task.
workflow/workflow-demos-test/src_test/test/bpm/TestBusinessCaseDataWorkflow.java Test assertion relaxed from strict element sequence to presence-based checks.
.github/workflows/ci.yml Add Maven property to use latest engine minor version (tests still skipped in GitHub CI).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ivy-cst
Copy link
Copy Markdown
Member

ivy-cst commented Mar 24, 2026

I can also give you a live demo if you wish 😉

Could you show it to us after the daily tomorrow? I think others are interested in this too.

Copy link
Copy Markdown
Member

@weissreto weissreto left a comment

Choose a reason for hiding this comment

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

Looks good

@ivy-lgi
Copy link
Copy Markdown
Member Author

ivy-lgi commented Mar 25, 2026

@weissreto Regarding using compareAndSet in the "Activator has changed" logic as suggested in person, I don't think it really works. compareAndSet requires an expectedValue, where the new value is set if the current value is equal to the expectedValue.
However, in this case, I don't know and don't care what the previous value is. I want to set the value if it is different to the new value.

…SystemEventListeners.p.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ivy-lgi ivy-lgi force-pushed the system-events-demo branch from e020a31 to d805c54 Compare March 25, 2026 09:47
@weissreto
Copy link
Copy Markdown
Member

@weissreto Regarding using compareAndSet in the "Activator has changed" logic as suggested in person, I don't think it really works. compareAndSet requires an expectedValue, where the new value is set if the current value is equal to the expectedValue. However, in this case, I don't know and don't care what the previous value is. I want to set the value if it is different to the new value.

As discussed on the desc
You could do something like this:

var existingValue = customField.getOrNull();
if (customField.compareAndSet(exsistingValue, newValue)) {
   in.taskIds.add(id);
}

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.

4 participants