Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.08 KB

demo-steps.md

File metadata and controls

38 lines (33 loc) · 1.08 KB
  • Unzip steeltoe initialzr download
  • Modify kestrel port in appsettings.json:
"Kestrel": {
    "Endpoints": {
      "MyHttpEndpoint": {
        "Url": "http://localhost:5001"
      }
    }
  }
  • Generate JSON classes using converter
  • using Newtonsoft.Json;
  • Rename Root to QueueResponse
  • Add reference to Newtonsoft.Json: dotnet add package Newtonsoft.Json -v 13.0.3
  • Add reference to Newtonsoft.Json: dotnet add packageMicrosoft.Extensions.Logging
  • Add RabbitMQ config, RabbitMQService
  • Add MetricsService
builder.Services.AddHttpClient();
builder.Services.AddSingleton<LoggerFactory>();

builder.Services.AddSingleton<RabbitMQConfig>();
builder.Services.AddSingleton<RabbitMQService>();
builder.Services.AddSingleton<LokiConfig>();
builder.Services.AddSingleton<LokiService>();
builder.Services.AddSingleton<MetricsConfig>();
builder.Services.AddSingleton<MetricsService>();

Add before app.Run():

var metricsService = app.Services.GetService<MetricsService>();
await metricsService.StartAsync(CancellationToken.None);