@Test public void testGetPartitions() throws Exception { int prtition_num = SimpleConsumerManager.getPartitions(KAFKA_SERVER_URI, TOPIC_NAME).size(); assertTrue(prtition_num == KafkaTestUtil.DEFAULT_TEST_PARTITION_NUM); }
static List<PartitionInfo> getPartitions(URI uri, String topic) throws IOException { String clientId = SimpleConsumerManager.createIdentifier("TPart"); Properties props = getDefaultProperties(uri, clientId, Integer.MAX_VALUE); try (KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props)) { return consumer.partitionsFor(topic); } }
SimpleConsumerManager implements Closeable { static List<PartitionInfo> getPartitions(URI uri, String topic) throws IOException { String clientId = SimpleConsumerManager.createIdentifier("TPart"); Properties props = getDefaultProperties(uri, clientId, Integer.MAX_VALUE); try (KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props)) { return consumer.partitionsFor(topic); } } }
SimpleConsumerManager implements Closeable { static List<PartitionInfo> getPartitions(URI uri, String topic) throws IOException { String clientId = SimpleConsumerManager.createIdentifier("TPart"); Properties props = getDefaultProperties(uri, clientId, Integer.MAX_VALUE); try (KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props)) { return consumer.partitionsFor(topic); } } SimpleConsumerManager(URI uri, String topic, int partitionId);  SimpleConsumerManager(URI uri, String topic, int partitionId, int fragmentSize); }
SimpleConsumerManager implements Closeable { static List<PartitionInfo> getPartitions(URI uri, String topic) throws IOException { String clientId = SimpleConsumerManager.createIdentifier("TPart"); Properties props = getDefaultProperties(uri, clientId, Integer.MAX_VALUE); try (KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props)) { return consumer.partitionsFor(topic); } } SimpleConsumerManager(URI uri, String topic, int partitionId);  SimpleConsumerManager(URI uri, String topic, int partitionId, int fragmentSize); @Override void close(); long getEarliestOffset(); long getLatestOffset(); ConsumerRecords<byte[], byte[]> poll(long offset, long timeout); }
SimpleConsumerManager implements Closeable { static List<PartitionInfo> getPartitions(URI uri, String topic) throws IOException { String clientId = SimpleConsumerManager.createIdentifier("TPart"); Properties props = getDefaultProperties(uri, clientId, Integer.MAX_VALUE); try (KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props)) { return consumer.partitionsFor(topic); } } SimpleConsumerManager(URI uri, String topic, int partitionId);  SimpleConsumerManager(URI uri, String topic, int partitionId, int fragmentSize); @Override void close(); long getEarliestOffset(); long getLatestOffset(); ConsumerRecords<byte[], byte[]> poll(long offset, long timeout);  }