public class EmbeddedKafkaServer extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
| Constructor and Description |
|---|
EmbeddedKafkaServer() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected Properties |
createBrokerProperties(String zooKeeperConnect,
int kafkaServerPort,
File logDir)
Creates Kafka broker properties.
|
protected void |
createKafkaTopics(Set<String> topics)
Create topics on embedded Kafka server.
|
protected File |
createLogDir()
Creates Zookeeper log directory.
|
protected org.apache.zookeeper.server.ServerCnxnFactory |
createServerFactory()
Create server factory for embedded Zookeeper server instance.
|
protected org.apache.zookeeper.server.ZooKeeperServer |
createZookeeperServer(File logDir)
Creates new embedded Zookeeper server.
|
void |
destroy() |
Map<String,String> |
getBrokerProperties()
Gets the brokerProperties.
|
int |
getKafkaServerPort()
Gets the kafkaServerPort.
|
String |
getLogDirPath()
Gets the logDirPath.
|
int |
getPartitions()
Gets the partitions.
|
String |
getTopics()
Gets the topics.
|
int |
getZookeeperPort()
Gets the zookeeperPort.
|
boolean |
isAutoDeleteLogs()
Gets the autoDeleteLogs.
|
void |
setAutoDeleteLogs(boolean autoDeleteLogs)
Sets the autoDeleteLogs.
|
void |
setBrokerProperties(Map<String,String> brokerProperties)
Sets the brokerProperties.
|
void |
setKafkaServerPort(int kafkaServerPort)
Sets the kafkaServerPort.
|
void |
setLogDirPath(String logDirPath)
Sets the logDirPath.
|
void |
setPartitions(int partitions)
Sets the partitions.
|
void |
setTopics(String topics)
Sets the topics.
|
void |
setZookeeperPort(int zookeeperPort)
Sets the zookeeperPort.
|
void |
start()
Start embedded server instances for Kafka and Zookeeper.
|
void |
stop()
Shutdown embedded Kafka and Zookeeper server instances
|
public void start()
public void stop()
public void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected org.apache.zookeeper.server.ZooKeeperServer createZookeeperServer(File logDir)
protected File createLogDir()
protected org.apache.zookeeper.server.ServerCnxnFactory createServerFactory()
protected void createKafkaTopics(Set<String> topics)
topics - protected Properties createBrokerProperties(String zooKeeperConnect, int kafkaServerPort, File logDir)
zooKeeperConnect - kafkaServerPort - logDir - public int getZookeeperPort()
public void setZookeeperPort(int zookeeperPort)
zookeeperPort - public int getKafkaServerPort()
public void setKafkaServerPort(int kafkaServerPort)
kafkaServerPort - public int getPartitions()
public void setPartitions(int partitions)
partitions - public String getTopics()
public void setTopics(String topics)
topics - public Map<String,String> getBrokerProperties()
public void setBrokerProperties(Map<String,String> brokerProperties)
brokerProperties - public String getLogDirPath()
public void setLogDirPath(String logDirPath)
logDirPath - public boolean isAutoDeleteLogs()
public void setAutoDeleteLogs(boolean autoDeleteLogs)
autoDeleteLogs - Copyright © 2008–2019 ConSol Software GmbH. All rights reserved.