public void Initialize(QueueMessageManagerConfiguration configuration = null, Type managerType = null)
{
base.Initialize(configuration, managerType);
// ignore controller list if controllers have been
// explicitly set
if (Controllers != null && Controllers.Count > 0)
return;
// load up the controllers
Controllers = new List<QueueController>();
if (configuration == null)
configuration = QueueMessageManagerConfiguration.Current;
if (managerType == null)
managerType = QueueManagerType ?? typeof(QueueMessageManagerSql);
if (configuration != null && configuration.Controllers != null)
{
// pass configuration to all the child controllers
foreach (var config in configuration.Controllers)
{
var ctrl = Activator.CreateInstance(GetType()) as QueueController;
ctrl.ConnectionString = string.IsNullOrEmpty(config.ConnectionString)
? ConnectionString ?? ""
: config.ConnectionString;
ctrl.QueueName = config.QueueName;
ctrl.ThreadCount = config.ControllerThreads;
ctrl.WaitInterval = config.WaitInterval;
ctrl.QueueManagerType = managerType;
ctrl.OnCreateQueueManager = OnCreateQueueManager;
Controllers.Add(ctrl);
}
}
}