Пример #1
0
        /// <summary>
        /// Retrieves the stream records from a given shard.
        ///
        ///
        /// <para>
        /// Specify a shard iterator using the <code>ShardIterator</code> parameter. The shard
        /// iterator specifies the position in the shard from which you want to start reading
        /// stream records sequentially. If there are no stream records available in the portion
        /// of the shard that the iterator points to, <code>GetRecords</code> returns an empty
        /// list. Note that it might take multiple calls to get to a portion of the shard that
        /// contains stream records.
        /// </para>
        ///  <note>
        /// <para>
        /// GetRecords can retrieve a maximum of 1 MB of data or 2000 stream records, whichever
        /// comes first.
        /// </para>
        /// </note>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetRecords service method.</param>
        ///
        /// <returns>The response from the GetRecords service method, as returned by DynamoDBStreams.</returns>
        /// <exception cref="Amazon.DynamoDBv2.Model.ExpiredIteratorException">
        /// The shard iterator has expired and can no longer be used to retrieve stream records.
        /// A shard iterator expires 15 minutes after it is retrieved using the <i>GetShardIterator</i>
        /// action.
        /// </exception>
        /// <exception cref="Amazon.DynamoDBv2.Model.InternalServerErrorException">
        /// An error occurred on the server side.
        /// </exception>
        /// <exception cref="Amazon.DynamoDBv2.Model.LimitExceededException">
        /// Your request rate is too high. The AWS SDKs for DynamoDB automatically retry requests
        /// that receive this exception. Your request is eventually successful, unless your retry
        /// queue is too large to finish. Reduce the frequency of requests and use exponential
        /// backoff. For more information, go to <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html#APIRetries">Error
        /// Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.
        /// </exception>
        /// <exception cref="Amazon.DynamoDBv2.Model.ResourceNotFoundException">
        /// The operation tried to access a nonexistent stream.
        /// </exception>
        /// <exception cref="Amazon.DynamoDBv2.Model.TrimmedDataAccessException">
        /// The operation attempted to read past the oldest stream record in a shard.
        ///
        ///
        /// <para>
        /// In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose
        /// age exceeds this limit are subject to removal (trimming) from the stream. You might
        /// receive a TrimmedDataAccessException if:
        /// </para>
        ///  <ul> <li>You request a shard iterator with a sequence number older than the trim
        /// point (24 hours).</li> <li>You obtain a shard iterator, but before you use the iterator
        /// in a <i>GetRecords</i> request, a stream record in the shard exceeds the 24 hour period
        /// and is trimmed. This causes the iterator to access a record that no longer exists.</li>
        /// </ul>
        /// </exception>
        public GetRecordsResponse GetRecords(GetRecordsRequest request)
        {
            var marshaller   = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return(Invoke <GetRecordsRequest, GetRecordsResponse>(request, marshaller, unmarshaller));
        }
