Search…
Sequence Pipeline
Example of sequence pipeline
In this example, you'll create the configuration for a server. The same as the previous example, you'll print the configuration to demonstrate the step in details that will help you see the difference and notice the configuration contents.
  • Let's create a configuration by adding logging step in a sequence pipeline and print the output to JSON:
1
SequencePipeline sequencePipelineWithLoggingStep = SequencePipeline
2
.builder()
3
.add(new LoggingStep()) //add logging step into pipeline
4
.build();
5
6
System.out.format("----------%n" +
7
"Pipeline with a Logging step output%n" +
8
"------------%n" +
9
"%s%n" +
10
"------------%n%n",
11
sequencePipelineWithLoggingStep.toJson());
Copied!
  • Call for default or empty inference configuration and print the output to JSON:
1
InferenceConfiguration defaultInferenceConfiguration = new InferenceConfiguration();
2
3
System.out.format("----------%n" +
4
"Default inference configuration%n" +
5
"------------%n" +
6
"%s%n" +
7
"------------%n%n",
8
defaultInferenceConfiguration.toJson());
Copied!
  • Combine both to create complete configuration for a server:
1
InferenceConfiguration inferenceConfigurationWithPipeline = new InferenceConfiguration();
2
inferenceConfigurationWithPipeline.pipeline(sequencePipelineWithLoggingStep);
3
4
// Printing InferenceConfiguration in YAML
5
System.out.format("----------%n" +
6
"Inference Configuration in YAML%n" +
7
"------------%n" +
8
"%s%n" +
9
"------------%n%n",
10
inferenceConfigurationWithPipeline.toYaml());
Copied!
You'll see the output similar to:
1
----------
2
Pipeline with a Logging step output
3
------------
4
{
5
"steps" : [ {
6
"@type" : "LOGGING",
7
"logLevel" : "INFO",
8
"log" : "KEYS"
9
} ]
10
}
11
------------
12
13
----------
14
Default inference configuration
15
------------
16
{
17
"host" : "localhost",
18
"port" : 0,
19
"useSsl" : false,
20
"protocol" : "HTTP",
21
"staticContentRoot" : "static-content",
22
"staticContentUrl" : "/static-content",
23
"staticContentIndexPage" : "/index.html",
24
"kafkaConfiguration" : {
25
"startHttpServerForKafka" : true,
26
"httpKafkaHost" : "localhost",
27
"httpKafkaPort" : 0,
28
"consumerTopicName" : "inference-in",
29
"consumerKeyDeserializerClass" : "io.vertx.kafka.client.serialization.JsonObjectDeserializer",
30
"consumerValueDeserializerClass" : "io.vertx.kafka.client.serialization.JsonObjectDeserializer",
31
"consumerGroupId" : "konduit-serving-consumer-group",
32
"consumerAutoOffsetReset" : "earliest",
33
"consumerAutoCommit" : "true",
34
"producerTopicName" : "inference-out",
35
"producerKeySerializerClass" : "io.vertx.kafka.client.serialization.JsonObjectSerializer",
36
"producerValueSerializerClass" : "io.vertx.kafka.client.serialization.JsonObjectSerializer",
37
"producerAcks" : "1"
38
},
39
"mqttConfiguration" : { },
40
"customEndpoints" : [ ]
41
}
42
------------
43
44
----------
45
Inference Configuration in YAML
46
------------
47
---
48
host: "localhost"
49
port: 0
50
use_ssl: false
51
protocol: "HTTP"
52
static_content_root: "static-content"
53
static_content_url: "/static-content"
54
static_content_index_page: "/index.html"
55
kafka_configuration:
56
start_http_server_for_kafka: true
57
http_kafka_host: "localhost"
58
http_kafka_port: 0
59
consumer_topic_name: "inference-in"
60
consumer_key_deserializer_class: "io.vertx.kafka.client.serialization.JsonObjectDeserializer"
61
consumer_value_deserializer_class: "io.vertx.kafka.client.serialization.JsonObjectDeserializer"
62
consumer_group_id: "konduit-serving-consumer-group"
63
consumer_auto_offset_reset: "earliest"
64
consumer_auto_commit: "true"
65
producer_topic_name: "inference-out"
66
producer_key_serializer_class: "io.vertx.kafka.client.serialization.JsonObjectSerializer"
67
producer_value_serializer_class: "io.vertx.kafka.client.serialization.JsonObjectSerializer"
68
producer_acks: "1"
69
mqtt_configuration: {}
70
custom_endpoints: []
71
pipeline:
72
steps:
73
- '@type': "LOGGING"
74
logLevel: "INFO"
75
log: "KEYS"
76
77
------------
78
79
80
Process finished with exit code 0
Copied!
Copy link