Skip to content

Latest commit

 

History

History
91 lines (76 loc) · 4.13 KB

File metadata and controls

91 lines (76 loc) · 4.13 KB

embedded-kafka

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.

Maven dependency

pom.xml
<dependency>
    <groupId>com.playtika.testcontainers</groupId>
    <artifactId>embedded-kafka</artifactId>
    <scope>test</scope>
</dependency>

Consumes (via bootstrap.properties)

  • embedded.kafka.enabled (true|false, default is true)

  • embedded.kafka.topicsToCreate (comma separated list of topic names, default is empty)

  • embedded.kafka.secureTopics (subset of embedded.kafka.topicsToCreate that should be secured with ACLs)

  • embedded.kafka.dockerImageVersion (default '7.6.0' provides Kafka 3.2.0)

  • embedded.kafka.dockerImage (default is set to 'confluentinc/cp-schema-registry:7.7.1')

  • 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)

  • 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.enabled Enables creation of the container with ToxiProxy TCP proxy and a proxy to the embedded-kafka container.

Filesystem bindings

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)

Produces

  • 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

  • embedded.kafka.internalSaslPlaintextPort

  • Bean ToxiproxyContainer.ContainerProxy kafkaPlainTextContainerProxy

  • Bean ToxiproxyContainer.ContainerProxy kafkaSaslContainerProxy

Using SASL_PLAINTEXT

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
Application configuration
# 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