Skip to content

Commit be1f452

Browse files
author
John Simons
committed
ConfirmsAwareChannel not disposing of model if usePublisherConfirms is false.
This was causing channels to stay open in the broker for longer then necessary. Fixes #51
1 parent 125ccbb commit be1f452

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/NServiceBus.RabbitMQ/ConfirmsAwareChannel.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace NServiceBus.Transports.RabbitMQ
88
using Unicast.Queuing;
99

1010
[SkipWeaving]
11-
class ConfirmsAwareChannel:IDisposable
11+
class ConfirmsAwareChannel : IDisposable
1212
{
1313
public IModel Channel { get; private set; }
1414

@@ -26,14 +26,14 @@ public ConfirmsAwareChannel(IConnection connection, bool usePublisherConfirms, T
2626

2727
public void Dispose()
2828
{
29-
if (!usePublisherConfirms)
30-
{
31-
return;
32-
}
33-
3429
try
3530
{
36-
Channel.WaitForConfirmsOrDie(maxWaitTimeForConfirms);
31+
if (usePublisherConfirms)
32+
{
33+
Channel.WaitForConfirmsOrDie(maxWaitTimeForConfirms);
34+
}
35+
36+
Channel.Dispose();
3737
}
3838
catch (AlreadyClosedException ex)
3939
{
@@ -44,6 +44,7 @@ public void Dispose()
4444
var exchangeName = matches.Count > 0 && matches[0].Groups.Count > 1 ? Address.Parse(matches[0].Groups[1].Value) : null;
4545
throw new QueueNotFoundException(exchangeName, "Exchange for the recipient does not exist", ex);
4646
}
47+
4748
throw;
4849
}
4950
}

src/NServiceBus.RabbitMQ/NServiceBus.RabbitMQ.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@
117117
</Content>
118118
</ItemGroup>
119119
<ItemGroup>
120-
<None Include="..\..\packaging\nuget\NServiceBus.Transports.RabbitMQ.nuspec">
121-
<Link>NServiceBus.Transports.RabbitMQ.nuspec</Link>
122-
</None>
123120
<None Include="packages.config" />
124121
</ItemGroup>
125122
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

0 commit comments

Comments
 (0)