Skip to content
Permalink
Browse files

Adding RabbitMQ Port

  • Loading branch information...
farajfarook committed Apr 15, 2019
1 parent 3305d94 commit 47e005e11f520e5ee18d26b2c8f5bed5119d534f
@@ -1,6 +1,6 @@
env:
global:
- PACKAGE_VERSION="1.1.26"
- PACKAGE_VERSION="1.1.27"
- PACKAGE_ICON="https://www.enbiso.com/logo.svg"
- PACKAGE_PROJECT="https://nlib.enbiso.com"
- PACKAGE_REPO="https://github.com/enbiso/Enbiso.NLib"
@@ -7,6 +7,10 @@ public class RabbitMqOption
/// </summary>
public string Server { get; set; } = "localhost";
/// <summary>
/// Server Port
/// </summary>
public int Port { get; set; } = 5672;
/// <summary>
/// Username
/// </summary>
public string Username { get; set; }
@@ -44,17 +44,18 @@ public class RabbitMqPersistentConnection : IRabbitMqPersistentConnection
/// <param name="logger"></param>
/// <param name="option"></param>
public RabbitMqPersistentConnection(
ILogger<RabbitMqPersistentConnection> logger,
ILogger<RabbitMqPersistentConnection> logger,
IOptions<RabbitMqOption> option)
{
var optVal = option.Value;
_connectionFactory = new ConnectionFactory
{
HostName = optVal.Server ?? throw new ArgumentNullException(nameof(optVal.Server)),
Port = optVal.Port
};
if(!string.IsNullOrEmpty(optVal.Username))
if (!string.IsNullOrEmpty(optVal.Username))
_connectionFactory.UserName = optVal.Username;
if(!string.IsNullOrEmpty(optVal.Password))
if (!string.IsNullOrEmpty(optVal.Password))
_connectionFactory.Password = optVal.Password;
if (!string.IsNullOrEmpty(optVal.VirtualHost))
_connectionFactory.VirtualHost = optVal.VirtualHost;
@@ -63,7 +64,7 @@ public class RabbitMqPersistentConnection : IRabbitMqPersistentConnection
}

/// <inheritdoc />
public bool IsConnected
public bool IsConnected
=> _connection != null && _connection.IsOpen && !_disposed;

/// <inheritdoc />
@@ -77,7 +78,7 @@ public void Dispose()
}
catch (Exception ex)
{
_logger.LogCritical(ex.ToString());
_logger.LogCritical(ex.ToString());
}
}

0 comments on commit 47e005e

Please sign in to comment.
You can’t perform that action at this time.