Beispiel #1
0
        public LocalQueueListener(
            ITraceWriter traceWriter,
            IQueueTriggerMethodInvoker queueMethodInvoker,
            int queuePollIntervalSeconds        = 10,
            int queuePollBatchSize              = 8,
            int messageVisibilityTimeoutSeconds = 60)
        {
            if (traceWriter == null)
            {
                throw new ArgumentNullException(nameof(traceWriter));
            }

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

            _traceWriter        = traceWriter;
            _queueMethodInvoker = queueMethodInvoker;

            _cancellationTokenSource = new CancellationTokenSource();
            _cancellationToken       = _cancellationTokenSource.Token;

            _queuePollIntervalSeconds       = queuePollIntervalSeconds;
            _queuePollBatchSize             = queuePollBatchSize;
            _messageVisiblityTimeoutSeconds = messageVisibilityTimeoutSeconds;
        }
Beispiel #2
0
        public LocalStorageJobHost(
            IQueueTriggerIndexer queueTriggerIndexer = null,
            IQueueListener queueListener             = null,
            ITraceWriter tracerWriter = null,
            IQueueTriggerMethodInvoker queueMethodInvoker = null
            )
        {
            _stoppingTokenSource = new CancellationTokenSource();

            _tracerWriter        = tracerWriter ?? new LocalTraceWriter(System.Diagnostics.TraceLevel.Info);
            _queueTriggerIndexer = queueTriggerIndexer ?? new QueueTriggerIndexer(_tracerWriter);
            _queueMethodInvoker  = queueMethodInvoker ?? new QueueTriggerMethodInvoker();
            _queueListener       = queueListener ?? new LocalQueueListener(_tracerWriter, _queueMethodInvoker);
        }