kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. Manna" <manme...@gmail.com>
Subject Re: list of pattern processed topic list
Date Mon, 19 Aug 2019 13:03:04 GMT
Kafka doesn’t have regex subscription. You could get a list of available
topic using admin client. From there, you can decide what topics you would
like to subscribe to (or process using your logic).

Check documentation for AdminClient.listTopics and ListTopicResult holder.

I hope this helps.

Regards,

On Mon, 19 Aug 2019 at 13:22, Upendra Yadav <upendra1024@gmail.com> wrote:

> Hi,
> I have initialised kafka consumer:
> KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<byte[],
> byte[]>(consumerConfig);
>
> and subscribed with topic pattern:
> consumer.subscribe(Pattern.compile(topicRegex), listener);
>
> now, I'm trying to get the list of topics.
> Map<String, List<PartitionInfo>> topicsPartitions = consumer.listTopics();
>
> here topic list is not following given pattern. it is giving all topic
> list.
> Is this expected behaviour? Is there any API to get subscribed topic list
> with consumer instance?
> or Do I need to write simple prog to process this list with same pattern?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message