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, kafkaPorts
public 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 EmbeddedKafkaRule
brokerProperties
- the properties to use for configuring Kafka Broker(s).KafkaConfig
public KafkaEmbedded brokerProperty(java.lang.String property, java.lang.Object value)
brokerProperty
in class EmbeddedKafkaRule
property
- 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.InitializingBean
public 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.DisposableBean
public java.util.Set<java.lang.String> getTopics()
public java.util.List<kafka.server.KafkaServer> getKafkaServers()
getKafkaServers
in interface KafkaRule
public kafka.server.KafkaServer getKafkaServer(int id)
public kafka.zk.EmbeddedZookeeper getZookeeper()
public org.I0Itec.zkclient.ZkClient getZkClient()
getZkClient
in interface KafkaRule
public java.lang.String getZookeeperConnectionString()
getZookeeperConnectionString
in interface KafkaRule
public BrokerAddress getBrokerAddress(int i)
public BrokerAddress[] getBrokerAddresses()
getBrokerAddresses
in interface KafkaRule
public int getPartitionsPerTopic()
getPartitionsPerTopic
in interface KafkaRule
public 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 KafkaRule
public boolean isEmbedded()
isEmbedded
in interface KafkaRule
public 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.