示例#1
0
        public async Task <IWorkProvider> CreateAsync(string queues,
                                                      CancellationToken cancellationToken = default(CancellationToken))
        {
            var client   = new AmazonSQSClient(_basicAwsCredentials, _amazonSqsConfig);
            var response = await client.GetQueueUrlAsync(queues, cancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new InvalidOperationException("Could not load the queues url.");
            }

            var provider = new SqsWorkProvider(client, response.QueueUrl, 30, 10);

            return(provider);
        }
        public async Task <IWorkProvider> CreateAsync(string queues, CancellationToken cancellationToken = default(CancellationToken))
        {
            var client   = new AmazonSQSClient(_sqsQuidjiboConfiguration.Credentials, _sqsQuidjiboConfiguration.AmazonSqsConfig);
            var response = await client.GetQueueUrlAsync(queues, cancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new InvalidOperationException("Could not load the queues url.");
            }

            var provider = new SqsWorkProvider(
                _loggerFactory.CreateLogger <SqsWorkProvider>(),
                client,
                response.QueueUrl,
                _sqsQuidjiboConfiguration.Type,
                _sqsQuidjiboConfiguration.LockInterval,
                _sqsQuidjiboConfiguration.BatchSize,
                _sqsQuidjiboConfiguration.LongPollDuration);

            return(provider);
        }