congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CreatePartitionsResult.values
Code IndexAdd Tabnine to your IDE (free)

How to use
values
method
in
org.apache.kafka.clients.admin.CreatePartitionsResult

Best Java code snippets using org.apache.kafka.clients.admin.CreatePartitionsResult.values (Showing top 2 results out of 315)

origin: apache/kafka

@Test
public void testCreatePartitions() throws Exception {
  try (AdminClientUnitTestEnv env = mockClientEnv()) {
    env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
    Map<String, ApiError> m = new HashMap<>();
    m.put("my_topic", ApiError.NONE);
    m.put("other_topic", ApiError.fromThrowable(new InvalidTopicException("some detailed reason")));
    // Test a call where one filter has an error.
    env.kafkaClient().prepareResponse(new CreatePartitionsResponse(0, m));
    Map<String, NewPartitions> counts = new HashMap<>();
    counts.put("my_topic", NewPartitions.increaseTo(3));
    counts.put("other_topic", NewPartitions.increaseTo(3, asList(asList(2), asList(3))));
    CreatePartitionsResult results = env.adminClient().createPartitions(counts);
    Map<String, KafkaFuture<Void>> values = results.values();
    KafkaFuture<Void> myTopicResult = values.get("my_topic");
    myTopicResult.get();
    KafkaFuture<Void> otherTopicResult = values.get("other_topic");
    try {
      otherTopicResult.get();
      fail("get() should throw ExecutionException");
    } catch (ExecutionException e0) {
      assertTrue(e0.getCause() instanceof InvalidTopicException);
      InvalidTopicException e = (InvalidTopicException) e0.getCause();
      assertEquals("some detailed reason", e.getMessage());
    }
  }
}
origin: strimzi/strimzi-kafka-operator

@Override
public void increasePartitions(Topic topic, Handler<AsyncResult<Void>> handler) {
  final NewPartitions newPartitions = NewPartitions.increaseTo(topic.getNumPartitions());
  final Map<String, NewPartitions> request = Collections.singletonMap(topic.getTopicName().toString(), newPartitions);
  KafkaFuture<Void> future = adminClient.createPartitions(request).values().get(topic.getTopicName().toString());
  queueWork(new UniWork<>("increasePartitions", future, handler));
}
org.apache.kafka.clients.adminCreatePartitionsResultvalues

Javadoc

Return a map from topic names to futures, which can be used to check the status of individual partition creations.

Popular methods of CreatePartitionsResult

  • all
  • <init>

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • getSystemService (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JComboBox (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now