Consumer class
High-level Kafka consumer class.
Provides convenience layer on top of Kafka's low-level APIs.
Constructors
-
Consumer(KafkaSession session, ConsumerGroup consumerGroup, Map<
String, Set< topicPartitions, int maxWaitTime, int minBytes)int> > -
Creates new consumer identified by
consumerGroup.
Properties
- consumerGroup → ConsumerGroup
-
Consumer group this consumer belongs to.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxWaitTime → int
-
Maximum amount of time in milliseconds to block waiting if insufficient
data is available at the time the request is issued.
final
- minBytes → int
-
Minimum number of bytes of messages that must be available
to give a response.
final
- onOffsetOutOfRange ↔ OffsetOutOfRangeBehavior
-
Determines this consumer's strategy of handling
OffsetOutOfRangeAPI errors.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → KafkaSession
-
Instance of KafkaSession used to send requests.
final
-
topicPartitions
→ Map<
String, Set< int> > -
Topics and partitions to consume.
final
Methods
-
batchConsume(
int maxBatchSize) → Stream< BatchEnvelope> - Consume messages in batches.
-
consume(
{int limit = -1}) → Stream< MessageEnvelope> -
Consumes messages from Kafka. If
limitis specified consuming will stop after exactlylimitmessages have been retrieved. If no specific limit is set it'll default to-1and will consume all incoming messages continuously. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited