public class ClientUtils extends Object
Constructor and Description |
---|
ClientUtils() |
Modifier and Type | Method and Description |
---|---|
static Properties |
consumerConfig(String bootstrapServers,
String groupId,
Class keyDeserializer,
Class valueDeserializer,
Properties additional) |
static void |
createTopic(String topic,
int numPartitions,
short replicationFactor,
Properties props) |
static String |
generateRandomHexString(int len) |
static <T> T |
getConfiguredInstance(Class<T> cls,
Map<String,?> configs) |
static <T> org.apache.kafka.common.serialization.Serde<T> |
getSerde(Class<org.apache.kafka.common.serialization.Serde<T>> cls,
Map<String,?> configs) |
static Properties |
producerConfig(String bootstrapServers,
Class keySerializer,
Class valueSerializer,
Properties additional) |
static Properties |
streamsConfig(String applicationId,
String clientId,
String bootstrapServers,
Class keySerde,
Class valueSerde) |
static Properties |
streamsConfig(String applicationId,
String clientId,
String bootstrapServers,
Class keySerde,
Class valueSerde,
Properties additional) |
static File |
tempDirectory()
Create a temporary relative directory in the default temporary-file directory with a
prefix of "kafka-"
|
static File |
tempDirectory(Path parent,
String prefix)
Create a temporary relative directory in the specified parent directory with the given prefix.
|
static File |
tempDirectory(String prefix)
Create a temporary relative directory in the default temporary-file directory with the given
prefix.
|
public static File tempDirectory(String prefix)
prefix
- The prefix of the temporary directory, if null using "kafka-" as default prefixpublic static File tempDirectory()
public static File tempDirectory(Path parent, String prefix)
parent
- The parent folder path name, if null using the default temporary-file directoryprefix
- The prefix of the temporary directory, if null using "kafka-" as default prefixpublic static <T> org.apache.kafka.common.serialization.Serde<T> getSerde(Class<org.apache.kafka.common.serialization.Serde<T>> cls, Map<String,?> configs)
public static <T> T getConfiguredInstance(Class<T> cls, Map<String,?> configs)
public static Properties producerConfig(String bootstrapServers, Class keySerializer, Class valueSerializer, Properties additional)
public static Properties consumerConfig(String bootstrapServers, String groupId, Class keyDeserializer, Class valueDeserializer, Properties additional)
public static Properties streamsConfig(String applicationId, String clientId, String bootstrapServers, Class keySerde, Class valueSerde)
public static Properties streamsConfig(String applicationId, String clientId, String bootstrapServers, Class keySerde, Class valueSerde, Properties additional)
public static void createTopic(String topic, int numPartitions, short replicationFactor, Properties props)
public static String generateRandomHexString(int len)
Copyright © 2020. All rights reserved.