-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.vb
33 lines (30 loc) · 1.3 KB
/
Program.vb
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
Imports System
Imports System.Threading
Imports Confluent.Kafka
Imports Confluent.Kafka.ConfigPropertyNames
Imports Microsoft.Extensions.DependencyInjection
Imports Microsoft.Extensions.Logging
Module Program
Sub Main(args As String())
Dim Num As Integer
'setup our DI
Dim ServiceProvider = New ServiceCollection().
AddLogging(Function(loggingBuilder) loggingBuilder.ClearProviders().AddConsole().SetMinimumLevel(LogLevel.Debug)).
AddSingleton(Of IKafkaProducer, KafkaProducer)().
BuildServiceProvider()
'ref to console logging
Dim Logger = ServiceProvider.GetService(Of ILoggerFactory)().CreateLogger(Of IKafkaProducer)
Logger.LogDebug($"Start.")
'ref to Kafka producer
Dim KProducer = ServiceProvider.GetService(Of IKafkaProducer)
For i As Integer = 0 To 100
Interlocked.Increment(Num)
Dim X = New Threading.Thread(Sub()
KProducer.SendOrderRequest(Num, "TstTopic", $"{RandomString.GetRandomString(100000)}")
End Sub)
X.Start()
'KProducer.SendOrderRequest("TstTopic", $"{RandomString.GetRandomString(100000)}")
Next
Logger.LogDebug("Finish.")
End Sub
End Module