1
0
mirror of synced 2024-06-29 07:17:39 +00:00
Tapeti/Tapeti/TapetiConnectionParams.cs
Mark van Renswoude 74985e45de Fixed all ReSharper issues
Some are silly, like the "member not used" for public interfaces. The comments everywhere are ugly, sorry, but it keeps the possibly important issues visible without a dependency on some ReSharper annotations package.
2018-12-19 20:50:56 +01:00

45 lines
1.2 KiB
C#

using System;
// ReSharper disable UnusedMember.Global
namespace Tapeti
{
public class TapetiConnectionParams
{
public string HostName { get; set; } = "localhost";
public int Port { get; set; } = 5672;
public string VirtualHost { get; set; } = "/";
public string Username { get; set; } = "guest";
public string Password { get; set; } = "guest";
/// <summary>
/// The amount of message to prefetch. See http://www.rabbitmq.com/consumer-prefetch.html for more information.
///
/// If set to 0, no limit will be applied.
/// </summary>
public ushort PrefetchCount { get; set; } = 50;
public TapetiConnectionParams()
{
}
public TapetiConnectionParams(Uri uri)
{
HostName = uri.Host;
VirtualHost = string.IsNullOrEmpty(uri.AbsolutePath) ? "/" : uri.AbsolutePath;
if (!uri.IsDefaultPort)
Port = uri.Port;
var userInfo = uri.UserInfo.Split(':');
if (userInfo.Length > 0)
{
Username = userInfo[0];
if (userInfo.Length > 1)
Password = userInfo[1];
}
}
}
}