EmbeddedKafkaRule@Deprecated public class KafkaEmbedded extends EmbeddedKafkaRule implements KafkaRule, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
KafkaRule implementation for the embedded Kafka Broker and Zookeeper.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BEAN_NAME
Deprecated.
|
static long |
METADATA_PROPAGATION_TIMEOUT
Deprecated.
|
static java.lang.String |
SPRING_EMBEDDED_KAFKA_BROKERS
Deprecated.
|
static java.lang.String |
SPRING_EMBEDDED_ZOOKEEPER_CONNECT
Deprecated.
|
| Constructor and Description |
|---|
KafkaEmbedded(int count)
Deprecated.
|
KafkaEmbedded(int count,
boolean controlledShutdown,
int partitions,
java.lang.String... topics)
Deprecated.
Create embedded Kafka brokers listening on random ports.
|
KafkaEmbedded(int count,
boolean controlledShutdown,
java.lang.String... topics)
Deprecated.
Create embedded Kafka brokers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
void |
bounce(BrokerAddress brokerAddress)
Deprecated.
|
void |
bounce(int index)
Deprecated.
|
void |
bounce(int index,
boolean waitForPropagation)
Deprecated.
|
KafkaEmbedded |
brokerProperties(java.util.Map<java.lang.String,java.lang.String> brokerProperties)
Deprecated.
Specify the properties to configure Kafka Broker before start, e.g.
|
KafkaEmbedded |
brokerProperty(java.lang.String property,
java.lang.Object value)
Deprecated.
Specify a broker property.
|
void |
consumeFromAllEmbeddedTopics(org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Deprecated.
Subscribe a consumer to all the embedded topics.
|
void |
consumeFromAnEmbeddedTopic(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.String topic)
Deprecated.
Subscribe a consumer to one of the embedded topics.
|
void |
consumeFromEmbeddedTopics(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.String... topics)
Deprecated.
Subscribe a consumer to one or more of the embedded topics.
|
java.util.Properties |
createBrokerProperties(int i)
Deprecated.
|
void |
destroy()
Deprecated.
|
void |
doWithAdmin(java.util.function.Consumer<org.apache.kafka.clients.admin.AdminClient> callback)
Deprecated.
Create an
AdminClient; invoke the callback and reliably close the
admin. |
BrokerAddress |
getBrokerAddress(int i)
Deprecated.
|
BrokerAddress[] |
getBrokerAddresses()
Deprecated.
|
java.lang.String |
getBrokersAsString()
Deprecated.
|
kafka.server.KafkaServer |
getKafkaServer(int id)
Deprecated.
|
java.util.List<kafka.server.KafkaServer> |
getKafkaServers()
Deprecated.
|
int |
getPartitionsPerTopic()
Deprecated.
|
java.util.Set<java.lang.String> |
getTopics()
Deprecated.
|
org.I0Itec.zkclient.ZkClient |
getZkClient()
Deprecated.
|
kafka.zk.EmbeddedZookeeper |
getZookeeper()
Deprecated.
|
java.lang.String |
getZookeeperConnectionString()
Deprecated.
|
boolean |
isEmbedded()
Deprecated.
|
void |
restart(int index)
Deprecated.
|
void |
setKafkaPorts(int... kafkaPorts)
Deprecated.
Set explicit ports on which the kafka brokers will listen.
|
void |
startZookeeper()
Deprecated.
|
void |
waitUntilSynced(java.lang.String topic,
int brokerId)
Deprecated.
|
after, before, getEmbeddedKafka, kafkaPortspublic static final java.lang.String BEAN_NAME
public static final java.lang.String SPRING_EMBEDDED_KAFKA_BROKERS
public static final java.lang.String SPRING_EMBEDDED_ZOOKEEPER_CONNECT
public static final long METADATA_PROPAGATION_TIMEOUT
public KafkaEmbedded(int count)
public KafkaEmbedded(int count,
boolean controlledShutdown,
java.lang.String... topics)
count - the number of brokers.controlledShutdown - passed into TestUtils.createBrokerConfig.topics - the topics to create (2 partitions per).public KafkaEmbedded(int count,
boolean controlledShutdown,
int partitions,
java.lang.String... topics)
count - the number of brokers.controlledShutdown - passed into TestUtils.createBrokerConfig.partitions - partitions per topic.topics - the topics to create.public KafkaEmbedded brokerProperties(java.util.Map<java.lang.String,java.lang.String> brokerProperties)
auto.create.topics.enable, transaction.state.log.replication.factor etc.brokerProperties in class EmbeddedKafkaRulebrokerProperties - the properties to use for configuring Kafka Broker(s).KafkaConfigpublic KafkaEmbedded brokerProperty(java.lang.String property, java.lang.Object value)
brokerProperty in class EmbeddedKafkaRuleproperty - the property name.value - the value.KafkaEmbedded.public void setKafkaPorts(int... kafkaPorts)
kafkaPorts - the ports.public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic void doWithAdmin(java.util.function.Consumer<org.apache.kafka.clients.admin.AdminClient> callback)
AdminClient; invoke the callback and reliably close the
admin.callback - the callback.public java.util.Properties createBrokerProperties(int i)
public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeanpublic java.util.Set<java.lang.String> getTopics()
public java.util.List<kafka.server.KafkaServer> getKafkaServers()
getKafkaServers in interface KafkaRulepublic kafka.server.KafkaServer getKafkaServer(int id)
public kafka.zk.EmbeddedZookeeper getZookeeper()
public org.I0Itec.zkclient.ZkClient getZkClient()
getZkClient in interface KafkaRulepublic java.lang.String getZookeeperConnectionString()
getZookeeperConnectionString in interface KafkaRulepublic BrokerAddress getBrokerAddress(int i)
public BrokerAddress[] getBrokerAddresses()
getBrokerAddresses in interface KafkaRulepublic int getPartitionsPerTopic()
getPartitionsPerTopic in interface KafkaRulepublic void bounce(BrokerAddress brokerAddress)
public void startZookeeper()
@Deprecated
public void bounce(int index,
boolean waitForPropagation)
@Deprecated public void bounce(int index)
public void restart(int index)
throws java.lang.Exception
java.lang.Exception@Deprecated
public void waitUntilSynced(java.lang.String topic,
int brokerId)
public java.lang.String getBrokersAsString()
getBrokersAsString in interface KafkaRulepublic boolean isEmbedded()
isEmbedded in interface KafkaRulepublic void consumeFromAllEmbeddedTopics(org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
consumer - the consumer.public void consumeFromAnEmbeddedTopic(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.String topic)
consumer - the consumer.topic - the topic.public void consumeFromEmbeddedTopics(org.apache.kafka.clients.consumer.Consumer<?,?> consumer,
java.lang.String... topics)
consumer - the consumer.topics - the topics.