Uploaded image for project: 'AMQ Streams'
  1. AMQ Streams
  2. ENTMQST-4390

Refactor KafkaConfig files in Strimzi Client Examples

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • Client Examples
    • False
    • Hide

      None

      Show
      None
    • False
    • Done
    • 0% To Do, 0% In Progress, 100% Done

      This proposal is about simplifying the Kafka*Config files of the Java modules of the Strimzi Client Examples repo.

      Current situation

      The Kafka*Config files of the Java modules in the Strimzi Client Examples repo have become quite complex since they support the configuration of several specific Kafka client properties via environment variables. They contain a lot of the logic for configuring the client. As an example, you can have a look at the logic around setting Kafka’s security.protocol option which is spread across several places in the code.https://github.com/strimzi/proposals/blob/main/040-refactor-client-examples.md#motivation

      Motivation

      The main purpose of the Client Examples is to show users how to write a simple Kafka client based on the Kafka Consumer, Producer and Streams API. However, over time, we added a lot of complexity to the client code because it was being used in the System Tests at some point in time. So a user who wants to learn from the Client Examples has to dig through this code to understand how they are configured. This is currently not easy because of how the configuration is generated through the Java code. In addition to that, we found adding Kafka client configuration updates to the Kafka*Config files of the Java modules in the Strimzi Client Examples repo to be a little more verbose and messier than necessary. The current method requires creating a field, getter, setter, and hard coded String per new Kafka client config field. This method does not scale well and makes for a longer and messier class. So for any users who want to write their own Kafka client in Java, this is neither a good inspiration nor good code to copy.

      Proposal

      We could greatly reduce the complexity and size of the class if we standardize the naming scheme of environment variables used to configure the clients of the Strimzi Client Examples repo. For more details read up on the upstream proposal [1]

       

      [1] https://github.com/strimzi/proposals/blob/main/040-refactor-client-examples.md

              rh-ee-ocorriga Owen Corrigan
              kliberti Kyle Liberti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: