本文整理汇总了Java中com.amazonaws.services.kinesis.AmazonKinesis.describeStream方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonKinesis.describeStream方法的具体用法?Java AmazonKinesis.describeStream怎么用?Java AmazonKinesis.describeStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.kinesis.AmazonKinesis
的用法示例。
在下文中一共展示了AmazonKinesis.describeStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShards
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static List<Shard> getShards(AmazonKinesis client, String stream) {
DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setStreamName(stream);
List<Shard> shards = new ArrayList<>();
String exclusiveStartShardId = null;
do {
describeStreamRequest.setExclusiveStartShardId(exclusiveStartShardId);
DescribeStreamResult describeStreamResult = client.describeStream(describeStreamRequest);
shards.addAll(describeStreamResult.getStreamDescription().getShards());
if (describeStreamResult.getStreamDescription().getHasMoreShards() && shards.size() > 0) {
exclusiveStartShardId = shards.get(shards.size() - 1).getShardId();
} else {
exclusiveStartShardId = null;
}
} while (exclusiveStartShardId != null);
return shards;
}
示例2: streamExists
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static boolean streamExists(AmazonKinesis client, String streamName) {
try {
DescribeStreamResult describeStreamResult = client.describeStream(streamName);
return (describeStreamResult != null
&& describeStreamResult.getSdkHttpMetadata().getHttpStatusCode() == 200);
} catch (Exception e) {
LOG.warn("Error checking whether stream {} exists.", streamName, e);
}
return false;
}
示例3: streamActive
import com.amazonaws.services.kinesis.AmazonKinesis; //导入方法依赖的package包/类
private static boolean streamActive(AmazonKinesis client, String streamName) {
try {
DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setStreamName(streamName);
DescribeStreamResult describeStreamResult = client.describeStream(describeStreamRequest);
String streamStatus = describeStreamResult.getStreamDescription().getStreamStatus();
if ("ACTIVE".equals(streamStatus)) {
return true;
}
} catch (Exception e) {
return false;
}
return false;
}