Commit d9fa8649 authored by Mark van Renswoude's avatar Mark van Renswoude

Fixed auto-delete queues being deleted when using the mirror option

parent 975e4e97
......@@ -71,6 +71,9 @@
<ItemGroup>
<EmbeddedResource Include="Data\ArgumentTemplate-CircularReference.xml" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
......
......@@ -39,30 +39,33 @@ namespace RabbitMetaQueue.Infrastructure
foreach (var queue in client.GetQueues())
{
var modelQueue = new Model.Queue
{
Name = queue.Name,
Durable = queue.Durable
};
if (!IsSystemQueue(queue))
{
var modelQueue = new Model.Queue
{
Name = queue.Name,
Durable = queue.Durable
};
MapArguments(queue.Arguments, modelQueue.Arguments);
MapArguments(queue.Arguments, modelQueue.Arguments);
foreach (var binding in client.GetBindingsForQueue(queue))
{
if (!IsSystemBinding(binding))
foreach (var binding in client.GetBindingsForQueue(queue))
{
var modelBinding = new Model.Binding
if (!IsSystemBinding(binding))
{
Exchange = binding.Source,
RoutingKey = binding.RoutingKey
};
MapArguments(binding.Arguments, modelBinding.Arguments);
modelQueue.Bindings.Add(modelBinding);
var modelBinding = new Model.Binding
{
Exchange = binding.Source,
RoutingKey = binding.RoutingKey
};
MapArguments(binding.Arguments, modelBinding.Arguments);
modelQueue.Bindings.Add(modelBinding);
}
}
}
topology.Queues.Add(modelQueue);
topology.Queues.Add(modelQueue);
}
}
return topology;
......@@ -83,6 +86,14 @@ namespace RabbitMetaQueue.Infrastructure
}
private static bool IsSystemQueue(EasyNetQ.Management.Client.Model.Queue queue)
{
return (queue.AutoDelete ||
String.IsNullOrEmpty(queue.Name) ||
queue.Name.StartsWith("amq."));
}
private static bool IsSystemBinding(EasyNetQ.Management.Client.Model.Binding binding)
{
return (String.IsNullOrEmpty(binding.Source));
......
......@@ -35,14 +35,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="EasyNetQ.Management.Client">
<HintPath>packages\EasyNetQ.Management.Client.0.47.12.38\lib\net40\EasyNetQ.Management.Client.dll</HintPath>
<HintPath>..\packages\EasyNetQ.Management.Client.0.47.12.38\lib\net40\EasyNetQ.Management.Client.dll</HintPath>
</Reference>
<Reference Include="NDesk.Options">
<HintPath>packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll</HintPath>
<HintPath>..\packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client, Version=3.5.4.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\RabbitMQ.Client.3.5.4\lib\net40\RabbitMQ.Client.dll</HintPath>
<Reference Include="RabbitMQ.Client">
<HintPath>..\packages\RabbitMQ.Client.3.5.4\lib\net40\RabbitMQ.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment