private async Task CreateRawStreamAsync() { _logger.LogWarning("Creating Raw Measurements Stream: {0}", _rawStreamName); CreateStreamRequest request = new CreateStreamRequest { ShardCount = 1, StreamName = _rawStreamName }; await _client.CreateStreamAsync(request); }
/// <summary> /// Creates a new Kinesis stream. /// </summary> /// <param name="client">An initialized Kinesis client.</param> /// <param name="streamName">The name for the new stream.</param> /// <param name="shardCount">The number of shards the new stream will /// use. The throughput of the stream is a function of the number of /// shards; more shards are required for greater provisioned /// throughput.</param> /// <returns>A Boolean value indicating whether the stream was created.</returns> public static async Task <bool> CreateNewStreamAsync(IAmazonKinesis client, string streamName, int shardCount) { var request = new CreateStreamRequest { StreamName = streamName, ShardCount = shardCount, }; var response = await client.CreateStreamAsync(request); return(response.HttpStatusCode == System.Net.HttpStatusCode.OK); }
static CreateStreamResponse CreateStream(IAmazonKinesis kinesisClient, string streamName, int shardCount) { var request = new CreateStreamRequest { StreamName = streamName, ShardCount = shardCount }; try { var createStreamResponse = kinesisClient.CreateStreamAsync(request); return(createStreamResponse.GetAwaiter().GetResult()); } catch (AmazonServiceException e) { var error = string.Format("Failed to create stream '{0}'. Reason: {1}", streamName, e.Message); SelfLog.WriteLine(error); return(null); } }
private Amazon.Kinesis.Model.CreateStreamResponse CallAWSServiceOperation(IAmazonKinesis client, Amazon.Kinesis.Model.CreateStreamRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis", "CreateStream"); try { #if DESKTOP return(client.CreateStream(request)); #elif CORECLR return(client.CreateStreamAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }