(close! client)(close-consumer! cc)(make-client {:keys [bootstrap-servers producer-config]
:or {bootstrap-servers "localhost:29092" producer-config {}}})Creates a Kafka client with a shared producer.
Options:
Creates a Kafka client with a shared producer. Options: - :bootstrap-servers (string) default: "localhost:29092" - :producer-config (map) additional Kafka producer configs
(make-consumer client
{:keys [group-id client-id auto-offset-reset enable-auto-commit?
consumer-config]
:or {auto-offset-reset "earliest"
enable-auto-commit? false
consumer-config {}}})Creates a consumer (caller owns it; call close-consumer!).
opts:
Creates a consumer (caller owns it; call close-consumer!).
opts:
- :group-id (string, required)
- :client-id (string, default random)
- :auto-offset-reset ("earliest"|"latest", default "earliest")
- :enable-auto-commit? (boolean, default false)
- :consumer-config (map) additional Kafka consumer configs(poll! cc {:keys [timeout-ms] :or {timeout-ms 250}})Poll for records, returning a vector of {:topic :partition :offset :key :value :timestamp :headers}.
Poll for records, returning a vector of {:topic :partition :offset :key :value :timestamp :headers}.
(send! client
{:keys [topic key value headers timeout-ms] :or {timeout-ms 5000}})Send a message using the shared producer.
opts:
Returns {:ok true ...metadata...}.
Send a message using the shared producer.
opts:
- :topic (string, required)
- :key (bytes, optional)
- :value (bytes, required)
- :headers (map, optional; values are coerced to UTF-8 bytes)
- :timeout-ms (int, default 5000)
Returns {:ok true ...metadata...}.(subscribe! cc topics)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |