Ejemplo n.º 1
0
        /// <summary>
        /// LoadPipeConfigServer
        /// </summary>
        /// <param name="configPipe"></param>
        /// <returns></returns>
        public static PipeSettings LoadPipeConfigServer(string configPipe)
        {
            if (string.IsNullOrEmpty(configPipe))
            {
                throw new ArgumentNullException("PipeQueueSettings.LoadPipeConfigServer name");
            }

            var config = QueueServerConfig.GetConfig();

            var settings = config.FindPipeServer(configPipe);

            if (settings == null)
            {
                throw new ArgumentException("Invalid PipeQueueSettings with PipeName:" + configPipe);
            }
            return(new PipeSettings()
            {
                PipeName = settings.PipeName,
                PipeDirection = EnumExtension.Parse <PipeDirection>(settings.PipeDirection, PipeDirection.InOut),
                PipeOptions = EnumExtension.Parse <PipeOptions>(settings.PipeOptions, PipeOptions.None),
                VerifyPipe = settings.VerifyPipe,
                ConnectTimeout = (uint)settings.ConnectTimeout,
                InBufferSize = settings.InBufferSize,
                OutBufferSize = settings.OutBufferSize,
                MaxServerConnections = settings.MaxServerConnections,
                MaxAllowedServerInstances = settings.MaxAllowedServerInstances
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadHttpConfigServer
        /// </summary>
        /// <param name="configHost"></param>
        /// <returns></returns>
        public static HttpSettings LoadHttpConfigServer(string configHost)
        {
            if (string.IsNullOrEmpty(configHost))
            {
                throw new ArgumentNullException("HttpQueueSettings.LoadTcpConfigServer name");
            }
            //TODO
            //return null;
            var config = QueueServerConfig.GetConfig();

            var settings = config.FindHttpServer(configHost);

            if (settings == null)
            {
                throw new ArgumentException("Invalid HttpQueueSettings with HostName:" + configHost);
            }

            return(new HttpSettings()
            {
                HostName = settings.HostName,
                Address = HttpSettings.EnsureHostAddress(settings.Address),
                Method = settings.Method,

                //Port = settings.Port,
                //IsAsync = settings.IsAsync,
                //ReceiveBufferSize = settings.ReceiveBufferSize,
                //SendBufferSize = settings.SendBufferSize,
                ConnectTimeout = settings.ConnectTimeout,
                ReadTimeout = settings.ReadTimeout,
                //ProcessTimeout = settings.ProcessTimeout,
                MaxErrors = settings.MaxErrors,
                MaxThreads = Math.Max(1, settings.MaxServerConnections),
                MaxServerConnections = Math.Max(1, settings.MaxServerConnections)
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadTcpConfigServer
        /// </summary>
        /// <param name="configHost"></param>
        /// <returns></returns>
        public static TcpSettings LoadTcpConfigServer(string configHost)
        {
            if (string.IsNullOrEmpty(configHost))
            {
                throw new ArgumentNullException("TcpQueueSettings.LoadTcpConfigServer name");
            }
            //TODO
            //return null;
            var config = QueueServerConfig.GetConfig();

            var settings = config.FindTcpServer(configHost);

            if (settings == null)
            {
                throw new ArgumentException("Invalid TcpQueueSettings with TcpName:" + configHost);
            }

            return(new TcpSettings()
            {
                HostName = settings.HostName,
                Address = TcpSettings.EnsureHostAddress(settings.Address),
                Port = settings.Port,
                IsAsync = settings.IsAsync,
                ReceiveBufferSize = settings.ReceiveBufferSize,
                SendBufferSize = settings.SendBufferSize,
                ConnectTimeout = settings.ConnectTimeout,
                //ReceiveTimeout = settings.ReceiveTimeout,
                ReadTimeout = settings.ReadTimeout,
                //ProcessTimeout = settings.ProcessTimeout,
                MaxSocketError = settings.MaxSocketError,
                MaxServerConnections = Math.Max(1, settings.MaxServerConnections)
            });
        }
Ejemplo n.º 4
0
        public QueueSettings()
        {
            //XmlTable table = NetConfig.GetCustomConfig("QueueSettings");

            var section = QueueServerConfig.GetConfig();
            var table   = section.QueueSettings;

            if (table == null)
            {
                throw new ArgumentException("Can not load XmlTable config");
            }
            RootPath   = table.Get <string>("RootPath", DefaultRootPath);
            QueuesPath = Path.Combine(RootPath, QueuesFolder);

            MaxSize            = table.Get <long>("MaxSize", QueueDefaults.DefaultQueueMaxSize);
            DefaultExpiration  = table.Get <int>("DefaultExpiration", 30);
            SyncInterval       = table.Get <int>("SyncInterval", 60);
            InitialCapacity    = table.Get <int>("InitialCapacity", QueueDefaults.InitialCapacity);
            EnableLog          = table.Get <bool>("EnableLog", false);
            ReceiveBufferSize  = table.Get <int>("ReceiveBufferSize", 8192);
            SendBufferSize     = table.Get <int>("SendBufferSize", 8192);
            QueueConfigFile    = table.Get("QueueConfigFile");
            EnableFileWatcher  = table.Get <bool>("EnableFileWatcher", false);
            TaskerTimeout      = table.Get <int>("TaskerTimeout", 60);
            EnableAsyncTask    = table.Get <bool>("EnableAsyncTask", true);
            EnableMailerQueue  = table.Get <bool>("EnableMailerQueue", false);
            EnableQueueManager = table.Get <bool>("EnableQueueManager", false);

            //EnableQueueController = table.Get<bool>("EnableQueueController", false);
            //EnableTopicController = table.Get<bool>("EnableTopicController", false);

            EnableJournalQueue = table.Get <bool>("EnableJournalQueue", false);

            EnableDebugLog = table.Get <bool>("EnableDebugLog", false);
            //LogMonitorCapacityLines = table.Get<int>("LogMonitorCapacityLines", 1000);

            EnablePipeConsumer = table.Get <bool>("EnablePipeConsumer", false);
            EnableTcpConsumer  = table.Get <bool>("EnableTcpConsumer", false);
            EnableHttpConsumer = table.Get <bool>("EnableHttpConsumer", false);

            EnablePipeProducer = table.Get <bool>("EnablePipeProducer", false);
            EnableTcpProducer  = table.Get <bool>("EnableTcpProducer", false);
            EnableHttpProducer = table.Get <bool>("EnableHttpProducer", false);

            EnableFolderListener     = table.Get <bool>("EnableFolderListener", false);
            EnableDbListener         = table.Get <bool>("EnableDbListener", false);
            EnableSizeHandler        = table.Get <bool>("EnableSizeHandler", false);
            EnablePerformanceCounter = table.Get <bool>("EnablePerformanceCounter", false);

            QueueDefaults.DefaultExpiration = DefaultExpiration;
            QueueDefaults.EnableLog         = EnableLog;

            QLogger.SetLogger(EnableLog, EnableDebugLog);
        }