GetRecordsResponse GetRecords (AmazonKinesisClient client, string shardId) { var siRequest = new GetShardIteratorRequest (); siRequest.ShardId = shardId; siRequest.StreamName = "Test1"; siRequest.ShardIteratorType = "TRIM_HORIZON"; var siResponse = client.GetShardIterator (siRequest); var request = new GetRecordsRequest (); request.ShardIterator = siResponse.ShardIterator; return client.GetRecords (request); }
/// <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); }
internal GetRecordsResponse GetRecords(GetRecordsRequest request) { var task = GetRecordsAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <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); }
/// <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); }
internal GetRecordsResponse GetRecords(GetRecordsRequest request) { var marshaller = new GetRecordsRequestMarshaller(); var unmarshaller = GetRecordsResponseUnmarshaller.Instance; return Invoke<GetRecordsRequest,GetRecordsResponse>(request, marshaller, unmarshaller); }
/// <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="request">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" /> public GetRecordsResponse GetRecords(GetRecordsRequest request) { var task = GetRecordsAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <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); }
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; }
/// <summary> /// Initiates the asynchronous execution of the GetRecords operation. /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.GetRecords"/> /// </summary> /// /// <param name="getRecordsRequest">Container for the necessary parameters to execute the GetRecords operation on AmazonKinesis.</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 getRecordsRequest, AsyncCallback callback, object state) { return invokeGetRecords(getRecordsRequest, callback, state, false); }
/// <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="ProvisionedThroughputExceededException"/> /// <exception cref="ExpiredIteratorException"/> /// <exception cref="InvalidArgumentException"/> /// <exception cref="ResourceNotFoundException"/> public GetRecordsResponse GetRecords(GetRecordsRequest getRecordsRequest) { IAsyncResult asyncResult = invokeGetRecords(getRecordsRequest, null, null, true); return EndGetRecords(asyncResult); }