Browse Source

fixed 'dotnet.exe' process incomplete quit when shutdown application. ( #64 )

master
Savorboard 7 years ago
parent
commit
b03b48535a
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs

+ 4
- 1
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs View File

@@ -14,6 +14,7 @@ namespace DotNetCore.CAP.RabbitMQ
private readonly string _queueName; private readonly string _queueName;
private readonly RabbitMQOptions _rabbitMQOptions; private readonly RabbitMQOptions _rabbitMQOptions;


private IConnection _connection;
private IModel _channel; private IModel _channel;
private ulong _deliveryTag; private ulong _deliveryTag;


@@ -57,6 +58,7 @@ namespace DotNetCore.CAP.RabbitMQ
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
cancellationToken.WaitHandle.WaitOne(timeout); cancellationToken.WaitHandle.WaitOne(timeout);
} }
// ReSharper disable once FunctionNeverReturns
} }


public void Commit() public void Commit()
@@ -72,11 +74,12 @@ namespace DotNetCore.CAP.RabbitMQ
public void Dispose() public void Dispose()
{ {
_channel.Dispose(); _channel.Dispose();
_connection.Dispose();
} }


private void InitClient() private void InitClient()
{ {
var _connection = _connectionChannelPool.GetConnection();
_connection = _connectionChannelPool.GetConnection();


_channel = _connection.CreateModel(); _channel = _connection.CreateModel();




Loading…
Cancel
Save