liveBook · Manning

schedulePollTask

As explained in Kafka Streams in Action, Second Edition

schedulePollTask is a MockConsumer method that queues a task for execution during a subsequent consumer poll.

schedulePollTask queues a Runnable for a MockConsumer to execute on a later poll(Duration) call. This gives an indefinitely looping consumer deterministic test events without starting another test thread. section 14.1.1

Currency conversion loop

A test constructs CurrencyExchangeClient with a MockConsumer and MockProducer, queues initialization, adds euro, pound, and yen records, then queues close. The loop runs through the scripted polls, while the producer history verifies the three converted transactions.

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains queued Runnable execution, setup, records, ordering, and shutdown, without detailing MockConsumer internals.
Examples
Uses a currency exchange test with initialization, three currency records, ordered processing, and a final close task.
What it assumes
Assumes a consumer loop and MockConsumer while demonstrating setup, record injection, and controlled shutdown.
What you can do after
Apply via MockConsumer to script consumer polls, terminate loops deterministically, and verify produced records.
How it connects
Connects MockConsumer, poll(Duration), consumer records, producer history, and consumer-loop shutdown.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.