Liking cljdoc? Tell your friends :D

kafka-component.mock


->topic-partitionclj

(->topic-partition topic partition)
source

accumulate-messagesclj

(accumulate-messages consumer topic options)

Like accumulate-subscribed-messages, but subscribes to the topic first.

Like `accumulate-subscribed-messages`, but subscribes to the `topic` first.
sourceraw docstring

accumulate-subscribed-messagesclj

(accumulate-subscribed-messages
  consumer
  {:keys [timeout at-least-n format-fn filter-fn]
   :or {at-least-n 1 format-fn identity filter-fn identity}})

Helper to consume messages off any existing subscriptions. Will return as soon as at-least-n messages have been fetched. May return more, since an individual poll can fetch more. If timeout (in ms) expires first, returns any messages fetched so far. Mesages may be reformatted with format-fn then filtered with filter-fn. Messages excluded by filter-fn do not count towards at-least-n.

Helper to consume messages off any existing subscriptions. Will return as
soon as `at-least-n` messages have been fetched. May return more, since an
individual poll can fetch more. If `timeout` (in ms) expires first, returns
any messages fetched so far. Mesages may be reformatted with `format-fn` then
filtered with `filter-fn`. Messages excluded by `filter-fn` do not count
towards `at-least-n`.
sourceraw docstring

add-record-in-broker-stateclj

(add-record-in-broker-state state producer-record)
source

add-record-to-topicclj

(add-record-to-topic state producer-record)
source

assert-producer-not-closedclj

(assert-producer-not-closed producer-state)

Checks conn-open? in producer state

Checks conn-open? in producer state
sourceraw docstring

assert-proper-recordclj

(assert-proper-record record)
source

assign-partitionsclj

(assign-partitions broker-state
                   consumers
                   participants
                   participants-ch
                   complete-ch)
source

broker-create-topicclj

(broker-create-topic)
(broker-create-topic num-partitions)
source

broker-ensure-topicclj

(broker-ensure-topic broker-state topic)
source

broker-receive-messagesclj

(broker-receive-messages state msg-ch)
source

broker-save-record!clj

(broker-save-record! state record)
source

broker-stateclj

source

buffer-sizeclj

source

close-all-fromclj

(close-all-from ch)
source

close-mockclj

(close-mock state)
source

committed-offsetsclj

source

committed-record-metadataclj

(committed-record-metadata record)
source

consumer-backoffclj

source

consumer-coordinatorclj

(consumer-coordinator state broker-state join-ch leave-ch)
source

consumer-rebalance-timeoutclj

source

consumer-unsubscribe-timeoutclj

source

consumers-with-topic-overlapclj

(consumers-with-topic-overlap consumers topics)
source

debugclj

source

debug!clj

(debug! enable)
source

default-mock-consumer-optsclj

source

default-num-partitionsclj

source

fixture-restart-broker!clj

(fixture-restart-broker! f)
source

get-messagescljdeprecated

(get-messages consumer timeout)
(get-messages consumer topic timeout)

DEPRECATED: use txfm-messages instead. Poll until consumer receives some messages on topic. If timeout (in ms) expires first, return an empty vector.

DEPRECATED: use `txfm-messages` instead.
Poll until `consumer` receives some messages on `topic`. If `timeout` (in ms)
expires first, return an empty vector.
sourceraw docstring

get-offsetclj

(get-offset broker-state topic partition config)
source

goeclj/smacro

(goe & body)
source

goe-loopclj/smacro

(goe-loop & body)
source

intersects?clj

(intersects? v1 v2)
source

IRebalancecljprotocol

all-topicsclj

(all-topics this)

apply-pending-topicsclj

(apply-pending-topics this topics)

clean-up-subscriptionsclj

(clean-up-subscriptions this)
source

loggerclj

(logger & args)
source

max-poll-recordsclj

(max-poll-records config)
source

mock-consumerclj

(mock-consumer config)
(mock-consumer auto-subscribe-topics config)
source

mock-producerclj

(mock-producer config)
source

noop-cbclj

source

producer-record->consumer-recordclj

(producer-record->consumer-record offset record)
source

read-offsetsclj

(read-offsets grouped-messages)
source

rebalance-consumersclj

