Пример #1
0
        private void ProcessPutRecordsRequest()
        {
            StdErrorOut.Instance.StdOut(LogLevel.debug, "Kinesis.Execute before build PutRecordsRequest");
            var req = new Amazon.Kinesis.Model.PutRecordsRequest()
            {
                StreamName = prRequest_.stream(),
                Records    = BuildPutRecordsRequestEntries(prRequest_)
            };

            StdErrorOut.Instance.StdOut(LogLevel.debug, "Kinesis.Execute after build PutRecordsRequest");
            CancellationTokenSource cts = new CancellationTokenSource();
            CancellationToken       ct  = cts.Token;
            var responseTask            = kinesisClient_.PutRecordsAsync(req, ct);

            responseTask.Wait(timeout_, ct);
            if (responseTask.IsCompleted)
            {
                response_ = new AwsKinesisResponse(responseTask.Result);
                succeed();
            }
            if (!responseTask.IsCompleted)
            {
                cts.Cancel();
                fail("Failed to put records tp the Kinesis Stream");
            }
        }
Пример #2
0
        private void ProcessDescribeStream()
        {
            var req = new Amazon.Kinesis.Model.DescribeStreamRequest()
            {
                StreamName            = dsRequest_.Stream,
                ExclusiveStartShardId = dsRequest_.ExclusiveStartShardId,
                Limit = dsRequest_.Limit
            };

            CancellationTokenSource cts = new CancellationTokenSource();
            CancellationToken       ct  = cts.Token;

            StdErrorOut.Instance.StdOut(LogLevel.debug, "Kinesis.Execute before kinesisClient_.DescribeStreamAsync(req, ct)");
            var responseTask = kinesisClient_.DescribeStreamAsync(req, ct);

            responseTask.Wait(timeout_, ct);
            if (responseTask.IsCompleted)
            {
                response_ = new AwsKinesisResponse(responseTask.Result);
                succeed();
            }
            if (!responseTask.IsCompleted)
            {
                cts.Cancel();
                fail("Failed to describe Kinesis Stream");
            }
        }
Пример #3
0
 public AwsKinesisResult(string error, AwsKinesisResponse response, object context, DateTime start_time, DateTime end_time)
 {
     response_   = response;
     error_      = error;
     context_    = context;
     start_time_ = start_time;
     end_time_   = end_time;
 }
Пример #4
0
 public AwsKinesisResult(AwsKinesisResponse response, object context, DateTime start_time, DateTime end_time)
 {
     response_    = response;
     context_     = context;
     start_time_  = start_time;
     end_time_    = end_time;
     status_Code_ = response.PutRecordsResponse != null ? response.PutRecordsResponse.HttpStatusCode : (response.DescribeStreamResponse != null ? response.DescribeStreamResponse.HttpStatusCode : HttpStatusCode.BadRequest);
 }