vertx / io.vertx.kafka.client.consumer / KafkaReadStream / subscribe

subscribe

abstract fun subscribe(topics: MutableSet<String>): KafkaReadStream<K, V>

Subscribe to the given list of topics to get dynamically assigned partitions.

Parameters

topics - topics to subscribe to

Return
current KafkaReadStream instance

abstract fun subscribe(topics: MutableSet<String>, completionHandler: Handler<AsyncResult<Void>>): KafkaReadStream<K, V>

Subscribe to the given list of topics to get dynamically assigned partitions.

Due to internal buffering of messages, when changing the subscribed topics the old set of topics may remain in effect (as observed by the #handler(Handler) record handler}) until some time after the given completionHandler is called. In contrast, the once the given completionHandler is called the #batchHandler(Handler) will only see messages consistent with the new set of topics.

Parameters

topics - topics to subscribe to

completionHandler - handler called on operation completed

Return
current KafkaReadStream instance