From 077e06c742dfa61d6ed84305427ff434d5174fed Mon Sep 17 00:00:00 2001 From: Daniel Toivonen Date: Thu, 27 Apr 2023 09:59:15 +0200 Subject: [PATCH] Added more comments --- Wolverine.Mediator.RabbitMq.ReceiverDual/Program.cs | 1 - .../Helpers/ServiceMessagesRegisterHelper.cs | 4 +++- Wolverine.Mediator.RabbitMq.Sender/Program.cs | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Wolverine.Mediator.RabbitMq.ReceiverDual/Program.cs b/Wolverine.Mediator.RabbitMq.ReceiverDual/Program.cs index 3a7b496..81e1fa9 100644 --- a/Wolverine.Mediator.RabbitMq.ReceiverDual/Program.cs +++ b/Wolverine.Mediator.RabbitMq.ReceiverDual/Program.cs @@ -18,7 +18,6 @@ var connectionString = builder.Configuration.GetConnectionString("MessageBroker"); opts.UseRabbitMq(new Uri(connectionString)) - // These are essentially //opts.DeclareExchange(exchangeName: type.Name).BindExchange(exchangeName: type.Name).ToQueue(queueName: queueName, bindingKey: type.Name); .AddQueueBindingsForMessages(queueName, MessagebrokerMessagesHelper.SERVICE_COMMANDS_TYPES) // Messages for this service diff --git a/Wolverine.Mediator.RabbitMq.Sender/Helpers/ServiceMessagesRegisterHelper.cs b/Wolverine.Mediator.RabbitMq.Sender/Helpers/ServiceMessagesRegisterHelper.cs index 8bb965b..3c0b57e 100644 --- a/Wolverine.Mediator.RabbitMq.Sender/Helpers/ServiceMessagesRegisterHelper.cs +++ b/Wolverine.Mediator.RabbitMq.Sender/Helpers/ServiceMessagesRegisterHelper.cs @@ -10,6 +10,7 @@ public static class ServiceMessagesRegisterHelper // Events published from this service public static WolverineOptions AddEventForPublishing(this WolverineOptions opts) { + opts.PublishMessage().ToRabbitExchange(typeof(RemoteEvent).Name); // Event return opts; @@ -18,7 +19,8 @@ public static WolverineOptions AddEventForPublishing(this WolverineOptions opts) // Commands to other services published from this service public static WolverineOptions AddCommandsForPublishing(this WolverineOptions opts) { - opts.PublishMessage().ToRabbitExchange(ReceiverDualQueueName.EXCHANGE_NAME, ex => ex.BindQueue(ReceiverDualQueueName.QUEUE_NAME)); + // Send to specific exchange, can this be done in another more dynamic way? + opts.PublishMessage().ToRabbitExchange(ReceiverDualQueueName.EXCHANGE_NAME); return opts; } diff --git a/Wolverine.Mediator.RabbitMq.Sender/Program.cs b/Wolverine.Mediator.RabbitMq.Sender/Program.cs index f670188..5e6ea44 100644 --- a/Wolverine.Mediator.RabbitMq.Sender/Program.cs +++ b/Wolverine.Mediator.RabbitMq.Sender/Program.cs @@ -22,6 +22,9 @@ // Bind outgoing messages, could this be magically done if there is a lot of events/commands? // Hiding in extensions to not bloat the setup + + // These are essatially: + // opts.PublishMessage().ToRabbitExchange(exchangeName: typeof(MyMessage).Name); opts.AddEventForPublishing(); opts.AddCommandsForPublishing();