当前位置: 首页>>代码示例>>Java>>正文


Java AmazonKinesis.describeStream方法代码示例

本文整理汇总了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;
}
 
开发者ID:trulia,项目名称:stail,代码行数:19,代码来源:Stail.java

示例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;
}
 
开发者ID:apache,项目名称:beam,代码行数:11,代码来源:KinesisIO.java

示例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;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:15,代码来源:KinesisSourceIT.java


注:本文中的com.amazonaws.services.kinesis.AmazonKinesis.describeStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。