[FA-misc] Mass transit overhaul, needs testing and review
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using FictionArchive.Service.AuthenticationService.Models.Requests;
|
||||
using FictionArchive.Service.AuthenticationService.Models.IntegrationEvents;
|
||||
using FictionArchive.Service.Shared.Services.EventBus;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using FictionArchive.Service.Shared.MassTransit.Contracts.Events;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace FictionArchive.Service.AuthenticationService.Controllers
|
||||
@@ -10,11 +9,11 @@ namespace FictionArchive.Service.AuthenticationService.Controllers
|
||||
[ApiController]
|
||||
public class AuthenticationWebhookController : ControllerBase
|
||||
{
|
||||
private readonly IEventBus _eventBus;
|
||||
private readonly IPublishEndpoint _publishEndpoint;
|
||||
|
||||
public AuthenticationWebhookController(IEventBus eventBus)
|
||||
public AuthenticationWebhookController(IPublishEndpoint publishEndpoint)
|
||||
{
|
||||
_eventBus = eventBus;
|
||||
_publishEndpoint = publishEndpoint;
|
||||
}
|
||||
|
||||
[HttpPost(nameof(UserRegistered))]
|
||||
@@ -28,7 +27,7 @@ namespace FictionArchive.Service.AuthenticationService.Controllers
|
||||
EventUserUsername = payload.EventUserUsername
|
||||
};
|
||||
|
||||
await _eventBus.Publish(authUserAddedEvent);
|
||||
await _publishEndpoint.Publish(authUserAddedEvent);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using FictionArchive.Service.Shared.Services.EventBus;
|
||||
|
||||
namespace FictionArchive.Service.AuthenticationService.Models.IntegrationEvents;
|
||||
|
||||
public class AuthUserAddedEvent : IIntegrationEvent
|
||||
{
|
||||
public string OAuthProviderId { get; set; }
|
||||
|
||||
public string InviterOAuthProviderId { get; set; }
|
||||
|
||||
// The email of the user that created the event
|
||||
public string EventUserEmail { get; set; }
|
||||
|
||||
// The username of the user that created the event
|
||||
public string EventUserUsername { get; set; }
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using FictionArchive.Service.Shared;
|
||||
using FictionArchive.Service.Shared.Services.EventBus.Implementations;
|
||||
using FictionArchive.Service.Shared.MassTransit;
|
||||
|
||||
namespace FictionArchive.Service.AuthenticationService;
|
||||
|
||||
@@ -16,13 +15,10 @@ public class Program
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
#region Event Bus
|
||||
#region MassTransit
|
||||
|
||||
builder.Services.AddFictionArchiveMassTransit(builder.Configuration);
|
||||
|
||||
builder.Services.AddRabbitMQ(opt =>
|
||||
{
|
||||
builder.Configuration.GetSection("RabbitMQ").Bind(opt);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
}
|
||||
},
|
||||
"RabbitMQ": {
|
||||
"ConnectionString": "amqp://localhost",
|
||||
"ClientIdentifier": "AuthenticationService"
|
||||
"Host": "localhost",
|
||||
"VirtualHost": "/",
|
||||
"Username": "guest",
|
||||
"Password": "guest"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user