Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

42 rader
1.6 KiB

  1. using JT808.DotNetty.Kafka;
  2. using JT808.DotNetty.ReplyMessage;
  3. using JT808.DotNetty.SimpleQueueService.Impl;
  4. using JT808.Protocol;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using Microsoft.Extensions.Hosting;
  8. using Microsoft.Extensions.Logging;
  9. using System;
  10. using System.Threading.Tasks;
  11. namespace JT808.DotNetty.SimpleQueueService
  12. {
  13. class Program
  14. {
  15. static async Task Main(string[] args)
  16. {
  17. var hostBuilder = new HostBuilder()
  18. .ConfigureAppConfiguration((hostContext, config) => {
  19. config.SetBasePath(AppDomain.CurrentDomain.BaseDirectory);
  20. config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
  21. })
  22. .ConfigureLogging((hostContext, configLogging) => {
  23. configLogging.AddConsole();
  24. configLogging.SetMinimumLevel(LogLevel.Trace);
  25. })
  26. .ConfigureServices((hostContext, services) => {
  27. services.AddSingleton<ILoggerFactory, LoggerFactory>();
  28. services.AddSingleton(typeof(ILogger<>), typeof(Logger<>));
  29. services.AddJT808Configure()
  30. .AddJT808ClientKafka()
  31. .AddMsgReplyProducer(hostContext.Configuration)
  32. .AddMsgConsumer(hostContext.Configuration)
  33. .AddInprocJT808ReplyMessage<JT808DotNettyReplyMessageServiceInherited>();
  34. ;
  35. });
  36. await hostBuilder.RunConsoleAsync();
  37. }
  38. }
  39. }