use of software.amazon.awssdk.services.kinesis.model.DescribeStreamSummaryResponse in project flink by apache.
the class KinesisProxyV2Test method testDescribeStreamSummary.
@Test
public void testDescribeStreamSummary() throws Exception {
KinesisAsyncClient client = mock(KinesisAsyncClient.class);
KinesisProxyV2 proxy = new KinesisProxyV2(client, mock(SdkAsyncHttpClient.class), createConfiguration(), mock(FullJitterBackoff.class));
DescribeStreamSummaryResponse expected = DescribeStreamSummaryResponse.builder().build();
ArgumentCaptor<DescribeStreamSummaryRequest> requestCaptor = ArgumentCaptor.forClass(DescribeStreamSummaryRequest.class);
when(client.describeStreamSummary(requestCaptor.capture())).thenReturn(CompletableFuture.completedFuture(expected));
DescribeStreamSummaryResponse actual = proxy.describeStreamSummary("stream");
assertEquals(expected, actual);
DescribeStreamSummaryRequest request = requestCaptor.getValue();
assertEquals("stream", request.streamName());
}
use of software.amazon.awssdk.services.kinesis.model.DescribeStreamSummaryResponse in project flink by apache.
the class StreamConsumerRegistrar method registerStreamConsumer.
/**
* Register a stream consumer with the given name against the given stream. Blocks until the
* consumer becomes active. If the stream consumer already exists, the ARN is returned.
*
* @param stream the stream to register the stream consumer against
* @param streamConsumerName the name of the new stream consumer
* @return the stream consumer ARN
* @throws ExecutionException
* @throws InterruptedException
*/
public String registerStreamConsumer(final String stream, final String streamConsumerName) throws ExecutionException, InterruptedException {
LOG.debug("Registering stream consumer - {}::{}", stream, streamConsumerName);
int attempt = 1;
if (configuration.getEfoRegistrationType() == LAZY) {
registrationBackoff(configuration, backoff, attempt++);
}
DescribeStreamSummaryResponse describeStreamSummaryResponse = kinesisProxyV2Interface.describeStreamSummary(stream);
String streamArn = describeStreamSummaryResponse.streamDescriptionSummary().streamARN();
LOG.debug("Found stream ARN - {}", streamArn);
Optional<DescribeStreamConsumerResponse> describeStreamConsumerResponse = describeStreamConsumer(streamArn, streamConsumerName);
if (!describeStreamConsumerResponse.isPresent()) {
invokeIgnoringResourceInUse(() -> kinesisProxyV2Interface.registerStreamConsumer(streamArn, streamConsumerName));
}
String streamConsumerArn = waitForConsumerToBecomeActive(describeStreamConsumerResponse.orElse(null), streamArn, streamConsumerName, attempt);
LOG.debug("Using stream consumer - {}", streamConsumerArn);
return streamConsumerArn;
}
Aggregations