Class PollContext<K,​V>

java.lang.Object
io.confluent.parallelconsumer.PollContext<K,​V>
All Implemented Interfaces:
Iterable<RecordContext<K,​V>>

public class PollContext<K,​V>
extends Object
implements Iterable<RecordContext<K,​V>>
Context object used to pass messages to process to users processing functions.

Results sets can be iterated in a variety of ways. Explore the different methods available.

You can access for ConsumerRecords directly, or you can get the RecordContext wrappers, which provide extra information about the specific records, such as RecordContext.getNumberOfFailedAttempts().

Note that if you are not setting a ParallelConsumerOptions.batchSize, then you can use the getSingleRecord(), and it's convenience accessors (value(), offset(), key() getSingleConsumerRecord()). But if you have configured batching, they will all throw an IllegalArgumentException, as it's not valid to have batches of messages and yet tread the batch input as a single record.