Skip to content

feat(flow): emit+listen SWF 1.0 bridge pattern for casehub-work-flow #172

@mdproctor

Description

@mdproctor

Background

The current casehub-work-flow bridge (HumanTaskFlowBridge) wraps WorkItem creation in a Quarkus-Flow Java DSL function task returning a Uni. This works but is Quarkus-specific — it does not use the SWF 1.0 native pattern for async human interaction.

The idiomatic SWF 1.0 pattern for human-in-the-loop is emit + listen:

tasks:
  - requestReview:
      emit:
        event:
          with:
            type: work.item.requested
            data: ${ { title: "IRB Review", candidateGroups: "ethics-committee" } }
  - waitForReview:
      listen:
        to:
          one:
            with:
              type: work.item.completed

CaseHub's WorkItemEventBroadcaster already fires lifecycle events — these could be surfaced as CloudEvents to close the listen loop.

Proposed

  • A CDI observer subscribes to work.item.requested CloudEvents and creates a WorkItem
  • WorkItemLifecycleEvent is published as a CloudEvent (work.item.completed, work.item.rejected, etc.) on the Vert.x event bus / CloudEvents channel
  • The casehub-work-flow module gains an emit+listen example alongside the existing function-based bridge
  • The existing HumanTaskFlowBridge is retained — both patterns are supported

Value

  • Runtime-portable: the emit+listen pattern works with any SWF 1.0 runtime, not just Quarkus-Flow
  • Aligns with how Quarkus-Flow's newsletter example models human review (emitlisten)
  • Makes CaseHub WorkItems first-class SWF citizens rather than a Quarkus-specific extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: MedSome design or unknownsscale: MMulti-class / multi-file

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions