public class EphemeralKafkaCluster extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
connectionString() |
Properties |
consumerConfig()
Create a minimal consumer configuration with auto commit enabled.
|
Properties |
consumerConfig(boolean enableAutoCommit)
Create a minimal consumer configuration.
|
static EphemeralKafkaCluster |
create(int numBroker)
Create a new ephemeral Kafka cluster
|
static EphemeralKafkaCluster |
create(int numBroker,
int zookeeperPort)
Create a new ephemeral Kafka cluster with the specified Zookeeper port
|
static EphemeralKafkaCluster |
create(int numBroker,
int zookeeperPort,
Properties brokerProperties)
Create a new ephemeral Kafka cluster with the specified Zookeeper port and broker properties
|
void |
createTopics(String... topics) |
List<EphemeralKafkaBroker> |
getBrokers() |
boolean |
isHealthy() |
boolean |
isRunning() |
Properties |
producerConfig()
Create a minimal producer configuration that can be used to produce to this broker
|
void |
stop() |
public static EphemeralKafkaCluster create(int numBroker) throws Exception
numBroker - number of brokersException - if create failspublic static EphemeralKafkaCluster create(int numBroker, int zookeeperPort) throws Exception
numBroker - Number of brokerszookeeperPort - Port the Zookeeper should listen onException - if create failspublic static EphemeralKafkaCluster create(int numBroker, int zookeeperPort, Properties brokerProperties) throws Exception
numBroker - Number of brokerszookeeperPort - Port the Zookeeper should listen onbrokerProperties - Override properties for all brokers in the clusterException - if create failspublic boolean isHealthy()
public boolean isRunning()
public void stop()
throws IOException,
ExecutionException,
InterruptedException
public List<EphemeralKafkaBroker> getBrokers()
public String connectionString()
public Properties producerConfig()
public Properties consumerConfig()
public Properties consumerConfig(boolean enableAutoCommit)
enableAutoCommit - Enable auto commitpublic void createTopics(String... topics) throws ExecutionException, InterruptedException
public void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2021. All rights reserved.