Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-8619

Allow instances to be passed instead of Classes or Strings for configuration

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 2.3.0
    • None
    • None

    Description

      The getConfiguredInstances method of AbstractConfig currently forces values to be either a Class instantiated directly by Kafka or a String that uses dynamic classloading.

      This limits how DI systems can integrate with Kafka since if you want to inject an existing Spring, Micronaut, Guice etc. bean to for example by your Metrics reporter then there is no way to do that currently.

      What would be useful is if a simple statement such as:

      if (t.isInstance(klazz))  {
          o = klazz;
      }
      

      Could be added here:

      https://github.com/apache/kafka/blob/53b837f9c604cdb8a5a77a9363fc058b9ef9cd7e/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L421

      This would make it possible to specify instances that are not instantiated by Kafka.

      Attachments

        Activity

          People

            Unassigned Unassigned
            graemerocher1 Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: