31 lines
908 B
C#
31 lines
908 B
C#
using RabbitMQ.Client;
|
|
|
|
namespace ChatRoomContract;
|
|
|
|
public static class RabbitMQConfig
|
|
{
|
|
public static string ExchangeName = "T120B180.ChatRoom.Exchange";
|
|
public static string ServerQueueName = "T120B180.ChatRoom.Server";
|
|
public static string ClientQueueNamePrefix = "T120B180.ChatRoom.Client_";
|
|
public static string HostName = "localhost";
|
|
public static string Username = "guest";
|
|
public static string Password = "guest";
|
|
|
|
public static string CreateClientQueueName()
|
|
{
|
|
var ClientId = Guid.NewGuid().ToString();
|
|
return ClientQueueNamePrefix + ClientId;
|
|
}
|
|
|
|
public static IConnection CreateConnection()
|
|
{
|
|
var rmqConnectionFactory = new ConnectionFactory
|
|
{
|
|
HostName = HostName,
|
|
UserName = Username,
|
|
Password = Password
|
|
};
|
|
return rmqConnectionFactory.CreateConnection();
|
|
}
|
|
}
|