kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Léauté (JIRA) <j...@apache.org>
Subject [jira] [Comment Edited] (KAFKA-5275) Review and potentially tweak AdminClient API for the initial release (KIP-117)
Date Mon, 05 Jun 2017 23:15:12 GMT

    [ 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)

Mime
View raw message