Пример #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.GetRecords"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <GetRecordsResponse> GetRecordsAsync(GetRecordsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, GetRecordsRequest, GetRecordsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
        public void GetRecords_TrimmedDataAccessExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("GetRecords");

            var request         = InstantiateClassGenerator.Execute <GetRecordsRequest>();
            var marshaller      = new GetRecordsRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);
            var jsonRequest     = UTF8Encoding.UTF8.GetString(internalRequest.Content);

            Comparer.CompareObjectToJson <GetRecordsRequest>(request, jsonRequest);

            var exception    = operation.Exceptions.First(e => e.Name.Equals("TrimmedDataAccessException"));
            var jsonResponse = new JsonSampleGenerator(service_model, exception).Execute();
            var webResponse  = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString()                                  },
                    { "x-amz-crc32",      "0"                                                        },
                    { "x-amzn-ErrorType", "TrimmedDataAccessException"                               },
                    { "Content-Length",   UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString() }
                }
            };
            var context  = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), true, webResponse, true);
            var response = GetRecordsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK);

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Пример #4
0
        public void GetRecordsMarshallTest()
        {
            var request    = InstantiateClassGenerator.Execute <GetRecordsRequest>();
            var marshaller = new GetRecordsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest     = UTF8Encoding.UTF8.GetString(internalRequest.Content);

            Comparer.CompareObjectToJson <GetRecordsRequest>(request, jsonRequest);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };
            var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetRecords").ResponseStructure).Execute();

            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = GetRecordsResponseUnmarshaller.Instance.Unmarshall(context)
                           as GetRecordsResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Пример #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation on AmazonDynamoDBStreamsClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetRecords
        ///         operation.</returns>
        public IAsyncResult BeginGetRecords(GetRecordsRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return(BeginInvoke <GetRecordsRequest>(request, marshaller, unmarshaller,
                                                   callback, state));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/GetRecords">REST API Reference for GetRecords Operation</seealso>
        public virtual Task <GetRecordsResponse> GetRecordsAsync(GetRecordsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return(InvokeAsync <GetRecordsRequest, GetRecordsResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
Пример #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation on AmazonKinesisClient.</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        public void GetRecordsAsync(GetRecordsRequest request, AmazonServiceCallback <GetRecordsRequest, GetRecordsResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <GetRecordsRequest, GetRecordsResponse> responseObject
                        = new AmazonServiceResult <GetRecordsRequest, GetRecordsResponse>((GetRecordsRequest)req, (GetRecordsResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <GetRecordsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
        public void GetRecordsMarshallTest()
        {
            var request = InstantiateClassGenerator.Execute<GetRecordsRequest>();
            var marshaller = new GetRecordsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content);                        
            Comparer.CompareObjectToJson<GetRecordsRequest>(request,jsonRequest);

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };
            var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("GetRecords").ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = GetRecordsResponseUnmarshaller.Instance.Unmarshall(context)
                as GetRecordsResponse;
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Пример #9
0
        /// <summary>
        /// <para>This operation returns one or more data records from a shard. A <c>GetRecords</c> operation request can retrieve up to 10 MB of
        /// data.</para> <para>You specify a shard iterator for the shard that you want to read data from in the <c>ShardIterator</c> parameter. The
        /// shard iterator specifies the position in the shard from which you want to start reading data records sequentially. A shard iterator
        /// specifies this position using the sequence number of a data record in the shard. For more information about the shard iterator, see
        /// GetShardIterator.</para> <para> <c>GetRecords</c> may return a partial result if the response size limit is exceeded. You will get an error,
        /// but not a partial result if the shard's provisioned throughput is exceeded, the shard iterator has expired, or an internal processing
        /// failure has occurred. Clients can request a smaller amount of data by specifying a maximum number of returned records using the <c>Limit</c>
        /// parameter. The <c>Limit</c> parameter can be set to an integer value of up to 10,000. If you set the value to an integer greater than
        /// 10,000, you will receive <c>InvalidArgumentException</c> .</para> <para>A new shard iterator is returned by every <c>GetRecords</c> request
        /// in <c>NextShardIterator</c> ,
        /// which you use in the <c>ShardIterator</c> parameter of the next <c>GetRecords</c> request. When you repeatedly read from an
        /// Amazon Kinesis stream use a GetShardIterator request to get the first shard iterator to use in your first <c>GetRecords</c> request and then
        /// use the shard iterator returned in <c>NextShardIterator</c> for subsequent reads.</para> <para> <c>GetRecords</c> can return <c>null</c> for
        /// the <c>NextShardIterator</c> to reflect that the shard has been closed and that the requested shard iterator would never have returned more
        /// data. </para> <para>If no items can be processed because of insufficient provisioned throughput on the shard involved in the request,
        /// <c>GetRecords</c> throws <c>ProvisionedThroughputExceededException</c> .</para>
        /// </summary>
        /// 
        /// <param name="getRecordsRequest">Container for the necessary parameters to execute the GetRecords service method on AmazonKinesis.</param>
        /// 
        /// <returns>The response from the GetRecords service method, as returned by AmazonKinesis.</returns>
        /// 
        /// <exception cref="T:Amazon.Kinesis.Model.ProvisionedThroughputExceededException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ExpiredIteratorException" />
        /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<GetRecordsResponse> GetRecordsAsync(GetRecordsRequest getRecordsRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, GetRecordsRequest, GetRecordsResponse>(getRecordsRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Пример #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<GetRecordsResponse> GetRecordsAsync(GetRecordsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return InvokeAsync<GetRecordsRequest,GetRecordsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Пример #11
0
        internal GetRecordsResponse GetRecords(GetRecordsRequest request)
        {
            var marshaller = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return Invoke<GetRecordsRequest,GetRecordsResponse>(request, marshaller, unmarshaller);
        }
Пример #12
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetRecords operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetRecords operation on AmazonKinesisClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetRecords
        ///         operation.</returns>
        public IAsyncResult BeginGetRecords(GetRecordsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetRecordsRequestMarshaller();
            var unmarshaller = GetRecordsResponseUnmarshaller.Instance;

            return BeginInvoke<GetRecordsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Пример #13
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetRecords operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the GetRecords operation on AmazonKinesisClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void GetRecordsAsync(GetRecordsRequest request, AmazonServiceCallback<GetRecordsRequest, GetRecordsResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new GetRecordsRequestMarshaller();
     var unmarshaller = GetRecordsResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<GetRecordsRequest,GetRecordsResponse> responseObject 
                     = new AmazonServiceResult<GetRecordsRequest,GetRecordsResponse>((GetRecordsRequest)req, (GetRecordsResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<GetRecordsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Пример #14
0
 IAsyncResult invokeGetRecords(GetRecordsRequest getRecordsRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new GetRecordsRequestMarshaller().Marshall(getRecordsRequest);
     var unmarshaller = GetRecordsResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }