public class GetRecordsRequest extends AmazonWebServiceRequest implements Serializable
GetRecords operation
.
Gets data records from a shard.
You specify a shard iterator for the shard using the
ShardIterator
parameter. The shard iterator specifies the
position in the shard from which you want to start reading data
records sequentially. GetRecords
returns a new shard
iterator in NextShardIterator
.
If the shard has been closed, the shard iterator can't
return more data and GetRecords
returns null
in NextShardIterator
.
To read from an Amazon Kinesis stream continually, use
GetShardIterator to get the shard iterator to specify in the first
GetRecords
call, and then specify the shard iterator
returned in NextShardIterator
in subsequent calls.
If there are no records available, GetRecords
returns an
empty list.
The size of the data returned by GetRecords
will vary,
but the maximum size is 10 MB. Each data record can be up to 50 KB in
size, and each shard can read up to 2 MB per second. You can ensure
that your calls don't exceed the maximum size or throughput by using
the Limit
parameter to specify the maximum number of
records that GetRecords
can return. Consider your average
record size when specifying a limit. For example, if your average
record size is 40 KB, you can limit the data returned to about 1 MB
per call using a limit of 25.
If there is insufficient provisioned throughput on the shard involved
in the request, subsequent calls to GetRecords
made
within the next one second throw
ProvisionedThroughputExceededException
.
GetRecords
won't return data when it
throws an exception, so wait one second before making another call or
the application won't get any records. Also, you can scale by
provisioning multiple shards.
To detect whether you are falling behind in processing, add a timestamp to your records and note how long it takes to process them.
NOOP
Constructor and Description |
---|
GetRecordsRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Integer |
getLimit()
The maximum size of data to return, in MB.
|
String |
getShardIterator()
The position in the shard from which you want to start sequentially
reading data records.
|
int |
hashCode() |
void |
setLimit(Integer limit)
The maximum size of data to return, in MB.
|
void |
setShardIterator(String shardIterator)
The position in the shard from which you want to start sequentially
reading data records.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
GetRecordsRequest |
withLimit(Integer limit)
The maximum size of data to return, in MB.
|
GetRecordsRequest |
withShardIterator(String shardIterator)
The position in the shard from which you want to start sequentially
reading data records.
|
copyPrivateRequestParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public String getShardIterator()
Constraints:
Length: 1 - 512
public void setShardIterator(String shardIterator)
Constraints:
Length: 1 - 512
shardIterator
- The position in the shard from which you want to start sequentially
reading data records. A shard iterator specifies this position using
the sequence number of a data record in the shard.public GetRecordsRequest withShardIterator(String shardIterator)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 512
shardIterator
- The position in the shard from which you want to start sequentially
reading data records. A shard iterator specifies this position using
the sequence number of a data record in the shard.public Integer getLimit()
GetRecords
throws InvalidArgumentException
.
Constraints:
Range: 1 - 10000
GetRecords
throws InvalidArgumentException
.public void setLimit(Integer limit)
GetRecords
throws InvalidArgumentException
.
Constraints:
Range: 1 - 10000
limit
- The maximum size of data to return, in MB. Specify a value of up to
10,000. If you specify a value that is greater than 10,000,
GetRecords
throws InvalidArgumentException
.public GetRecordsRequest withLimit(Integer limit)
GetRecords
throws InvalidArgumentException
.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Range: 1 - 10000
limit
- The maximum size of data to return, in MB. Specify a value of up to
10,000. If you specify a value that is greater than 10,000,
GetRecords
throws InvalidArgumentException
.public String toString()
toString
in class Object
Object.toString()
Copyright © 2014. All rights reserved.