feat: added RabbitMQ queue from back-end to hook auth for client

This commit is contained in:
2025-07-25 16:27:27 +03:00
parent 06367a3ccd
commit 8c9973e55d
4 changed files with 32 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ using JOBot.Backend.Infrastructure.Config;
using JOBot.Backend.Services;
using JOBot.Backend.Services.gRPC;
using Microsoft.EntityFrameworkCore;
using RabbitMQ.Client;
namespace JOBot.Backend;
@@ -10,12 +11,20 @@ public class Startup(IConfiguration configuration)
{
private IConfiguration Configuration { get; } = configuration;
public void ConfigureServices(IServiceCollection services)
public async Task ConfigureServices(IServiceCollection services)
{
services.AddGrpc();
services.AddGrpcReflection();
services.AddControllers();
services.AddLogging();
await using var rabbitMqConnection = await new ConnectionFactory
{
HostName = "jobot-rabbitmq"
}.CreateConnectionAsync();
await using var channel = await rabbitMqConnection.CreateChannelAsync();
await channel.QueueDeclareAsync(RabbitQueues.AuthQueue, false, false, autoDelete: false);
services.AddSingleton(channel);
services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));