Skip to content

Commit fa90b6d

Browse files
committed
Added new examples
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent c4f3053 commit fa90b6d

13 files changed

+200
-1
lines changed

examples/call-custom-function.yaml renamed to examples/call-custom-function-cataloged.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
document:
22
dsl: '1.0.0'
33
namespace: samples
4-
name: call-custom-function
4+
name: call-custom-function-cataloged
55
version: '1.0.0'
66
do:
77
- log:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
document:
2+
dsl: '1.0.0'
3+
namespace: samples
4+
name: call-custom-function-inline
5+
version: '1.0.0'
6+
use:
7+
functions:
8+
getPetById:
9+
input:
10+
schema:
11+
document:
12+
type: object
13+
properties:
14+
petId:
15+
type: string
16+
required: [ petId ]
17+
call: http
18+
with:
19+
method: get
20+
endpoint: https://petstore.swagger.io/v2/pet/{petId}
21+
do:
22+
- getPet:
23+
call: getPetById
24+
with:
25+
petId: 69

examples/emit.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: emit
5+
version: '0.1.0'
6+
do:
7+
- emitEvent:
8+
emit:
9+
event:
10+
with:
11+
source: https://petstore.com
12+
type: com.petstore.order.placed.v1
13+
data:
14+
client:
15+
firstName: Cruella
16+
lastName: de Vil
17+
items:
18+
- breed: dalmatian
19+
quantity: 101

examples/for.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: for-example
5+
version: '0.1.0'
6+
do:
7+
- checkup:
8+
for:
9+
each: pet
10+
in: .pets
11+
at: index
12+
while: .vet != null
13+
do:
14+
- waitForCheckup:
15+
listen:
16+
to:
17+
one:
18+
with:
19+
type: com.fake.petclinic.pets.checkup.completed.v2
20+
output:
21+
as: '.pets + [{ "id": $pet.id }]'

examples/fork.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: fork-example
5+
version: '0.1.0'
6+
do:
7+
- raiseAlarm:
8+
fork:
9+
compete: true
10+
branches:
11+
- callNurse:
12+
call: http
13+
with:
14+
method: put
15+
endpoint: https://fake-hospital.com/api/v3/alert/nurses
16+
body:
17+
patientId: ${ .patient.fullName }
18+
room: ${ .room.number }
19+
- callDoctor:
20+
call: http
21+
with:
22+
method: put
23+
endpoint: https://fake-hospital.com/api/v3/alert/doctor
24+
body:
25+
patientId: ${ .patient.fullName }
26+
room: ${ .room.number }

examples/listen-to-all.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-all
5+
version: '0.1.0'
6+
do:
7+
- callDoctor:
8+
listen:
9+
to:
10+
all:
11+
- with:
12+
type: com.fake-hospital.vitals.measurements.temperature
13+
data: ${ .temperature > 38 }
14+
- with:
15+
type: com.fake-hospital.vitals.measurements.bpm
16+
data: ${ .bpm < 60 or .bpm > 100 }

examples/listen-to-any.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-any
5+
version: '0.1.0'
6+
do:
7+
- callDoctor:
8+
listen:
9+
to:
10+
any:
11+
- with:
12+
type: com.fake-hospital.vitals.measurements.temperature
13+
data: ${ .temperature > 38 }
14+
- with:
15+
type: com.fake-hospital.vitals.measurements.bpm
16+
data: ${ .bpm < 60 or .bpm > 100 }

examples/listen-to-one.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-one
5+
version: '0.1.0'
6+
do:
7+
- waitForStartup:
8+
listen:
9+
to:
10+
one:
11+
with:
12+
type: com.virtual-wf-powered-race.events.race.started.v1
13+
- startup:
14+
call: http
15+
with:
16+
method: post
17+
endpoint:
18+
uri: https://virtual-wf-powered-race.com/api/v4/cars/{carId}/start

examples/raise.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: raise-not-implemented
5+
version: '0.1.0'
6+
do:
7+
- notImplemented:
8+
raise:
9+
error:
10+
type: https://serverlessworkflow.io/errors/not-implemented
11+
status: 500
12+
title: Not Implemented
13+
detail: "The workflow '\($workflow.definition.document.name):\($workflow.definition.document.version)' is a work in progress and cannot be run yet"

examples/run-subflow.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: run-subflow
5+
version: '0.1.0'
6+
do:
7+
- registerCustomer:
8+
run:
9+
workflow:
10+
namespace: test
11+
name: register-customer
12+
version: '0.1.0'
13+
input:
14+
customer: .user

0 commit comments

Comments
 (0)