public class KafkaLite extends Object
| Constructor and Description |
|---|
KafkaLite() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clean()
Delete all existing Kafka topics.
|
static void |
cleanOnShutdown()
Clean kafka and zookeeper directories on JVM shutdown
|
static Properties |
consumerProperties(Class<?> keyDerserializerType,
Class<?> valueDeserializerType)
Create a consumer properties using the given deserializers
|
static boolean |
createTopic(String topic,
int partitions)
If started, create a topic on the running Kafka instance with a 1 hour retention.
|
static boolean |
createTopic(String topic,
int partitions,
long retentionMillis)
If started, create a topic on the running Kafka instance.
|
static boolean |
deleteTopic(String topic)
If started, delete a topic on the running Kafka instance.
|
static void |
main(String... args)
Main method to start a KafkaLite instance.
|
static Properties |
producerProperties(Class<?> keySerializerType,
Class<?> valueSerializerType)
Create a producer properties using the given serializers
|
static void |
reset()
Clean and start
|
static void |
start()
If not already started, start Zookeeper and Kafka now.
|
static void |
stop()
If started, stop Kafka and Zookeeper now.
|
public static void main(String... args) throws KafkaLiteException
args - KafkaLiteExceptionpublic static void reset()
throws KafkaLiteException
KafkaLiteExceptionpublic static void start()
throws KafkaLiteException
KafkaLiteExceptionpublic static void stop()
public static void clean()
public static boolean createTopic(String topic, int partitions)
topic - partitions - public static boolean createTopic(String topic, int partitions, long retentionMillis)
topic - partitions - retentionMillis - public static boolean deleteTopic(String topic)
topic - public static void cleanOnShutdown()
public static Properties consumerProperties(Class<?> keyDerserializerType, Class<?> valueDeserializerType)
keyDerserializerType - The key deserializer typevalueDeserializerType - The value deserializer typepublic static Properties producerProperties(Class<?> keySerializerType, Class<?> valueSerializerType)
keySerializerType - The key serializer typevalueSerializerType - The value serializer typeCopyright © 2019. All rights reserved.