Skip to content

Confused about the workflow context with fork task #1146

@NguyenThiHanhVi-future-aavn

Description

During using the sdk-java I see the confusions when run the fork task
Here is my workflow dsl

- parallelEnrichment:
      input:
        from: ${ $context.order }
      fork:
        compete: true
        branches:
          - pricingEnrichment:
              input:
                from: ${ . }
              set:
                subtotal: ${ .amount }
                tax: 20.00
                total: ${ .amount + 20.00 }
              output:
                as: '${ $input + { "pricing": $output } }'
              export:
                as: '${ $context + { "pricing": $output } }'
          - customerEnrichment:
              input:
                from: ${ .customer }
              set:
                loyaltyTier: "gold"
                discountPct: 5
              output:
                as: '${ $input + { "profile": $output } }'
              export:
                as: '${ $context + { "customer": $output } }'
          - riskAssessment:
              input:
                from: ${ . }
              set:
                riskScore: 12
                riskBand: "low"
              output:
                as: '${ $input + { "risk": $output } }'
              export:
                as: '${ $context + { "risk": $output } }'
  1. with compete = false
    The workflow output is the combined output from all branches. How about the context of fork task, it is always the context from last updated branch or also the combined context from all branches?

  2. with compete = true
    When first complete branch completed and trigger complete to fork task (state COMPLETED) then the other branch get FAULTED, is fork task status be influented by the failed result or still keep COMPLETED?

  3. also with compete = true
    Both the fork output and context depend on the 'compete' mode or only the output.
    Take my workflow dsl as an example in compete mode, the branch 'customerEnrichment' is first completed branch and the 'riskAssessment' branch is the last completed branch, so that the output and the context of the parent (fork task) should be get from 'customerEnrichment' or the output from 'customerEnrichment' but the context from 'riskAssessment'?

Please help to confirm what should I follow.
Thanks for your support.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions