Exemple #1
0
        public Task Start(CancellationToken cancellationToken, CloudQueue deadLetterQueue = null, int maxDequeueCount = 10, Action <string> traceLogger = null)
        {
            AzureStorageQueueBackoffProcessor <AuditItem> queueProcessor = new AzureStorageQueueBackoffProcessor <AuditItem>(
                _backoffPolicyFactory.Create(),
                _serializer,
                _cloudAuditQueueProvider.Queue,
                item => HandleRecievedItemAsync(_cloudAuditQueueProvider.DeadLetterQueue, item, maxDequeueCount, cancellationToken),
                traceLogger,
                HandleError);

            return(queueProcessor.StartAsync(cancellationToken));
        }
        public Task Start <TCommand, TResult>(CloudQueue queue, CancellationToken cancellationToken, int maxDequeueCount = 10, Action <string> traceLogger = null) where TCommand : class, ICommand <TResult>
        {
            AzureStorageQueueBackoffProcessor <TCommand> queueProcessor = new AzureStorageQueueBackoffProcessor <TCommand>(
                _backoffPolicyFactory.Create(),
                _serializer,
                queue,
                item => _commandQueueProcessor.HandleRecievedItemAsync <TCommand, TResult>(item, maxDequeueCount),
                traceLogger,
                _commandQueueProcessor.DequeueErrorHandler);

            return(queueProcessor.StartAsync(cancellationToken));
        }