(rebalance-consumers relevant-consumers broker-state)
source

rebalance-participantsclj

(rebalance-participants broker-state consumers participants-ch complete-ch)

Try to get all the consumers to participate in the rebalance, but if they don't all check in, continue without some of them.

Try to get all the consumers to participate in the rebalance, but if they
don't all check in, continue without some of them.
sourceraw docstring

rebalance-participants-timeoutclj

source

record->cljclj

(record->clj record)
source

record->topic-partitionclj

(record->topic-partition record)
source

records->cljclj

(records->clj consumer-records)
source

reset-state!clj

(reset-state!)
source

sendclj

(send producer topic k v)
source

send-asyncclj

(send-async producer topic k v)
source

shutdown!clj

(shutdown!)
source

standalone-mock-consumer-optsclj

source

start!clj

(start!)
source

txfm-messagesclj

(txfm-messages consumer topic xf)
(txfm-messages consumer topic xf options)

Like txfm-subscribed-messages, but subscribes to the topic first.

Like `txfm-subscribed-messages`, but subscribes to the `topic` first.
sourceraw docstring

txfm-subscribed-messagesclj

(txfm-subscribed-messages consumer xf)
(txfm-subscribed-messages consumer
                          xf
                          {:keys [timeout ixf rf]
                           :or {timeout 1000 ixf cat rf conj}})

Helper to txfm messages sent to the consumer on any existing subscriptions. Messages will be transformed by the transducing function xf. Will return as soon as xf indicates it has enough records, or the timeout (in ms, by default 1000) expires. Thus, to avoid waiting for the timeout, include e.g. (take 3) in xf. If the timeout expires, will return any messages transformed so far.

For example,

(kafka-mock/send producer "topic" "key" "5")
(kafka-mock/send producer "topic" "key" "6")
(kafka-mock/send producer "topic" "key" "7")
(kafka-mock/send producer "topic" "key" "8")
(.subscribe consumer ["topic"])
(kafka-mock/txfm-subscribed-messages consumer (comp (map :value)
                                                    (map #(Integer/parseInt %))
                                                    (filter even?)
                                                    (take 1)))
;; => [6]

By default messages retrieved from (.poll consumer) will be collected as by clojure.core/cat and fed one-by-one through xf. This behvaior can be altered by providing a different ixf. For example, clojure.core/conj will feed each batch through in its entirety. This can be combined with max.poll.records to control batch size.

Also by default, the transformed messages will be accumulated as by clojure.core/conj, and returned. A different reducing function rf can be supplied. For example, if xf produces a stream of numbers, the reducing function clojure.core/+ will return their sum.

Helper to txfm messages sent to the `consumer` on any existing subscriptions.
Messages will be transformed by the transducing function `xf`. Will return as
soon as `xf` indicates it has enough records, or the `timeout` (in ms, by
default 1000) expires. Thus, to avoid waiting for the `timeout`, include e.g.
`(take 3)` in `xf`. If the `timeout` expires, will return any messages
transformed so far.

For example,

``` clojure
(kafka-mock/send producer "topic" "key" "5")
(kafka-mock/send producer "topic" "key" "6")
(kafka-mock/send producer "topic" "key" "7")
(kafka-mock/send producer "topic" "key" "8")
(.subscribe consumer ["topic"])
(kafka-mock/txfm-subscribed-messages consumer (comp (map :value)
                                                    (map #(Integer/parseInt %))
                                                    (filter even?)
                                                    (take 1)))
;; => [6]
```

By default messages retrieved from `(.poll consumer)` will be collected as by
`clojure.core/cat` and fed one-by-one through `xf`. This behvaior can be
altered by providing a different `ixf`. For example, `clojure.core/conj` will
feed each batch through in its entirety. This can be combined with
`max.poll.records` to control batch size.

Also by default, the transformed messages will be accumulated as by
`clojure.core/conj`, and returned. A different reducing function `rf` can be
supplied. For example, if `xf` produces a stream of numbers, the reducing
function `clojure.core/+` will return their sum.
sourceraw docstring

with-test-brokerclj/smacro

(with-test-broker & body)
source

with-test-producer-consumerclj/smacro

(with-test-producer-consumer producer-name consumer-name & body)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close