Embedded Kafka

Crux 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

pro.juxt.crux/crux-core {:mvn/version "1.18.0"}
pro.juxt.crux/crux-kafka-embedded {:mvn/version "1.18.0"}

Getting started

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

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

You can later stop the Embedded Kafka if you wish:

(.close embedded-kafka)