Skip to content

Commit

Permalink
Minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fredimachado committed May 26, 2024
1 parent fde18ab commit 18161ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
6 changes: 1 addition & 5 deletions src/Common/NCafe.Infrastructure/DependencyRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,8 @@ public static IMessageSubscriber UseMessageSubscriber(this IApplicationBuilder a
{
var messageSubscriber = app.ApplicationServices.GetService<IMessageSubscriber>();

if (messageSubscriber is null)
{
return messageSubscriber ??
throw new InvalidOperationException("Message Subscriber is not registered. Make sure to call Services.AddRabbitMqConsumerService.");
}

return messageSubscriber;
}

private static void InitializeRabbitMqExchange(IServiceCollection services)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@

namespace NCafe.Infrastructure.MessageBrokers.RabbitMQ;

internal class RabbitMqPublisher : IBusPublisher
internal class RabbitMqPublisher(IConnection connection, IOptions<RabbitMqSettings> options, ILogger<RabbitMqPublisher> logger) : IBusPublisher
{
private readonly IConnection _connection;
private readonly RabbitMqSettings _settings;
private readonly ILogger _logger;

public RabbitMqPublisher(IConnection connection, IOptions<RabbitMqSettings> options, ILogger<RabbitMqPublisher> logger)
{
_connection = connection;
_settings = options.Value;
_logger = logger;
}
private readonly IConnection _connection = connection;
private readonly RabbitMqSettings _settings = options.Value;
private readonly ILogger _logger = logger;

public Task Publish<T>(T message) where T : class, IBusMessage
{
Expand Down

0 comments on commit 18161ca

Please sign in to comment.