在Java的帮助下从AWS Kinesis流读取数据

时间:2019-06-18 09:40:05

标签: java amazon-web-services amazon-kinesis

我想在java / spring的帮助下从AWS kinesis读取示例数据。我得到了以下代码,尝试但出现错误-

  

java.lang.NoSuchFieldError:SERVICE_ID

请帮助或任何其他方式从AWS kinesis读取数据,然后与我分享。 谢谢。

DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setStreamName( streamName );
List<Shard> shards = new ArrayList<>();
String exclusiveStartShardId = null;
do {
//  describeStreamRequest.setExclusiveStartShardId( exclusiveStartShardId );
//  AmazonKinesisClient client= new AmazonKinesisClient();
    DescribeStreamResult describeStreamResult = client.describeStream( describeStreamRequest );
    System.out.println("describeStreamResult ------- " + describeStreamResult);
    shards.addAll( describeStreamResult.getStreamDescription().getShards() );
    if (describeStreamResult.getStreamDescription().getHasMoreShards() && shards.size() > 0) {
        exclusiveStartShardId = shards.get(shards.size() - 1).getShardId();
        System.out.println( "---------- exclusiveStartShardId --- " + exclusiveStartShardId);
    } else {
        exclusiveStartShardId = null;
    }
} while ( exclusiveStartShardId != null );
    
08:40:50.539 [main] DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
Exception in thread "main" java.lang.NoSuchFieldError: SERVICE_ID
    at com.amazonaws.services.kinesis.AmazonKinesisClient.executeDescribeStream(AmazonKinesisClient.java:861)
    at com.amazonaws.services.kinesis.AmazonKinesisClient.describeStream(AmazonKinesisClient.java:842)

0 个答案:

没有答案