-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path15-example-pipeline-linking.yaml
More file actions
66 lines (58 loc) · 1.98 KB
/
Copy path15-example-pipeline-linking.yaml
File metadata and controls
66 lines (58 loc) · 1.98 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# $schema: https://axual.github.io/ksml/latest/ksml-language-spec.json
# This example shows how to read from four simple streams and log all messages
streams:
sensor_source_avro:
topic: ksml_sensordata_avro
keyType: string
valueType: avro:SensorData
offsetResetPolicy: latest
functions:
# Log the message using the built-in log variable that is passed in from Java
log_message:
type: forEach
parameters:
- name: pipeline
type: string
code: log.info("Consumed {} message - key={}, value={}", pipeline, key, value)
pipelines:
# Every pipeline logs its own message and then ends by naming the pipeline for further processing using the "as"
# operation to terminate the pipeline
first:
# Use stream defined above as input
from: sensor_source_avro
via:
- type: peek
forEach:
code: log_message(key, value, pipeline="FIRST")
# Close the pipeline by saving its output under a self-defined name
as: first_pipeline_result
second:
# Use the result from the first pipeline as input
from: first_pipeline_result
via:
- type: peek
forEach:
code: log_message(key, value, pipeline="SECOND")
# Close the pipeline by saving its output under a self-defined name
as: second_pipeline_result
third:
# Use the result from the second pipeline as input
from: second_pipeline_result
via:
- type: peek
forEach:
code: log_message(key, value, pipeline="THIRD")
# Close the pipeline implicitly by saving its output under the pipeline's own name
fourth:
# Use the result from the third pipeline as input
from: third
via:
- type: peek
forEach:
code: log_message(key, value, pipeline="FOURTH")
# Close the pipeline implicitly by saving its output under the pipeline's own name
last:
# Use the result from the fourth pipeline as input
from: fourth
forEach:
code: log_message(key, value, pipeline="LAST")