Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOGITO-9412: Create the serverless-workflow-timeouts-showcase for the Operator Dev Mode #1696

Merged
merged 6 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions serverless-workflow-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<module>serverless-workflow-testing-with-rest-assured</module>
<module>serverless-workflow-timeouts-showcase-embedded</module>
<module>serverless-workflow-timeouts-showcase-extended</module>
<module>serverless-workflow-timeouts-showcase-operator-devmode</module>
</modules>
</profile>

Expand Down Expand Up @@ -134,6 +135,7 @@
<module>serverless-workflow-testing-with-rest-assured</module>
<module>serverless-workflow-timeouts-showcase-embedded</module>
<module>serverless-workflow-timeouts-showcase-extended</module>
<module>serverless-workflow-timeouts-showcase-operator-devmode</module>
</modules>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
id: callback_state_timeouts
version: '1.0'
name: Callback State Timeouts Example
description: Simple process to show the callback state timeout working
start: PrintStartMessage
events:
- name: callbackEvent
source: ''
type: callback_event_type
functions:
- name: systemOut
type: custom
operation: sysout
states:
- name: PrintStartMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
transition: CallbackState
- name: CallbackState
type: callback
action:
name: callbackAction
functionRef:
refName: systemOut
arguments:
message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has executed the callbackFunction.\"}"
eventRef: callbackEvent
transition: CheckEventArrival
timeouts:
eventTimeout: PT30S
- name: CheckEventArrival
type: switch
dataConditions:
- condition: "${ .eventData != null }"
transition: EventArrived
defaultCondition:
transition: EventNotArrived
- name: EventArrived
type: inject
data:
exitMessage: "The callback event has arrived."
transition: PrintExitMessage
- name: EventNotArrived
type: inject
data:
exitMessage: "The callback event has not arrived, and the timeout has overdue."
transition: PrintExitMessage
- name: PrintExitMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has finalized. \" + .exitMessage + \" eventData: \" + .eventData}"
end: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
id: event_state_timeouts
version: "1.0"
name: Event State Timeouts Example
description: Simple process to show the event state timeout working
start: PrintStartMessage
events:
- name: event1
source: ''
type: event1_event_type
- name: event2
source: ''
type: event2_event_type
functions:
- name: systemOut
type: custom
operation: sysout
states:
- name: PrintStartMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"event-state-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
transition: WaitForEvent
- name: WaitForEvent
type: event
onEvents:
- eventRefs: [ event1 ]
eventDataFilter:
data: "${ \"The event1 was received.\" }"
toStateData: "${ .exitMessage }"
actions:
- name: printAfterEvent1
functionRef:
refName: systemOut
arguments:
message: "${\"event-state-timeouts: \" + $WORKFLOW.instanceId + \" executing actions for event1.\"}"
- eventRefs: [ event2 ]
eventDataFilter:
data: "${ \"The event2 was received.\" }"
toStateData: "${ .exitMessage }"
actions:
- name: printAfterEvent2
functionRef:
refName: systemOut
arguments:
message: "${\"event-state-timeouts: \" + $WORKFLOW.instanceId + \" executing actions for event2.\"}"
timeouts:
eventTimeout: PT30S
transition: PrintExitMessage
- name: PrintExitMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"event-state-timeouts: \" + $WORKFLOW.instanceId + \" has finalized. \" + if .exitMessage != null then .exitMessage else \"The event state did not receive any event, and the timeout has overdue\" end }"
end: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
id: switch_state_timeouts
version: "1.0"
name: Switch State Timeouts Example
description: Simple process to show the switch state timeout working
start: PrintStartMessage
events:
- name: visaApprovedEvent
source: ''
type: visa_approved_event_type
- name: visaDeniedEvent
source: ''
type: visa_denied_event_type
functions:
- name: systemOut
type: custom
operation: sysout
states:
- name: PrintStartMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"switch-state-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
transition: ChooseOnEvent
- name: ChooseOnEvent
type: switch
eventConditions:
- eventRef: visaApprovedEvent
transition: ApprovedVisa
- eventRef: visaDeniedEvent
transition: DeniedVisa
defaultCondition:
transition: HandleNoVisaDecision
timeouts:
eventTimeout: PT30S
- name: ApprovedVisa
type: inject
data:
exitMessage: "Your visa was approved."
transition: PrintExitMessage
- name: DeniedVisa
type: inject
data:
exitMessage: "Your visa was denied."
transition: PrintExitMessage
- name: HandleNoVisaDecision
type: inject
data:
exitMessage: "No decision was made. The switch state did not receive any event, and the timeout has overdue."
transition: PrintExitMessage
- name: PrintExitMessage
type: operation
actions:
- name: printSystemOut
functionRef:
refName: systemOut
arguments:
message: "${\"switch-state-timeouts: \" + $WORKFLOW.instanceId + \" has finalized. \" + .exitMessage}"
end: true
Loading