Ask questionsMechanism of obtaining consumer settings through the groupId qualifier does not work for groups in the upper snake case pattern.

When defining a groupId in the upper snake case pattern (e.g: MY_GROUP_ID), KafkaConsumerProcessor is unable to obtain my customer's customized settings.

Steps to Reproduce

  1. Up the apache kafka stack, creating a topic named my-products and an groupId MY_GROUP_ID.

  2. Create a micronaut application with a consumer with the groupId MY_GROUP_ID.

        servers: localhost:9092
          value: io.confluent.kafka.serializers.KafkaJsonDeserializer
    import io.micronaut.configuration.kafka.annotation.KafkaKey
    import io.micronaut.configuration.kafka.annotation.KafkaListener
    import io.micronaut.configuration.kafka.annotation.OffsetReset
    import io.micronaut.configuration.kafka.annotation.Topic
        offsetReset = OffsetReset.EARLIEST,
        groupId = "MY_GROUP_ID"
    class ProductConsumer {
        fun receive(@KafkaKey brand: String, product: Product) {
            println("Got Product - ${} by $brand")
    data class Product(var name: String)

Expected Behaviour

Custom consumer settings must be obtained. The consumer does not assume the io.confluent.kafka.serializers.KafkaJsonDeserializer value deserializer.

class: io.micronaut.configuration.kafka.processor.KafkaConsumerProcessor method: public void process(BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method)

The code block below is contained in the class and method specified above. This is the mechanism that fetches the consumer custom configuration bean through the qualifier by name using the groupId. I believe that the error lies in this mechanism.

AbstractKafkaConsumerConfiguration consumerConfigurationDefaults = 
           beanContext.findBean(AbstractKafkaConsumerConfiguration.class, Qualifiers.byName(groupId))

Actual Behaviour

Custom consumer settings are not obtained.

Environment Information

  • Operating System: Ubuntu 20.04
  • Micronaut Version: 2.4.1
  • JDK Version: 11

Example Application


Answer questions NilMouraa

@graemerocher could you confirm if this is really a bug? Because if it is, I have a suggested solution for that. I can contribute with you.


Related questions

No questions were found.
Github User Rank List