You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Xavier Léauté (JIRA)" <ji...@apache.org> on 2017/06/05 23:15:12 UTC

[jira] [Comment Edited] (KAFKA-5275) Review and potentially tweak AdminClient API for the initial release (KIP-117)

    [ https://issues.apache.org/jira/browse/KAFKA-5275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16037820#comment-16037820 ] 

Xavier Léauté edited comment on KAFKA-5275 at 6/5/17 11:14 PM:
---------------------------------------------------------------

Now that describe topic doesn't auto-create the topic anymore it's easier to implement a "create topic if not exists" functionality that doesn't require listing all topics. However given the nature of the async API, it still feels cumbersome to write, e.g.

{code}
try {
  adminClient.describeTopics(Collections.singleton(publishTopic)).all().get();
  log.debug("topic {} already exists", publishTopic);
} catch (ExecutionException e) {
  if (!(e.getCause() instanceof UnknownTopicOrPartitionException)) {
    // something bad happened
    throw e;
  }
  // create logic here
}
{code}


was (Author: xvrl):
Now that describe topic doesn't auto-create the topic anymore it's easier to implement a "create topic if not exists" functionality that doesn't require listing all topics. However given the nature of the async API, it still feels cumbersome to write, e.g.

{code}
try {
  adminClient.describeTopics(Collections.singleton(publishTopic)).all().get();
  log.debug("Metrics reporter topic {} already exists", publishTopic);
} catch (ExecutionException e) {
  if (!(e.getCause() instanceof UnknownTopicOrPartitionException)) {
    // something bad happened
    throw e;
  }
  // create logic here
}
{code}

> Review and potentially tweak AdminClient API for the initial release (KIP-117)
> ------------------------------------------------------------------------------
>
>                 Key: KAFKA-5275
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5275
>             Project: Kafka
>          Issue Type: Sub-task
>            Reporter: Ismael Juma
>            Assignee: Ismael Juma
>             Fix For: 0.11.0.0
>
>
> Once all the pieces are in, we should take a pass and ensure that the APIs work well together and that they are consistent.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)