private static void createStreamIfNotExists ( AmazonKinesis kinesis , String streamName , int shardCount ) { performAmazonActionWithRetry ( "createStream" , ( ) -> { DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest ( ) . withStreamName ( streamName ) . withLimit ( 1 ) ; try { kinesis . describeStream ( describeStreamRequest ) ; } catch ( ResourceNotFoundException e ) { kinesis . createStream ( streamName , shardCount ) ; } return null ; } , DEFAULT_RETRY_COUNT , DEFAULT_RETRY_DURATION_IN_MILLIS ) ; }
Create a stream if it does not already exist .