use of org.apache.flink.streaming.connectors.kinesis.FlinkKinesisException.FlinkKinesisTimeoutException in project flink by apache.
the class StreamConsumerRegistrar method waitForConsumerToDeregister.
private void waitForConsumerToDeregister(@Nullable final DescribeStreamConsumerResponse describeStreamConsumerResponse, final String streamConsumerArn, final int initialAttempt) throws InterruptedException, ExecutionException {
int attempt = initialAttempt;
Instant start = Instant.now();
Duration timeout = configuration.getDeregisterStreamConsumerTimeout();
Optional<DescribeStreamConsumerResponse> response = Optional.ofNullable(describeStreamConsumerResponse);
while (response.isPresent() && response.get().consumerDescription().consumerStatus() != DELETING) {
LOG.debug("Waiting for stream consumer to deregister, attempt {} - {}", attempt, streamConsumerArn);
deregistrationBackoff(configuration, backoff, attempt++);
response = describeStreamConsumer(streamConsumerArn);
if (Duration.between(start, Instant.now()).compareTo(timeout) > 0) {
throw new FlinkKinesisTimeoutException("Timeout waiting for stream consumer to deregister: " + streamConsumerArn);
}
}
}
use of org.apache.flink.streaming.connectors.kinesis.FlinkKinesisException.FlinkKinesisTimeoutException in project flink by apache.
the class StreamConsumerRegistrar method waitForConsumerToBecomeActive.
private String waitForConsumerToBecomeActive(@Nullable final DescribeStreamConsumerResponse describeStreamConsumerResponse, final String streamArn, final String streamConsumerName, final int initialAttempt) throws InterruptedException, ExecutionException {
int attempt = initialAttempt;
Instant start = Instant.now();
Duration timeout = configuration.getRegisterStreamConsumerTimeout();
DescribeStreamConsumerResponse response = describeStreamConsumerResponse;
while (response == null || response.consumerDescription().consumerStatus() != ACTIVE) {
LOG.debug("Waiting for stream consumer to become active, attempt {} - {} on {}", attempt, streamConsumerName, streamArn);
registrationBackoff(configuration, backoff, attempt++);
response = kinesisProxyV2Interface.describeStreamConsumer(streamArn, streamConsumerName);
if (Duration.between(start, Instant.now()).compareTo(timeout) > 0) {
throw new FlinkKinesisTimeoutException("Timeout waiting for stream consumer to become active: " + streamConsumerName + " on " + streamArn);
}
}
return response.consumerDescription().consumerARN();
}
Aggregations