Kafka Embedded

XTDB is ready to work with an embedded Kafka for when you don’t have an independently running Kafka available to connect to (such as during development).

Project Dependencies

com.xtdb/xtdb-core {:mvn/version "1.22.1"}
com.xtdb/xtdb-kafka-embedded {:mvn/version "1.22.1"}

Getting started

(require '[xtdb.kafka.embedded :as ek])

(defn start-embedded-kafka [kafka-port storage-dir]
  (ek/start-embedded-kafka {:xtdb.kafka.embedded/zookeeper-data-dir (io/file storage-dir "zk-data")
                            :xtdb.kafka.embedded/kafka-log-dir (io/file storage-dir "kafka-log")
                            :xtdb.kafka.embedded/kafka-port kafka-port}))

You can later stop the Embedded Kafka if you wish:

(.close embedded-kafka)