You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Ewen Cheslack-Postava <ew...@confluent.io> on 2016/11/27 01:51:15 UTC

Re: KafkaProducer.java topics() call?

Generally the producer knows the set of topics it wants to produce to
because it is fixed by the application (even if dynamic, there isn't
commonly much use in exposing this functionality). You're right it could be
implemented, but the use cases seem limited.

If you have a good use case, please follow up and we can always consider
extensions via a KIP discussion.

-Ewen

On Tue, Oct 25, 2016 at 5:46 PM, Scott Ferguson <sc...@98ws.net> wrote:

> Hey all,
>
> I sent this to the users list by mistake. This one's better suited...
>
> Bit of curiosity that came out of the background to this thread:
> http://search-hadoop.com/m/Kafka/uyzND1lLYXb136UfJ1?subj=
> programmatic+way+to+check+for+topic+existence+
>
> I noticed that KafkaConsumer.java has the ability to list topics (
> https://github.com/apache/kafka/blob/trunk/clients/src/
> main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L1326), but
> KafkaProducer.java doesn't.
> It seems like the producer could use its waitOnMetadata call to implement
> listTopics(), similar to partitionsFor(), https://
> github.com/apache/kafka/blob/trunk/clients/src/main/java/
> org/apache/kafka/clients/producer/KafkaProducer.java#L629
> https://github.com/apache/kafka/blob/trunk/clients/src/
> main/java/org/apache/kafka/common/Cluster.java#L238
> Is there a reason this wasn't added?
>
> Thanks,
> Scott
>



-- 
Thanks,
Ewen