MetadataRequest is an AbstractRequest with METADATA API key that is used (and created) when:

MetadataRequest takes the following when created:

  • List of topics to request metadata for (can be empty)

  • allowAutoTopicCreation flag (that controls whether to auto-create a topic if unavailable at the time of a request or not)

MetadataRequest can be created using the following factory methods:

import org.apache.kafka.common.requests.MetadataRequest

val r = MetadataRequest.Builder.allTopics
scala> println(r)
(type=MetadataRequest, topics=<ALL>)

import collection.JavaConverters._
val topics = Seq("t1", "t2").asJava
val allowAutoTopicCreation = false
val r = new MetadataRequest.Builder(topics, allowAutoTopicCreation)
scala> println(r)
(type=MetadataRequest, topics=t1,t2)

allTopics Factory Method

// MetadataRequest.Builder.allTopics
Builder allTopics()

allTopics creates a new MetadataRequest for all topics and allowAutoTopicCreation flag on.

results matching ""

    No results matching ""