-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRunFlow.xtend
More file actions
45 lines (34 loc) · 1.29 KB
/
RunFlow.xtend
File metadata and controls
45 lines (34 loc) · 1.29 KB
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
package de.grammarcraft.xtend.annotatedflow
import static de.grammarcraft.xtend.flow.IntegrationErrorHandling.*
class RunFlow {
def static void main(String[] args) {
// build
println("instantiate flow units...")
val reverse = new Reverse
val normalizer = new Normalize
val collector = new Collector(", ")
val notConnectedFunctionUnit = new Reverse
// bind
println("bind them...")
reverse -> normalizer
normalizer.lower -> collector.lower
normalizer.upper -> collector.upper
collector.output -> [ msg |
println("received '" + msg + "' from " + collector)
]
collector.error -> [ errMsg |
println('error received: ' + errMsg)
]
onIntegrationErrorAt(#[reverse, collector, notConnectedFunctionUnit]) [
exception | println("integration error happened: " + exception.message)
]
// run
println("run them...")
val palindrom = "Trug Tim eine so helle Hose nie mit Gurt?"
println("send message: " + palindrom)
reverse <= palindrom
reverse <= palindrom // second call should raise an error message on the Collectors error port
notConnectedFunctionUnit <= palindrom // should raise an integration error as function unit is not connected to any one
println("finished.")
}
}