/// <summary>
        /// Initializes a new instance of the <see cref="NotificationService"/> class.
        /// </summary>
        /// <param name="hub">The hub.</param>
        /// <param name="queue">The queue.</param>
        /// <param name="notificationThreshold">The notification threshold.</param>
        /// <param name="emptyQueueDelay">The empty queue delay.</param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        public NotificationService(
            IPubSubHub hub,
            IPublishQueue queue,
            int notificationThreshold = 10,
            int emptyQueueDelay       = 3000)
        {
            if (hub == null)
            {
                throw new ArgumentNullException(nameof(hub));
            }

            if (queue == null)
            {
                throw new ArgumentNullException(nameof(queue));
            }

            _hub                = hub;
            _queue              = queue;
            _emptyQueueDelay    = emptyQueueDelay;
            _processorSemaphore = new SemaphoreSlim(notificationThreshold, notificationThreshold);
        }
示例#2
0
 public HubController(IPubSubHub hub)
 {
     _hub = hub;
 }