You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Kafka2Doris
|
|
{
|
|
public class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
|
var rid = isWindows ? "win-x64" : "linux-x64";
|
|
var file = isWindows ? "librdkafka.dll" : "librdkafka.so";
|
|
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "runtimes", rid, "native", file);
|
|
Confluent.Kafka.Library.Load(path);
|
|
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureLogging(o =>
|
|
{
|
|
o.AddConsole();
|
|
})
|
|
.ConfigureServices((hostingContext, services) =>
|
|
{
|
|
services.AddLogging();
|
|
//services.AddSingleton(config);
|
|
services.AddHttpClient();
|
|
services.AddHostedService<Worker>();
|
|
})
|
|
.Build()
|
|
.Run();
|
|
}
|
|
}
|
|
} |