Mocking Kafka consumers.
Mocking Kafka consumers.
(add-record mock-consumer record)
Adds a record for the next poll operation.
Polling subsequently deletes all records that have been added up to that point. Hence, those records cannot be consumed more than once.
Cf. dvlopt.kafka.in/poll
for the structure of a record
Adds a record for the next poll operation. Polling subsequently deletes all records that have been added up to that point. Hence, those records cannot be consumed more than once. Cf. `dvlopt.kafka.in/poll` for the structure of a record
(during-next-poll mock-consumer f)
Next time this mock consumer polls records, no-op f
will be executed.
f
can safely be executed in a multithreaded situtation.
Next time this mock consumer polls records, no-op `f` will be executed. `f` can safely be executed in a multithreaded situtation.
(mock-consumer)
(mock-consumer options)
Builds a mock Kafka consumer for testing purposes. It can use the dvlopt.kafka.in
API like a regular consumer.
Like regular consumers, mock ones are not thread-safe.
A map of options may be provided :
::ofset-reset-strategy One of :
:ealiest
Consumption of records will start from the beginning (ie. what has been set by a subsequent call to `set-beginning-offsets`).
:latest (default)
Consumption of records will start from the known end (ie. what has been set by a subsequent call to `set-end-offsets`).
Builds a mock Kafka consumer for testing purposes. It can use the `dvlopt.kafka.in` API like a regular consumer. Like regular consumers, mock ones are not thread-safe. A map of options may be provided : ::ofset-reset-strategy One of : :ealiest Consumption of records will start from the beginning (ie. what has been set by a subsequent call to `set-beginning-offsets`). :latest (default) Consumption of records will start from the known end (ie. what has been set by a subsequent call to `set-end-offsets`).
(rebalance mock-consumer topic-partitions)
Simulates a rebalance event just like when consumers join or leave the relevant consumer group.
Simulates a rebalance event just like when consumers join or leave the relevant consumer group.
(set-beginning-offsets mock-consumer topic-partition->offset)
Sets beginning offsets by following a map of [topic partition] -> offset.
Sets beginning offsets by following a map of [topic partition] -> offset.
(set-end-offsets mock-consumer topic-partition->offset)
Sets end offsets by following a map of [topic partition] -> offset.
Sets end offsets by following a map of [topic partition] -> offset.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close