javaapache-kafkaquarkusvert.x

Unable to create an instance of io.vertx.kafka.client.consumer.KafkaConsumer


I am updating a Quarkus application that ran on 2.14.3.Final to 3.2.10.Final.

I used to be able to instantiate a KafkaConsumer like this:

io.vertx.kafka.client.consumer.KafkaConsumer.create<String, String>(
        vertx,
        mapOf(
          ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG to kafkaServers,
          ConsumerConfig.GROUP_ID_CONFIG to "test_group",
          ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "earliest",
          ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to false.toString(),
          AbstractKafkaSchemaSerDeConfig.AUTO_REGISTER_SCHEMAS to true.toString(),
          AbstractKafkaSchemaSerDeConfig.SCHEMA_REFLECTION_CONFIG to false.toString(),
          AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG to schemaRegistryUrl,
          AbstractKafkaSchemaSerDeConfig.VALUE_SUBJECT_NAME_STRATEGY to TopicNameStrategy::class.java.canonicalName,
          ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java.canonicalName,
          ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to KafkaAvroDeserializer::class.java.canonicalName,
          KafkaAvroDeserializerConfig.SPECIFIC_AVRO_READER_CONFIG to true.toString(),
        )
      )

But now I am getting this error:

Cannot access class 'io.vertx.kafka.client.consumer.KafkaConsumer'. Check your module classpath for missing or conflicting dependencies

I found that for example the io.vertx.kafka.client.serialization.JsonObjectDeserializer moved to io.quarkus.kafka.client.serialization.JsonObjectDeserializer.

Where did the KafkConsumer move to?

Thanks in advance!


Solution

  • Since version 3.0 Quarkus no longer provides the vertx-kafka-client dependency. You need to add it yourself to your project.