Skip to content

Commit

Permalink
Fix routing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Leshchev committed Oct 16, 2023
1 parent a0b58b5 commit b093175
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public void Initialize(IModel model)
model.ExchangeDeclare(consumerSettings.Exchange, ExchangeType.Topic, true);
model.QueueDeclare(consumerSettings.Queue, true, false, false, null);

if (consumerSettings.RoutingKeys.Length == 0)
{
model.QueueBind(consumerSettings.Queue, consumerSettings.Exchange, "#");
return;
}

foreach (var routingKey in consumerSettings.RoutingKeys)
model.QueueBind(consumerSettings.Queue, consumerSettings.Exchange, routingKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public class RabbitMqConsumerSettings

public string Queue { get; set; } = default!;

public string[] RoutingKeys { get; set; } = { "#" };
public string[] RoutingKeys { get; set; } = Array.Empty<string>();
}
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2009-2023")]

[assembly: AssemblyVersion("19.1.0.0")]
[assembly: AssemblyFileVersion("19.1.0.0")]
[assembly: AssemblyInformationalVersion("19.1.0.0")]
[assembly: AssemblyVersion("19.1.1.0")]
[assembly: AssemblyFileVersion("19.1.1.0")]
[assembly: AssemblyInformationalVersion("19.1.1.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit b093175

Please sign in to comment.