예제 #1
0
        public QueueStatsCollector CreateQueueStatsCollector(string name, string groupName = null)
        {
            var statsCollector = new QueueStatsCollector(name, groupName);

#if DEBUG
            _queueStatsCollectors.AddOrUpdate(statsCollector, (statsCollector) => true,
                                              (statsCollector, curValue) => throw new Exception("This should never happen"));
#endif
            return(statsCollector);
        }
        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);
        }