Пример #1
0
        public QueuedHandler(IHandle <Message> consumer,
                             string name,
                             bool watchSlowMsg           = true,
                             int?slowMsgThresholdMs      = null,
                             int threadStopWaitTimeoutMs = 10000)
        {
            Ensure.NotNull(consumer, "consumer");
            Ensure.NotNull(name, "name");

            _consumer                = consumer;
            _name                    = name;
            _watchSlowMsg            = watchSlowMsg;
            _slowMsgThreshold        = TimeSpan.FromMilliseconds(slowMsgThresholdMs ?? InMemoryBus.DefaultSlowMessageThresholdMs);
            _threadStopWaitTimeoutMs = threadStopWaitTimeoutMs;

            _queueMonitor = QueueMonitor.Default;
        }
        public QueuedHandlerPulse(IHandle <Message> consumer,
                                  string name,
                                  bool watchSlowMsg              = true,
                                  TimeSpan?slowMsgThreshold      = null,
                                  TimeSpan?threadStopWaitTimeout = null,
                                  string groupName = null)
        {
            Ensure.NotNull(consumer, "consumer");
            Ensure.NotNull(name, "name");

            _consumer              = consumer;
            _watchSlowMsg          = watchSlowMsg;
            _slowMsgThreshold      = slowMsgThreshold ?? InMemoryBus.DefaultSlowMessageThreshold;
            _threadStopWaitTimeout = threadStopWaitTimeout ?? QueuedHandler.DefaultStopWaitTimeout;

            _queueMonitor = QueueMonitor.Default;
            _queueStats   = new QueueStatsCollector(name, groupName);
        }
        public QueuedHandlerThreadPool(IHandle<Message> consumer,
                                       string name,
                                       bool watchSlowMsg = true,
                                       TimeSpan? slowMsgThreshold = null,
                                       TimeSpan? threadStopWaitTimeout = null,
                                       string groupName = null)
        {
            Ensure.NotNull(consumer, "consumer");
            Ensure.NotNull(name, "name");

            _consumer = consumer;

            _watchSlowMsg = watchSlowMsg;
            _slowMsgThreshold = slowMsgThreshold ?? InMemoryBus.DefaultSlowMessageThreshold;
            _threadStopWaitTimeout = threadStopWaitTimeout ?? QueuedHandler.DefaultStopWaitTimeout;

            _queueMonitor = QueueMonitor.Default;
            _queueStats = new QueueStatsCollector(name, groupName);
        }