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

  juxt/crux-core {:mvn/version "20.09-1.11.0-beta"}
  juxt/crux-kafka-embedded {:mvn/version "20.09-1.11.0-beta"}

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)