-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprogram.cs
More file actions
50 lines (40 loc) · 1.66 KB
/
program.cs
File metadata and controls
50 lines (40 loc) · 1.66 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
Demo integration with confluent cloud using this https://github.com/LGouellec/kafka-streams-dotnet library.
using System;
using Streamiz.Kafka.Net;
using Streamiz.Kafka.Net.Metrics;
using Streamiz.Kafka.Net.SerDes;
using Streamiz.Kafka.Net.Stream;
using Streamiz.Kafka.Net.Table;
using Confluent.Kafka;
using Microsoft.Extensions.Options;
namespace sample_stream_demo
{
internal class program
{
static async Task Main(string[] args)
{
// Stream configuration
var config = new StreamConfig<StringSerDes, StringSerDes>();
config.ApplicationId = "test-app";
config.BootstrapServers = "";
config.SecurityProtocol=SecurityProtocol.SaslSsl;
config.SaslMechanism=SaslMechanism.Plain;
config.SaslUsername="";
config.SaslPassword="";
StreamBuilder builder = new StreamBuilder();
// Stream "test" topic with filterNot condition and persist in "test-output" topic.
builder.Stream<string, string>("thetopic")
.To("test-output");
// Create a table with "test-ktable" topic, and materialize this with in memory store named "test-store"
// builder.Table("test-ktable", InMemory<string, string>.As("test-store"));
// Build topology
Topology t = builder.Build();
// Create a stream instance with toology and configuration
KafkaStream stream = new KafkaStream(t, config);
// Start stream instance with cancellable token
await stream.StartAsync();
await Task.Delay(10000000);
stream.Dispose();
}
}
}