Adding Configuration Recommendations to the Kafka Kinesis Connector

October 08, 2019

So, we've strengthened up our configuration validation logic for the Kafka Kinesis Connector but there's still more we can do to help those that want to use this plugin. Of course, the principles used in these articles should generally apply to most any Kafka Connector you create. The next step is to help recommend configuration values to our users. For example, we can validate that a user has given us a valid AWS region, e.g. us-east-1, us-west-1, etc. but the user may not know all the valid regions available. For this purpose, we can provide a recommender to help recommend values to the user by implementing the ConfigDef.Recommender interface.

Here is a simple region recommender implementation (VALID_REGIONS is an array of region names pulled in via RegionUtils):

private static final Recommender REGION_RECOMMENDER = regionRecommender();

// ...

private static Recommender regionRecommender() {
    return new Recommender() {
        public List<Object> validValues(String name, Map<String, Object> parsedConfig) {
            return Arrays.asList(VALID_REGIONS);

        public boolean visible(String name, Map<String, Object> parsedConfig) {
            return true;

We need to provide an implementation of the validValues and visible methods. Thankfully, in this case, the AWS libraries provide us with an easy way to get the information we need for the valid value recommendations.

It should be noted, however, that the recommenders are not used by the default implementation of validate() and you'll need to override it if you wish to use the recommender values when validating. For now, I have left the validate() method alone since my validator for the region is a one liner:

private static final Validator REGION_VALIDATOR =

You can take a look at the full class, if you'd like.

In the future, I hope to go a bit more in depth and use the recommended values during validation, just for the sake of completeness.