diff --git a/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs b/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
index afb2fd2..d52fe61 100644
--- a/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
+++ b/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
@@ -2,15 +2,14 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
// ReSharper disable once CheckNamespace
+
+using System;
+using RabbitMQ.Client;
+
namespace DotNetCore.CAP
{
public class RabbitMQOptions
{
- ///
- /// Default value for connection attempt timeout, in milliseconds.
- ///
- public const int DefaultConnectionTimeout = 30 * 1000;
-
///
/// Default password (value: "guest").
///
@@ -63,21 +62,6 @@ namespace DotNetCore.CAP
///
public string ExchangeName { get; set; } = DefaultExchangeName;
- ///
- /// Timeout setting for connection attempts (in milliseconds).
- ///
- public int RequestedConnectionTimeout { get; set; } = DefaultConnectionTimeout;
-
- ///
- /// Timeout setting for socket read operations (in milliseconds).
- ///
- public int SocketReadTimeout { get; set; } = DefaultConnectionTimeout;
-
- ///
- /// Timeout setting for socket write operations (in milliseconds).
- ///
- public int SocketWriteTimeout { get; set; } = DefaultConnectionTimeout;
-
///
/// The port to connect on.
///
@@ -87,5 +71,10 @@ namespace DotNetCore.CAP
/// Gets or sets queue message automatic deletion time (in milliseconds). Default 864000000 ms (10 days).
///
public int QueueMessageExpires { get; set; } = 864000000;
+
+ ///
+ /// RabbitMQ native connection factory options
+ ///
+ public Action ConnectionFactoryOptions { get; set; }
}
}
\ No newline at end of file
diff --git a/src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs b/src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
index 7b48a01..0b39f39 100644
--- a/src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
+++ b/src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
@@ -6,7 +6,6 @@ using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;
using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
using RabbitMQ.Client;
namespace DotNetCore.CAP.RabbitMQ
@@ -42,7 +41,7 @@ namespace DotNetCore.CAP.RabbitMQ
Exchange = options.ExchangeName + "." + capOptions.Version;
}
- _logger.LogDebug("RabbitMQ configuration of CAP :{0} {1}", Environment.NewLine, JsonConvert.SerializeObject(options, Formatting.Indented));
+ _logger.LogDebug($"RabbitMQ configuration:'HostName:{options.HostName}, Port:{options.Port}, UserName:{options.UserName}, Password:{options.Password}, ExchangeName:{options.ExchangeName}'");
}
IModel IConnectionChannelPool.Rent()
@@ -88,19 +87,18 @@ namespace DotNetCore.CAP.RabbitMQ
UserName = options.UserName,
Port = options.Port,
Password = options.Password,
- VirtualHost = options.VirtualHost,
- RequestedConnectionTimeout = options.RequestedConnectionTimeout,
- SocketReadTimeout = options.SocketReadTimeout,
- SocketWriteTimeout = options.SocketWriteTimeout
+ VirtualHost = options.VirtualHost
};
if (options.HostName.Contains(","))
{
+ options.ConnectionFactoryOptions?.Invoke(factory);
return () => factory.CreateConnection(
options.HostName.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries));
}
factory.HostName = options.HostName;
+ options.ConnectionFactoryOptions?.Invoke(factory);
return () => factory.CreateConnection();
}