Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 3.37 KB

File metadata and controls

78 lines (64 loc) · 3.37 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: 5.5.1. Kafka version is 2.5.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:5.5.1)

    • To use another schema registry version pick corresponding docker image 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)

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