use of org.rnorth.ducttape.ratelimits.RateLimiter in project flink by apache.
the class KinesisDataStreamsTableApiIT method prepareStream.
private void prepareStream(String streamName) throws Exception {
final RateLimiter rateLimiter = RateLimiterBuilder.newBuilder().withRate(1, SECONDS).withConstantThroughput().build();
kinesisClient.createStream(CreateStreamRequest.builder().streamName(streamName).shardCount(1).build()).get();
Deadline deadline = Deadline.fromNow(Duration.ofMinutes(1));
while (!rateLimiter.getWhenReady(() -> streamExists(streamName))) {
if (deadline.isOverdue()) {
throw new RuntimeException("Failed to create stream within time");
}
}
}
Aggregations