Created
April 15, 2021 18:20
-
-
Save ricardozanini/c4d40b77b4e827b8ecb88de97c533e06 to your computer and use it in GitHub Desktop.
Kogito Serverless Workflow Order Processing Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id: fraudhandling | |
name: Fraud Handling | |
start: FraudHandling | |
version: "1.0" | |
events: | |
- kind: produced | |
name: FraudEvaluation | |
type: orders.fraudEvaluation | |
source: fraudEvaluation | |
states: | |
- name: FraudHandling | |
type: switch | |
dataConditions: | |
- condition: "{{ $.[?(@.total > 1000)] }}" | |
transition: FraudVerificationNeeded | |
- condition: "{{ $.[?(@.total <= 1000)] }}" | |
end: true | |
- name: FraudVerificationNeeded | |
type: inject | |
data: | |
fraudEvaluation: true | |
end: | |
produceEvents: | |
- eventRef: FraudEvaluation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Order Workflow | |
id: orderworkflow | |
version: "1.0" | |
description: Workflow for processing Orders and produce Logistics Events | |
start: ReceiveOrder | |
events: | |
- kind: consumed | |
name: OrderEvent | |
type: orderEvent | |
source: orderEvent | |
states: | |
- name: ReceiveOrder | |
type: event | |
onEvents: | |
- eventRefs: | |
- "OrderEvent" | |
transition: ProcessOrder | |
- name: ProcessOrder | |
type: parallel | |
branches: | |
- name: HandleFraudEvaluation | |
workflowId: fraudhandling | |
- name: HandleShippingType | |
workflowId: shippinghandling | |
completionType: and | |
end: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id: shippinghandling | |
name: Shipping Handling | |
start: ShippingHandling | |
version: "1.0" | |
events: | |
- kind: produced | |
name: InternationalShippingOrder | |
type: internationalShipping | |
source: internationalShipping | |
- kind: produced | |
name: DomesticShippingOrder | |
type: domesticShipping | |
source: domesticShipping | |
states: | |
- name: ShippingHandling | |
type: switch | |
dataConditions: | |
- condition: "{{ $.[?(@.country == 'US')] }}" | |
transition: DomesticShipping | |
- condition: "{{ $.[?(@.country != 'US')] }}" | |
transition: InternationalShipping | |
- name: DomesticShipping | |
type: inject | |
data: | |
shipping: "domestic" | |
end: | |
produceEvents: | |
- eventRef: DomesticShippingOrder | |
- name: InternationalShipping | |
type: inject | |
data: | |
shipping: "international" | |
end: | |
produceEvents: | |
- eventRef: "InternationalShippingOrder" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment