Skip to content

Latest commit

 

History

History
79 lines (65 loc) · 3.34 KB

File metadata and controls

79 lines (65 loc) · 3.34 KB

embedded-kafka

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 '6.2.0' provides Kafka 2.8)

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

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

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