software.amazon.awssdk.services.kinesis.model.StreamStatus Java Examples
The following examples show how to use
software.amazon.awssdk.services.kinesis.model.StreamStatus.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntegrationTestBase.java From aws-sdk-java-v2 with Apache License 2.0 | 6 votes |
protected static void createKinesisStream() { kinesis = KinesisClient.builder().credentialsProvider(CREDENTIALS_PROVIDER_CHAIN).region(Region.US_WEST_2).build(); kinesis.createStream(CreateStreamRequest.builder().streamName(KINESIS_STREAM_NAME).shardCount(1).build()); StreamDescription description = kinesis.describeStream(DescribeStreamRequest.builder().streamName(KINESIS_STREAM_NAME).build()) .streamDescription(); streamArn = description.streamARN(); // Wait till stream is active (less than a minute) Instant start = Instant.now(); while (StreamStatus.ACTIVE != description.streamStatus()) { if (Duration.between(start, Instant.now()).toMillis() > MAX_WAIT_TIME.toMillis()) { throw new RuntimeException("Timed out waiting for stream to become active"); } try { Thread.sleep(5000); } catch (InterruptedException ignored) { // Ignored or expected. } description = kinesis.describeStream(DescribeStreamRequest.builder().streamName(KINESIS_STREAM_NAME).build()) .streamDescription(); } }
Example #2
Source File: ShardSyncTaskIntegrationTest.java From amazon-kinesis-client with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUpBeforeClass() throws Exception { // ClientAsyncHttpConfiguration configuration = ClientAsyncHttpConfiguration.builder().httpClientFactory( // NettySdkHttpClientFactory.builder().trustAllCertificates(true).maxConnectionsPerEndpoint(10).build()) // .build(); // kinesisClient = KinesisAsyncClient.builder().asyncHttpConfiguration(configuration) // .endpointOverride(new URI("https://aws-kinesis-alpha.corp.amazon.com")).region(Region.US_EAST_1) // .build(); // try { CreateStreamRequest req = CreateStreamRequest.builder().streamName(STREAM_NAME).shardCount(1).build(); kinesisClient.createStream(req); } catch (KinesisException ase) { ase.printStackTrace(); } StreamStatus status; // do { // status = StreamStatus.fromValue(kinesisClient.describeStreamSummary( // DescribeStreamSummaryRequest.builder().streamName(STREAM_NAME).build()).get() // .streamDescriptionSummary().streamStatusString()); // } while (status != StreamStatus.ACTIVE); // }
Example #3
Source File: KinesisIntegrationTests.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
private List<Shard> waitForStream(final String streamName) throws InterruptedException { while (true) { DescribeStreamResponse result = client.describeStream(DescribeStreamRequest.builder().streamName(streamName).build()); Assert.assertNotNull(result); StreamDescription description = result.streamDescription(); Assert.assertNotNull(description); Assert.assertEquals(streamName, description.streamName()); Assert.assertNotNull(description.streamARN()); Assert.assertFalse(description.hasMoreShards()); StreamStatus status = description.streamStatus(); Assert.assertNotNull(status); if (status == StreamStatus.ACTIVE) { List<Shard> shards = description.shards(); validateShards(shards); return shards; } if (!(status == StreamStatus.CREATING || status == StreamStatus.UPDATING)) { Assert.fail("Unexpected status '" + status + "'"); } Thread.sleep(1000); } }
Example #4
Source File: KinesisAppender.java From kinesis-logback-appender with Apache License 2.0 | 5 votes |
@Override protected void validateStreamName(KinesisAsyncClient client, String streamName) { DescribeStreamResponse describeResult; try { describeResult = getClient().describeStream(b -> b.streamName(streamName).build()).get(); StreamStatus streamStatus = describeResult.streamDescription().streamStatus(); if(!StreamStatus.ACTIVE.equals(streamStatus) && !StreamStatus.UPDATING.equals(streamStatus)) { setInitializationFailed(true); addError("Stream " + streamName + " is not ready (in active/updating status) for appender: " + name); } } catch(InterruptedException ie) { setInitializationFailed(true); addError("Interrupted while attempting to describe " + streamName, ie); } catch(ExecutionException ee) { setInitializationFailed(true); addError("Error executing the operation", ee); } catch(ResourceNotFoundException rnfe) { setInitializationFailed(true); addError("Stream " + streamName + " doesn't exist for appender: " + name, rnfe); } catch(AwsServiceException ase) { setInitializationFailed(true); addError("Error connecting to AWS to verify stream " + streamName + " for appender: " + name, ase); } }
Example #5
Source File: SubscribeToShardIntegrationTest.java From aws-sdk-java-v2 with Apache License 2.0 | 4 votes |
private void waitForStreamToBeActive() { Waiter.run(() -> asyncClient.describeStream(r -> r.streamName(streamName)).join()) .until(b -> b.streamDescription().streamStatus().equals(StreamStatus.ACTIVE)) .orFailAfter(Duration.ofMinutes(5)); }
Example #6
Source File: KinesisStabilityTest.java From aws-sdk-java-v2 with Apache License 2.0 | 4 votes |
private void waitForStreamToBeActive() { Waiter.run(() -> asyncClient.describeStream(r -> r.streamName(streamName)) .join()) .until(b -> b.streamDescription().streamStatus().equals(StreamStatus.ACTIVE)) .orFailAfter(Duration.ofMinutes(5)); }
Example #7
Source File: FanOutConsumerRegistrationTest.java From amazon-kinesis-client with Apache License 2.0 | 4 votes |
private DescribeStreamSummaryResponse createDescribeStreamSummaryResponse() { return DescribeStreamSummaryResponse.builder().streamDescriptionSummary(StreamDescriptionSummary.builder() .streamName(STREAM_NAME).streamARN(STREAM_ARN).streamStatus(StreamStatus.ACTIVE).build()).build(); }