@ExtendWith(value=EmbeddedKafkaCondition.class) @Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited public @interface EmbeddedKafka
EmbeddedKafkaBroker bean with the
EmbeddedKafkaBroker.BEAN_NAME bean name.
The typical usage of this annotation is like:
@RunWith(SpringRunner.class)
@EmbeddedKafka
public class MyKafkaTests {
@Autowired
private EmbeddedKafkaBroker kafkaEmbedded;
@Value("${spring.embedded.kafka.brokers}")
private String brokerAddresses;
}
EmbeddedKafkaBroker| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
bootstrapServersProperty
The property name to set with the bootstrap server addresses instead of the default
"spring.embedded.kafka.brokers".
|
java.lang.String[] |
brokerProperties
Properties in form key=value that should be added to the broker config
before runs.
|
java.lang.String |
brokerPropertiesLocation
Spring
Resource url specifying the location of properties that should be
added to the broker config. |
boolean |
controlledShutdown |
int |
count |
int |
partitions |
int[] |
ports
Set explicit ports on which the kafka brokers will listen.
|
java.lang.String[] |
topics
Topics that should be created Topics may contain property place holders, e.g.
|
int |
value |
int |
zkConnectionTimeout
Timeout for internal ZK client connection.
|
int |
zkSessionTimeout
Timeout for internal ZK client session.
|
int |
zookeeperPort
Set the port on which the embedded Zookeeper should listen;
|
@AliasFor(value="count") public abstract int value
public abstract boolean controlledShutdown
kafka.utils.TestUtils.createBrokerConfig().public abstract int[] ports
public abstract int zookeeperPort
public abstract java.lang.String[] topics
topics = "${kafka.topic.one:topicOne}" The topics will be created with
partitions() partitions; to provision other topics with other partition
counts call the addTopics(NewTopic... topics) method on the autowired
broker.
Place holders will only be resolved when there is a Spring test application
context present (such as when using @SpringJunitConfig or @SpringRunner.public abstract java.lang.String[] brokerProperties
delete.topic.enable=${topic.delete:true}.
Place holders will only be resolved when there is a Spring test application
context present (such as when using @SpringJunitConfig or @SpringRunner.brokerPropertiesLocation(),
EmbeddedKafkaBroker.brokerProperties(java.util.Map)public abstract java.lang.String brokerPropertiesLocation
Resource url specifying the location of properties that should be
added to the broker config. When used in a Spring test context, the
brokerPropertiesLocation url and the properties themselves may contain
place holders that are resolved during initialization. Properties specified by
brokerProperties() will override properties found in
brokerPropertiesLocation.
Place holders will only be resolved when there is a Spring test application
context present (such as when using @SpringJunitConfig or @SpringRunner.Resource url specifying the location of properties to addbrokerProperties(),
EmbeddedKafkaBroker.brokerProperties(java.util.Map)public abstract java.lang.String bootstrapServersProperty
EmbeddedKafkaBroker.brokerListProperty(String)public abstract int zkConnectionTimeout
EmbeddedKafkaBroker.DEFAULT_ZK_CONNECTION_TIMEOUT.public abstract int zkSessionTimeout
EmbeddedKafkaBroker.DEFAULT_ZK_SESSION_TIMEOUT.