private void Init(string queueName, QueueItemHandler queueItemHandler, int threadCount, ThreadPriority threadPriority, int maxItemsInMemory, int dequeueInterval, int dequeueBatch, string persistPath)
 {
     Guard.ArgumentNotNull <QueueItemHandler>(queueItemHandler);
     Guard.ArgumentValuesPositive(new int[]
     {
         maxItemsInMemory,
         dequeueInterval,
         dequeueBatch
     });
     this.InitQueue(queueName, queueItemHandler, threadCount, threadPriority, maxItemsInMemory, dequeueInterval, dequeueBatch, persistPath);
 }
        private void Init(string queueName, QueueItemHandler queueItemHandler, int threadCount, ThreadPriority threadPriority, int maxItemsInMemory, int scheduleRate, string persistPath)
        {
            Guard.ArgumentNotNull <QueueItemHandler>(queueItemHandler);
            Guard.ArgumentValuesPositive(new int[]
            {
                maxItemsInMemory,
                scheduleRate
            });
            int interval = Math.Max(1, 1000 / scheduleRate);

            Math.Max(1, scheduleRate / (1000 / interval));
            this.InitQueue(queueName, queueItemHandler, threadCount, threadPriority, maxItemsInMemory, interval, Math.Max(1, scheduleRate / 1000), persistPath);
        }
 private void InitQueue(string queueName, QueueItemHandler queueItemHandler, int threadCount, ThreadPriority threadPriority, int maxItemsInMemory, int dequeueInterval, int dequeueBatch, string persistPath)
 {
     this.queueName        = queueName;
     this.queueItemHandler = queueItemHandler;
     this.persistence      = new EfzQueuePersistence <T>(persistPath);
     this.dequeueInterval  = dequeueInterval;
     this.dequeueBatch     = dequeueBatch;
     this.dispatcher       = new Dispatcher(threadCount, threadPriority, true, "Thread Pool - " + queueName);
     this.queue            = new DispatcherQueue(queueName, this.dispatcher, TaskExecutionPolicy.ConstrainQueueDepthThrottleExecution, maxItemsInMemory);
     Arbiter.Activate(this.queue, new ITask[]
     {
         Arbiter.Receive <PersistentQueueItem <T> >(true, this.port, new Handler <PersistentQueueItem <T> >(this.InternalQueueItemHandler))
     });
     this.dequeueTimer = new Timer(new TimerCallback(this.Dequeue), null, -1, -1);
 }
 public PersistentQueueProcessor(string queueName, QueueItemHandler queueItemHandler, int threadCount, ThreadPriority threadPriority)
 {
     this.Init(queueName, queueItemHandler, threadCount, threadPriority, 1000, 10, 100, GetQueuePersistPath(queueName));
 }
 public PersistentQueueProcessor(string queueName, QueueItemHandler queueItemHandler)
 {
     this.Init(queueName, queueItemHandler, 0, ThreadPriority.Normal, 1000, 10, 100, GetQueuePersistPath(queueName));
 }