Github user tzulitai commented on a diff in the pull request: https://github.com/apache/flink/pull/4228#discussion_r125445000 --- Diff: flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java --- @@ -117,12 +117,77 @@ // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + /** + * Creates a new Flink Kinesis Consumer that uses the AWS credentials and region provided from the AWS + * node with the stream initial position to LATEST. + * + * @param stream + * The single AWS Kinesis stream to read from. + * @param deserializer + * The deserializer used to convert raw bytes of Kinesis records to Java objects (without key). + */ + public FlinkKinesisConsumer(String stream, DeserializationSchema<T> deserializer) { + this(stream, new KinesisDeserializationSchemaWrapper<>(deserializer)); + } + + /** + * Creates a new Flink Kinesis Consumer that uses the AWS credentials and region provided from the AWS + * node with the provided initial position in the stream. + * + * @param stream + * @param deserializer + * @param initialPosition + */ + public FlinkKinesisConsumer(String stream, DeserializationSchema<T> deserializer, InitialPosition initialPosition) { + this(stream, new KinesisDeserializationSchemaWrapper<>(deserializer), initialPosition); + } + + /** + * Creates a new Flink Kinesis Consumer that uses the AWS credentials and region provided from the AWS + * node with the stream initial position to LATEST. + * + * @param stream + * The single AWS Kinesis stream to read from. + * @param deserializer + * The deserializer used to convert raw bytes of Kinesis records to Java objects (without key). + */ + public FlinkKinesisConsumer(String stream, KinesisDeserializationSchema<T> deserializer) { + this(stream, deserializer, getDefaultConfigProperties()); + } + + /** + * Creates a new Flink Kinesis Consumer that uses the AWS credentials and region provided from the AWS + * node with the provided initial position in the stream. + * + * @param stream + * The single AWS Kinesis stream to read from. + * @param deserializer + * The deserializer used to convert raw bytes of Kinesis records to Java objects (without key). + * @param initialPosition + * Where to start the Kinesis stream + */ + public FlinkKinesisConsumer(String stream, KinesisDeserializationSchema<T> deserializer, InitialPosition initialPosition) { + this(stream, deserializer, getDefaultPropsWithInitialPosition(initialPosition)); + } + + private static Properties getDefaultPropsWithInitialPosition(InitialPosition initialPosition) { + final Properties conf = getDefaultConfigProperties(); + conf.setProperty(ConsumerConfigConstants.STREAM_INITIAL_POSITION, initialPosition.name()); --- End diff -- This properties building is problematic. For example, we also have an `InitialPosition.AT_TIMESTAMP` configuration, which involves 2 keys in the properties.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---