forked from serverlessworkflow/specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinuing-as-a-new-execution.sw.json
70 lines (70 loc) · 1.35 KB
/
continuing-as-a-new-execution.sw.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
"id":"notifycustomerworkflow",
"name":"Notify Customer",
"version":"1.0.0",
"specVersion": "0.8",
"start":"WaitForCustomerEvent",
"states":[
{
"name":"WaitForCustomerEvent",
"type":"event",
"onEvents":[
{
"eventRefs":[
"CustomerEvent"
],
"eventDataFilter":{
"data":"${ .customerId }",
"toStateData":"${ .eventCustomerId }"
},
"actions":[
{
"functionRef":{
"refName":"NotifyCustomerFunction",
"arguments":{
"customerId":"${ .eventCustomerId }"
}
}
}
]
}
],
"stateDataFilter":{
"output":"${ .count = .count + 1 }"
},
"transition":"CheckEventQuota"
},
{
"name":"CheckEventQuota",
"type":"switch",
"dataConditions":[
{
"condition":"${ try(.customerCount) != null and .customerCount > .quota.maxConsumedEvents }",
"end":{
"continueAs": {
"workflowId": "notifycustomerworkflow",
"version": "1.0",
"data": "${ del(.customerCount) }"
}
}
}
],
"defaultCondition":{
"transition":"WaitForCustomerEvent"
}
}
],
"events":[
{
"name":"CustomerEvent",
"type":"org.events.customerEvent",
"source":"customerSource"
}
],
"functions":[
{
"name":"NotifyCustomerFunction",
"operation":"http://myapis.org/customerapis.json#notifyCustomer"
}
]
}