using System.Collections.Generic;
using RabbitMQ.Client;
namespace xEventService.Configuration {
///
/// a configuration class for describing how to connect rabbit mq server
/// and how channels must be declared ...
///
public class XEventServiceConfiguration {
public string Server { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
//
public bool AllowDynamicQueues { get; set; } = true;
public XQueueArgs DefaultQueueArgs { get; set; } = new XQueueArgs ();
public IDictionary Queues { get; set; }
//
public bool AllowDynamicExchangess { get; set; } = true;
public XExchangeArgs DefaultExchangeArgs { get; set; } = new XExchangeArgs ();
public IDictionary Exchanges { get; set; }
//
public static XEventServiceConfiguration GetDefaults () {
return new XEventServiceConfiguration {
Port = 5672,
Username = "guest",
Password = "guest",
Server = "localhost",
Queues = new Dictionary { { "XMainQueue", new XQueueArgs { Name = "XMainQueue" } }
}
};
}
}
public class XQueueArgs {
public string Name { get; set; }
public bool Durable { get; set; } = false;
public bool Exclusive { get; set; } = false;
public bool AutoDelete { get; set; } = true;
}
public class XExchangeArgs {
public string Name { get; set; }
public string Type { get; set; } = ExchangeType.Fanout;
public bool Durable { get; set; } = false;
public bool AutoDelete { get; set; } = true;
}
}