Skip to content

feat(workflow): add WorkflowListener bridging events → runner#23

Open
mpge wants to merge 1 commit intofeat/workflow-runnerfrom
feat/workflow-listener
Open

feat(workflow): add WorkflowListener bridging events → runner#23
mpge wants to merge 1 commit intofeat/workflow-runnerfrom
feat/workflow-listener

Conversation

@mpge
Copy link
Copy Markdown
Member

@mpge mpge commented Apr 24, 2026

Summary

Final piece of the workflow stack for Spring. The listener subscribes to the existing ApplicationEvent types (TicketEvent, ReplyEvent) and routes each to the canonical workflow trigger name, then delegates to WorkflowRunnerService.runForEvent.

Behavior

  • @Async — a slow workflow never blocks the mutation that fired it
  • Event → trigger mapping matches WorkflowEngine.TRIGGER_EVENTS:
    • CREATEDticket.created
    • UPDATEDticket.updated
    • ASSIGNEDticket.assigned
    • STATUS_CHANGED / CLOSED / RESOLVEDticket.status_changed
    • PRIORITY_CHANGEDticket.priority_changed
    • REOPENEDticket.reopened
    • ReplyEvent.CREATEDreply.created
  • MERGED / SPLIT / SNOOZED / UNSNOOZED / DELETED silently ignored (not in the canonical 12-event set)

Complete chain

With this PR the workflow flow is end-to-end:

TicketService mutation → ApplicationEvent
  → WorkflowListener.onTicketEvent / onReplyEvent
  → WorkflowRunnerService.runForEvent
  → WorkflowEngine (conditions) + WorkflowExecutorService (actions)
  → WorkflowLog audit row

Dependencies

Test plan

  • 12 unit tests covering every event-type → trigger mapping + the ignored cases
  • CI green (won't trigger against stacked base until rebased)

Final piece of the workflow stack (Spring). The listener subscribes
to the existing ApplicationEvent types (TicketEvent, ReplyEvent) and
routes each to the canonical workflow trigger name, then delegates to
WorkflowRunnerService.runForEvent.

- @async so a slow workflow never blocks the mutation that fired it
- MERGED/SPLIT/SNOOZED/DELETED are not surfaced as workflow triggers
  today (not in the canonical 12-event set) — silently ignored

With this commit the chain is complete:
  TicketService mutation → ApplicationEvent → WorkflowListener →
  WorkflowRunnerService → WorkflowEngine (conditions) +
  WorkflowExecutorService (actions) → WorkflowLog audit row
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.

1 participant