예제 #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetShardIterator operation.
        /// <seealso cref="Amazon.Kinesis.IAmazonKinesis.GetShardIterator"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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 <GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetShardIteratorRequestMarshaller();
            var unmarshaller = GetShardIteratorResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, GetShardIteratorRequest, GetShardIteratorResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
예제 #2
0
        internal GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request)
        {
            var marshaller   = new GetShardIteratorRequestMarshaller();
            var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance;

            return(Invoke <GetShardIteratorRequest, GetShardIteratorResponse>(request, marshaller, unmarshaller));
        }
예제 #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetShardIterator operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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 <GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetShardIteratorRequestMarshaller();
            var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance;

            return(InvokeAsync <GetShardIteratorRequest, GetShardIteratorResponse>(request, marshaller,
                                                                                   unmarshaller, cancellationToken));
        }
예제 #4
0
        public Task <IIterator> GetIteratorAsync(IShard shard, IteratorPosition position)
        {
            var request = new GetShardIteratorRequest(
                streamName: Name,
                shardId: shard.Id,
                type: ShardIteratorType.LATEST,
                startingSequenceNumber: position.Offset
                );

            return(retryPolicy.ExecuteAsync <IIterator>(async()
                                                        => await client.GetShardIteratorAsync(request).ConfigureAwait(false)
                                                        ));
        }
예제 #5
0
        /// <summary>
        /// <para>This operation returns a shard iterator in <c>ShardIterator</c> . 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
        /// a shard. A sequence number is the identifier associated with every record ingested in the Amazon Kinesis stream. The sequence number is
        /// assigned by the Amazon Kinesis service when a record is put into the stream. </para> <para>You must specify the shard iterator type in the
        /// <c>GetShardIterator</c> request. For example, you can set the <c>ShardIteratorType</c> parameter to read exactly from the position denoted
        /// by a specific sequence number by using the AT_SEQUENCE_NUMBER shard iterator type, or right after the sequence number by using the
        /// AFTER_SEQUENCE_NUMBER shard iterator type, using sequence numbers returned by earlier PutRecord, GetRecords or DescribeStream requests. You
        /// can specify the shard iterator type TRIM_HORIZON in the request to cause <c>ShardIterator</c> to point to the last untrimmed record in the
        /// shard in the system, which is the oldest data record in the shard. Or you can point to just after the most recent record in the shard, by
        /// using the shard iterator type LATEST, so that you always read the most recent data in the shard. </para> <para> <b>Note:</b> Each shard
        /// iterator expires five minutes after it is returned to the requester.</para> <para>When you repeatedly read from an Amazon Kinesis stream use
        /// a GetShardIterator request to get the first shard iterator to to use in your first <c>GetRecords</c> request and then use the shard iterator
        /// returned by the <c>GetRecords</c> request in <c>NextShardIterator</c> for subsequent reads. 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. </para> <para>If a
        /// <c>GetShardIterator</c> request is made too often, you will receive a <c>ProvisionedThroughputExceededException</c> .
        /// For more information about throughput limits, see the <a href="http://docs.aws.amazon.com/kinesis/latest/dev/">Amazon Kinesis
        /// Developer Guide</a> . </para> <para> <c>GetShardIterator</c> can return <c>null</c> for its <c>ShardIterator</c> to indicate that the shard
        /// has been closed and that the requested iterator will return no more data. A shard can be closed by a SplitShard or MergeShards
        /// operation.</para> <para> <c>GetShardIterator</c> has a limit of 5 transactions per second per account per open shard.</para>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetShardIterator service method on
        /// AmazonKinesis.</param>
        ///
        /// <returns>The response from the GetShardIterator service method, as returned by AmazonKinesis.</returns>
        ///
        /// <exception cref="T:Amazon.Kinesis.Model.ProvisionedThroughputExceededException" />
        /// <exception cref="T:Amazon.Kinesis.Model.InvalidArgumentException" />
        /// <exception cref="T:Amazon.Kinesis.Model.ResourceNotFoundException" />
        public GetShardIteratorResponse GetShardIterator(GetShardIteratorRequest request)
        {
            var task = GetShardIteratorAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
예제 #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetShardIterator operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetShardIterator 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 GetShardIteratorAsync(GetShardIteratorRequest request, AmazonServiceCallback <GetShardIteratorRequest, GetShardIteratorResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new GetShardIteratorRequestMarshaller();
            var unmarshaller = GetShardIteratorResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <GetShardIteratorRequest, GetShardIteratorResponse> responseObject
                        = new AmazonServiceResult <GetShardIteratorRequest, GetShardIteratorResponse>((GetShardIteratorRequest)req, (GetShardIteratorResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <GetShardIteratorRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
예제 #7
0
 public Task <GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest request)
 {
     return(SendAsync <GetShardIteratorResponse>("GetShardIterator", request));
 }
예제 #8
0
 public Task <GetShardIteratorResponse> GetShardIteratorAsync(GetShardIteratorRequest request)
 => SendAsync <GetShardIteratorResponse>("GetShardIterator", request);