|
Tip
|
This module provides integration with ToxiProxy out of the box. ToxiProxy is a great tool for simulating network conditions, meaning that you can test your application’s resiliency. |
<dependency>
<groupId>com.playtika.testcontainers</groupId>
<artifactId>embedded-kafka</artifactId>
<scope>test</scope>
</dependency>-
embedded.kafka.enabled(true|false, default is true) -
embedded.kafka.topicsToCreate(comma separated list of topic names, default is empty) -
embedded.kafka.secureTopics(subset ofembedded.kafka.topicsToCreatethat should be secured with ACLs) -
embedded.kafka.dockerImageVersion(default '7.2.1' provides Kafka 3.2.0)-
Image versions on dockerhub
-
-
embedded.kafka.dockerUser(default 'appuser' since Confluent Platform 6.0.0) -
embedded.kafka.waitTimeoutInSeconds(default is 60 seconds) -
embedded.kafka.schema-registry.enabled(true|false, default is false) -
embedded.kafka.schema-registry.waitTimeoutInSeconds(default is 60 seconds) -
embedded.kafka.schema-registry.dockerImage(default : confluentinc/cp-schema-registry:6.2.0)-
Image versions on dockerhub
-
-
embedded.kafka.schema-registry.port(default is 8081) -
embedded.kafka.schema-registry.avroCompatibilityLevel(NONE|BACKWARD|BACKWARD_TRANSITIVE|FORWARD|FORWARD_TRANSITIVE|FULL|FULL_TRANSITIVE, default is BACKWARD) -
embedded.kafka.schema-registry.authentication(NONE|BASIC, default is NONE) -
embedded.toxiproxy.proxies.kafka.enabledEnables creation of the container with ToxiProxy TCP proxy and a proxy to theembedded-kafkacontainer.
Containers for embedded-kafka and embedded-zookeper bind their volumes to host filesystem.
By default, to your projects target folder. You can configure binding using properties:
-
embedded.zookeeper.fileSystemBind.enabled(true|false, default is false) -
embedded.zookeeper.fileSystemBind.dataFolder(default : target/embedded-zk-data) -
embedded.zookeeper.fileSystemBind.txnLogsFolder(default : target/embedded-zk-txn-logs) -
embedded.kafka.fileSystemBind.enabled(true|false, default is false) -
embedded.kafka.fileSystemBind.dataFolder(default : target/embedded-kafka-data)
-
embedded.kafka.brokerList -
embedded.kafka.saslPlaintext.brokerList -
embedded.kafka.saslPlaintext.user -
embedded.kafka.saslPlaintext.password -
embedded.kafka.schema-registry.host -
embedded.kafka.schema-registry.port -
embedded.kafka.schema-registry.username -
embedded.kafka.schema-registry.password -
embedded.kafka.toxiproxy.brokerList -
embedded.kafka.toxiproxy.saslPlaintext.brokerList -
embedded.kafka.networkAlias -
embedded.kafka.internalPort -
Bean
ToxiproxyContainer.ContainerProxy kafkaPlainTextContainerProxy -
Bean
ToxiproxyContainer.ContainerProxy kafkaSaslContainerProxy
Note that only SASL_PLAINTEXT protocol supported, meaning TLS is not used.
embedded-kafka configuration (via bootstrap.properties)embedded.kafka.topicsToCreate=nonSecureTopic,secureTopic
embedded.kafka.secureTopics=secureTopic# Common for Producer and Consumer
bootstrap.servers=${embedded.kafka.saslPlaintext.brokerList}
security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="${embedded.kafka.saslPlaintext.user}" \
password="${embedded.kafka.saslPlaintext.password}";
# Consumer group.id could be any as ACLs are applied to wildcard group