You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Sivananda Reddy <si...@gmail.com> on 2015/10/16 01:05:47 UTC

Thread safe way of creating a topic programmatically

Hi,

# I have a use case where multiple app-servers would try to create same
topic. In the past it was mentioned that "AdminUtils.createTopic" is not
thread safe to create a topic, could some one confirm if it's still the
case?.
(or) One of the safest approach is all the app-serves would go to DB and
one of the app-servers acquires a lock and issues a topic creation request,
which means that I need to have some custom logic to make sure there are no
multiple topic creation requests.

# Could some one please let me know if there are any other ways to create a
topic apart from AdminUtils.createTopic. I am asuming that the command line
way of topic creation(bin/kafka-topics.sh) follow same path as above and is
also not thread safe(please correct me if I am wrong)?.

Thank you,
Siva.