本文整理汇总了Java中com.amazonaws.services.kinesis.AmazonKinesis.getShardIterator方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonKinesis.getShardIterator方法的具体用法?Java AmazonKinesis.getShardIterator怎么用?Java AmazonKinesis.getShardIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.kinesis.AmazonKinesis
的用法示例。
在下文中一共展示了AmazonKinesis.getShardIterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreviewRecords
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
public static List<com.amazonaws.services.kinesis.model.Record> getPreviewRecords(
ClientConfiguration awsClientConfig,
KinesisConfigBean conf,
int maxBatchSize,
GetShardIteratorRequest getShardIteratorRequest
) throws StageException {
AmazonKinesis kinesisClient = getKinesisClient(awsClientConfig, conf);
GetShardIteratorResult getShardIteratorResult = kinesisClient.getShardIterator(getShardIteratorRequest);
String shardIterator = getShardIteratorResult.getShardIterator();
GetRecordsRequest getRecordsRequest = new GetRecordsRequest();
getRecordsRequest.setShardIterator(shardIterator);
getRecordsRequest.setLimit(maxBatchSize);
GetRecordsResult getRecordsResult = kinesisClient.getRecords(getRecordsRequest);
return getRecordsResult.getRecords();
}
示例2: getShardIterator
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static String getShardIterator(AmazonKinesis client, String stream, Shard shard, String start) {
GetShardIteratorRequest getShardIteratorRequest = new GetShardIteratorRequest();
getShardIteratorRequest.setStreamName(stream);
getShardIteratorRequest.setShardId(shard.getShardId());
if (!Strings.isNullOrEmpty(start)) {
getShardIteratorRequest.setShardIteratorType(ShardIteratorType.AT_TIMESTAMP);
getShardIteratorRequest.setTimestamp(new Date(System.currentTimeMillis() - Duration.parse(start).toMillis()));
} else {
getShardIteratorRequest.setShardIteratorType(ShardIteratorType.LATEST);
}
GetShardIteratorResult getShardIteratorResult = client.getShardIterator(getShardIteratorRequest);
return getShardIteratorResult.getShardIterator();
}
示例3: getShardIteratorAtSequenceNumber
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static String getShardIteratorAtSequenceNumber(AmazonKinesis client, String stream, Shard shard, String sequenceNumber) {
GetShardIteratorRequest getShardIteratorRequest = new GetShardIteratorRequest();
getShardIteratorRequest.setStreamName(stream);
getShardIteratorRequest.setShardId(shard.getShardId());
getShardIteratorRequest.setShardIteratorType(ShardIteratorType.AT_SEQUENCE_NUMBER);
getShardIteratorRequest.setStartingSequenceNumber(sequenceNumber);
GetShardIteratorResult getShardIteratorResult = client.getShardIterator(getShardIteratorRequest);
return getShardIteratorResult.getShardIterator();
}
示例4: getOldestShardIterator
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static String getOldestShardIterator(AmazonKinesis client, String stream, Shard shard) {
GetShardIteratorRequest getShardIteratorRequest = new GetShardIteratorRequest();
getShardIteratorRequest.setStreamName(stream);
getShardIteratorRequest.setShardId(shard.getShardId());
getShardIteratorRequest.setShardIteratorType(ShardIteratorType.TRIM_HORIZON);
GetShardIteratorResult getShardIteratorResult = client.getShardIterator(getShardIteratorRequest);
return getShardIteratorResult.getShardIterator();
}